Chapter 2. Consistent network interface device naming

Red Hat Enterprise Linux 8 provides methods for consistent and predictable device naming for network interfaces. These features help locating and differentiating network interfaces.

The kernel assigns names to network interfaces by concatenating a fixed prefix and a number that increases as the kernel initialize the network devices. For instance, eth0 would represent the first device being probed on start-up. However, these names do not necessarily correspond to labels on the chassis. Modern server platforms with multiple network adapters can encounter non-deterministic and counter-intuitive naming of these interfaces. This affects both network adapters embedded on the system board and add-in adapters.

In Red Hat Enterprise Linux 8, the udev device manager supports a number of different naming schemes. By default, udev assigns fixed names based on firmware, topology, and location information. This has the following advantages:

  • Device names are fully predictable.
  • Device names stay fixed even if you add or remove hardware, because no re-enumeration takes places.
  • Defective hardware can be seamlessly replaced.

2.1. Network interface device naming hierarchy

If consistent device naming is enabled, which is the default in Red Hat Enterprise Linux 8, the udev device manager generates device names based on the following schemes:

SchemeDescriptionExample

1

Device names incorporate firmware or BIOS-provided index numbers for onboard devices. If this information is not available or applicable, udev uses scheme 2.

eno1

2

Device names incorporate firmware or BIOS-provided PCI Express (PCIe) hot plug slot index numbers. If this information is not available or applicable, udev uses scheme 3.

ens1

3

Device names incorporate the physical location of the connector of the hardware. If this information is not available or applicable, udev uses scheme 5.

enp2s0

4

Device names incorporate the MAC address. Red Hat Enterprise Linux does not use this scheme by default, but administrators can optionally use it.

enx525400d5e0fb

5

The traditional unpredictable kernel naming scheme. If udev cannot apply any of the other schemes, the device manager uses this scheme.

eth0

By default, Red Hat Enterprise Linux selects the device name based on the NamePolicy setting in the /usr/lib/systemd/network/99-default.link file. The order of the values in NamePolicy is important. Red Hat Enterprise Linux uses the first device name that is both specified in the file and that udev generated.

If you manually configured udev rules to change the name of kernel devices, those rules take precedence.

2.2. How the network device renaming works

By default, consistent device naming is enabled in Red Hat Enterprise Linux 8. The udev device manager processes different rules to rename the devices. The following list describes the order in which udev processes these rules and what actions these rules are responsible for:

  1. The /usr/lib/udev/rules.d/60-net.rules file defines that the /lib/udev/rename_device helper utility searches for the HWADDR parameter in /etc/sysconfig/network-scripts/ifcfg-* files. If the value set in the variable matches the MAC address of an interface, the helper utility renames the interface to the name set in the DEVICE parameter of the file.
  2. The /usr/lib/udev/rules.d/71-biosdevname.rules file defines that the biosdevname utility renames the interface according to its naming policy, provided that it was not renamed in the previous step.
  3. The /usr/lib/udev/rules.d/75-net-description.rules file defines that udev examines the network interface device and sets the properties in udev-internal variables, that will be processed in the next step. Note that some of these properties might be undefined.
  4. The /usr/lib/udev/rules.d/80-net-setup-link.rules file calls the net_setup_link udev built-in which then applies the policy. The following is the default policy that is stored in the /usr/lib/systemd/network/99-default.link file:

    [Link]
    NamePolicy=kernel database onboard slot path
    MACAddressPolicy=persistent

    With this policy, if the kernel uses a persistent name, udev does not rename the interface. If the kernel does not use a persistent name, udev renames the interface to the name provided by the hardware database of udev. If this database is not available, Red Hat Enterprise Linux falls back to the mechanisms described above.

    Alternatively, set the NamePolicy parameter in this file to mac for media access control (MAC) address-based interface names.

  5. The /usr/lib/udev/rules.d/80-net-setup-link.rules file defines that udev renames the interface based on the udev-internal parameters in the following order:

    1. ID_NET_NAME_ONBOARD
    2. ID_NET_NAME_SLOT
    3. ID_NET_NAME_PATH

    If one parameter is not set, udev uses the next one. If none of the parameters are set, the interface is not renamed.

Steps 3 and 4 implement the naming schemes 1 to 4 described in Section 2.1, “Network interface device naming hierarchy”.

Additional resources

2.3. Predictable network interface device names on the x86_64 platform explained

When the consistent network device name feature is enabled, the udev device manager creates the names of devices based on different criteria. This section describes the naming scheme when Red Hat Enterprise Linux 8 is installed on a x86_64 platform.

The interface name starts with a two-character prefix based on the type of interface:

  • en for Ethernet
  • wl for wireless LAN (WLAN)
  • ww for wireless wide area network (WWAN)

