More ways to examine network connections on Linux


The ifconfig and netstat commands are incredibly useful, but there are many other commands that can help you see what’s up with you network on Linux systems. Today’s post explores some very handy commands for examining network connections.

ip command

The ip command shows a lot of the same kind of information that you’ll get when you use ifconfig. Some of the information is in a different format – e.g., “192.168.0.6/24” instead of “inet addr:192.168.0.6 Bcast:192.168.0.255” and ifconfig is better for packet counts, but the ip command has many useful options.

First, here’s the ip a command listing information on all network interfaces.

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1e:4f:c8:43:fc brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.6/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::21e:4fff:fec8:43fc/64 scope link
       valid_lft forever preferred_lft forever

If you want only to see a simple list of network interfaces, you can limit its output with grep.

Leave a Reply

Your email address will not be published. Required fields are marked *