Skip to main content
p. 236

9.10 Understanding Kernel Network Interfaces

The physical and the internet layers must be connected such that the internet layer can retain its hardware-independent flexibility. The Linux kernel maintains its own division between the two layers and provides a communication standard for linking them called a (kernel) network interface. When you configure a network interface, you link the IP address settings from the internet side with the hardware identification on the physical device side. Network interfaces usually have names that indicate the kind of hardware underneath, such as enp0s31f6 (an interface in a PCI slot). A name like this is called a predictable network interface device name, because it remains the same after a reboot. At boot time, interfaces have traditional names such as eth0 (the first Ethernet card in the computer) and wlan0 (a wireless interface), but on most machines running systemd, they are quickly renamed.

In Section 9.4.1, you learned how to view the network interface settings with ip address show. The output is organized by interface. Here’s the one we saw before:

2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
❶ UP group default qlen 1000
❷ link/ether 40:8d:5c:fc:24:1f brd ff:ff:ff:ff:ff:ff
inet 10.23.2.4/24 brd 10.23.2.255 scope global noprefixroute enp0s31f6
valid_lft forever preferred_lft forever
inet6 2001:db8:8500:e:52b6:59cc:74e9:8b6e/64 scope global dynamic
noprefixroute
valid_lft 86054sec preferred_lft 86054sec
inet6 fe80::d05c:97f9:7be8:bca/64 scope link noprefixroute
valid_lft forever preferred_lft forever
p. 237

Each network interface gets a number; this one is 2. Interface 1 is almost always the loopback described in Section 9.16. The flag UP tells you that the interface is working ❶. In addition to the internet layer pieces that we’ve already covered, you also see the MAC address on the physical layer, link/ether ❷.

Although ip shows some hardware information, it’s designed primarily for viewing and configuring the software layers attached to the interfaces. To dig deeper into the hardware and physical layer behind a network interface, use something like the ethtool command to display or change the settings on Ethernet cards. (We’ll look briefly at wireless networks in Section 9.27.)