Additionally, one of the following is appended to one of the above-mentioned prefix based on the schema the udev device manager applies:

  • o<on-board_index_number>
  • s<hot_plug_slot_index_number>[f<function>][d<device_id>]

    Note that all multi-function PCI devices have the [f<function>] number in the device name, including the function 0 device.

  • x<MAC_address>
  • [P<domain_number>]p<bus>s<slot>[f<function>][d<device_id>]

    The [P<domain_number>] part defines the PCI geographical location. This part is only set if the domain number is not 0.

  • [P<domain_number>]p<bus>s<slot>[f<function>][u<usb_port>][…​][c<config>][i<interface>]

    For USB devices, the full chain of port numbers of hubs is composed. If the name is longer than the maximum (15 characters), the name is not exported. If there are multiple USB devices in the chain, udev suppresses the default values for USB configuration descriptors (c1) and USB interface descriptors (i0).

2.4. Predictable network interface device names on the System z platform explained

When the consistent network device name feature is enabled, the udev device manager on the System z platform creates the names of devices based on the bus ID. The bus ID identifies a device in the s390 channel subsystem.

For a channel command word (CCW) device, the bus ID is the device number with a leading 0.n prefix where n is the subchannel set ID.

Ethernet interfaces are named, for example, enccw0.0.1234. Serial Line Internet Protocol (SLIP) channel-to-channel (CTC) network devices are named, for example, slccw0.0.1234.

Use the znetconf -c or the lscss -a commands to display available network devices and their bus IDs.

2.5. Disabling consistent interface device naming during the installation

This section describes how to disable consistent interface device naming during the installation.

Warning

Red Hat recommends not to disable consistent device naming. Disabling consistent device naming can cause different kind of problems. For example, if you add another network interface card to the system, the assignment of the kernel device names, such as eth0, is no longer fixed. Consequently, after a reboot, the Kernel can name the device differently.

Procedure

  1. Boot the Red Hat Enterprise Linux 8 installation media.
  2. In the boot manager, select Install Red Hat Enterprise Linux 8, and press the Tab key to edit the entry.
  3. Append the net.ifnames=0 parameter to the kernel command line:

    vmlinuz... net.ifnames=0
  4. Press Enter to start the installation.

2.6. Disabling consistent interface device naming on an installed System

This section describes how to disable consistent interface device naming on a system that is already installed.

Warning

Red Hat recommends not to disable consistent device naming. Disabling consistent device naming can cause different kind of problems. For example, if you add another network interface card to the system, the assignment of the kernel device names, such as eth0, is no longer fixed. Consequently, after a reboot, the Kernel can name the device differently.

Prerequisites

  • The system uses consistent interface device naming, which is the default.

Procedure

  1. Edit the /etc/default/grub file and append the net.ifnames=0 parameter to the GRUB_CMDLINE_LINUX variable:

    GRUB_CMDLINE_LINUX="... *net.ifnames=0
  2. Rebuild the grub.cfg file:

    • On a system with UEFI boot mode:

      # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
    • On a system with legacy boot mode:

      # grub2-mkconfig -o /boot/grub2/grub.cfg
  3. If you use interface names in configuration files or scripts, you must manually update them.
  4. Reboot the host:

    # reboot

2.7. Using prefixdevname for naming of Ethernet network interfaces

This documentation describes how to set the prefixes for consistent naming ot Ethernet network interfaces in case that you do not want to use the default naming scheme of such interfaces.

However, Red Hat recommends to use the default naming scheme, which is the same as in Red Hat Enterprise Linux 7.

For more details about this scheme, see Consistent Network Device Naming.

2.7.1. Introduction to prefixdevname

The prefixdevname tool is a udev helper utility that enables you to define your own prefix used for naming of the Ethernet network interfaces.

2.7.2. Setting prefixdevname

The setting of the prefix with prefixdevname is done during system installation.

To set and activate the required prefix for your Ethernet network interfaces, use the following procedure.

Procedure

  • Add the following string on the kernel command line:

    net.ifnames.prefix=<required prefix>
Warning

Red Hat does not support the use of prefixdevname on already deployed systems.

After the prefix was once set, and the operating system was rebooted, the prefix is effective every time when a new network interface appears. The new device is assigned a name in the form of <PREFIX><INDEX>. For example, if your selected prefix is net, and the interfaces with net0 and net1 prefixes already exist on the system, the new interface is named net2. The prefixdevname utility then generates the new .link file in the /etc/systemd/network directory that applies the name to the interface with the MAC address that just appeared. The configuration is persistent across reboots.

2.7.3. Limitations of prefixdevname

There are certain limitations for prefixes of Ethernet network interfaces.

The prefix that you choose must meet the following requirements:

  • Be ASCII string
  • Be alphanumeric string
  • Be shorter than 16 characters
Warning

The prefix cannot conflict with any other well-known prefix used for network interface naming on Linux. Specifically, you cannot use these prefixes: eth, eno, ens, em.