Networking
Listing interfaces
Section titled “Listing interfaces”Use the iproute2 commands. ifconfig belongs to the net-tools package, which is not
installed by default on RHEL 8 and later or on current Debian and Ubuntu releases, and which
does not report everything the kernel now tracks.
ip link show # interfaces and their stateip addr show # interfaces with their addressesip -br addr # one line per interface, easier to scanip route # the routing tablePredictable interface names
Section titled “Predictable interface names”systemd assigns interface names derived from the device’s type and its physical location, so a
name stays the same across reboots and kernel upgrades however many cards are fitted. The old
eth0/wlan0 names were allocated in enumeration order, which could change between boots and
therefore could not safely be referenced in configuration.
A name is a two-letter type prefix followed by a location:
| Prefix | Device type |
|---|---|
en | Ethernet |
wl | Wireless LAN |
ww | Wireless WAN (WWAN, for example a mobile broadband modem) |
ib | InfiniBand |
sl | Serial line IP (SLIP) |
The loopback interface keeps its fixed name, lo, and is not renamed by this scheme.
The location suffix says where the device is attached:
| Suffix | Meaning |
|---|---|
o<index> | On-board device, by firmware index |
s<slot> | Hotplug slot number |
p<bus>s<slot> | PCI geographic location: bus and slot |
u<port> | USB port chain |
x<MAC> | The device’s MAC address |
So enp3s0 is an Ethernet device on PCI bus 3, slot 0.
Deprecated names
Section titled “Deprecated names”| Name | Meaning |
|---|---|
eth0, eth1 | Ethernet interface, numbered in enumeration order |
wlan0, wlan1 | Wireless interface, numbered in enumeration order |
These still appear where predictable naming has been disabled on the kernel command line, and inside containers and virtual machines whose interfaces are created by the hypervisor. Do not rely on the number: it describes the order the kernel found the device in, not the device.
Related
Section titled “Related”- Firewall — why traffic to an interface is being dropped.
- TCP/IP Network Model — which layer a problem belongs to.