Linux Network Interface Naming
Traditionally, network interfaces on Linux are enumerated as eth[0...n]
, where the first device being probed on start up is assigned eth0
and so on. Modern Linux utilizing systemd will assign network interfaces based on a Predictable Network Interface naming scheme which corresponds the network name to its hardware location. For example, an interface is named wlp2p1
because it is a wireless device located at a PCI bus 2, slot 1. The motivation for this is to deterministically set network adapter names on systems with multiple adapters.
Predictable Network Naming
Systems using the predictable network naming scheme will be named according to the following (simplified) rules. For the full description of these rules in greater detail, see the Red Hat documentation for RHEL 8 on predictable network naming.
Prefix | Suffix |
---|---|
|
|
For example: eno0 is the first onboard ethernet device, while enp0s0 is the first ethernet device connected to the first bus on the first slot.
Revert back to the traditional eth[0..N]
naming scheme
You can revert back the old naming scheme using any one of the following methods as outlined on this systemd page.
- You create your own manual naming scheme by creating your own
custom.link
files within/etc/systemd/network/
which defines the specific name you wish to use. The description for this file is outlined at https://www.freedesktop.org/software/systemd/man/systemd.link.htmlIn the example above, the device matching the given MAC address will have its name set to eth0.# Match based on MAC address (and device path if uncommented) [Match] MACAddress=00:a0:de:63:7a:e6 # Path=pci-0000:02:00.0-* # Link properties [Link] Name=eth0
- You pass
net.ifnames=0
to the kernel on boot by setting it in the boot loader. This is not recommended on systems with multiple network interfaces as they may be assigned names inconsistently across reboots. This should be safe on systems with only one network adapter. You set this kernel argument this by editing/etc/default/grub
, appendingnet.ifnames=0
to the kernel command line, applying it withgrub2-mkconfig -o /boot/grub2/grub.cfg
, and then rebooting. - You disable the assignment of fixed names by symlinking
/etc/systemd/network/99-default.link
to/dev/null
and rebuilding initrd.
Renumbering network interfaces
If your system is relying on udev rather than systemd-udevd (and thereby using systemd's predictable network interfacing naming scheme), after inserting and removing network interfaces, your network interface now has a non-zero number. For example, after inserting and replacing a network interface twice, the primary interface is now named eth2
. Systems affected by this problem includes RHEL 6 or prior.
To rename interfaces so that it starts back at eth0
, edit the udev rules defined in /etc/udev/rules.d/70-persistent-net.rules
. Remove lines defining the extraneous interfaces that you don't want. Once done, ensure that your network configs in /etc/sysconfig/network-scripts/
matches up to your new network interface names.
Reboot to apply.
See Also
- Udev Rules
- https://access.redhat.com/solutions/2435891
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/ch-consistent_network_device_naming
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/consistent-network-interface-device-naming_configuring-and-managing-networking