Linux for Network Engineers: Interface Information

By November 14, 2018Linux

From a networking perspective, some of the most basic information to know about a Linux box is the status of its network interfaces. In this blog post, I will describe how to get that information.

The command that gives you that information is called “ip,” which, according to its manual, shows and manipulates routing, devices, policy routing and tunnels. So, apart from giving interface information, it is also highly capable with routing and interface manipulation. In this post, we’ll focus on how to get the interface information; in a future blog post, we’ll focus on the manipulation part.

List All Interfaces

Let’s start with the first command: “ip address.” If you want to save some keystrokes you can type the abbreviated “ip addr,” and if you want to save some more just type “ip a.”

As you can see above, there are three interfaces on this host, the loopback “lo,” the ethernet “eth0,” and the WiFi “wlan0.”

Interface Information Breakdown

The previous output may look a bit wordy and difficult to read, but you can break it down by asking ip to only print the information of a specific interface as follows:

To break this down a bit, ip gives the following information:

eth0: name of the interface
BROADCAST: it’s a broadcast interface which means it has a valid broadcast address
MULTICAST: it supports multicast
UP: the interface has been enabled and running (drivers loaded and working)
LOWER_UP: there is signal activity at the physical layer (a cable is plugged in)
mtu 1500: the maximum  transfer unit is 1500
qdisc pfifo_fast: used for packet queueing
state UP: network interface is up
group default: interface group
qlen 1000: transmission queue length

inet IPv4 address
brd broadcast address
scope global eth0: valid everywhere
valid_lft forever: valid lifetime for IPv4 address
preferred_lft forever: preferred lifetime for IPv4 address
inet6 fe80::ba27:ebff:fe57:911c/64: IPv6 address
scope link: valid only on this device
valid_lft forever: valid lifetime for IPv6 address
preferred_lft forever: preferred lifetime for IPv6 address

Interface Statistics

To get statistics on a specific interface, use the following commands. The output is self explanatory:

Routing Information

To get the routing information, use the following command:

We can see that the default route goes through interface eth0 and there two more routes on the eth0 and wlan0 interfaces.

If You are Having Trouble and Need Help

As per usual, you can look up all the command options on its manual page (“man ip”), but to make your lives easier, you can use the help option to get information on specific commands. For example, if you want to learn about the different options around the “address” set of commands you can type the following:

If you already have some experience with Linux, you might know about the ifconfig command, which can give similar information. I still use ifconfig, but the problem is that it’s getting deprecated from several Linux distributions. If you are a new user, I’d suggest to use only the “ip” command. If you are already familiar with ifconfig, it’s okay to keep using it, but keep in mind that its end-of-life is coming soon.