Chapter 1. Implementing consistent network interface naming
udev device manager implements consistent device naming in Red Hat Enterprise Linux. The device manager supports different naming schemes and, by default, assigns fixed names based on firmware, topology, and location information.
Without consistent device naming, the Linux kernel assigns names to network interfaces by combining a fixed prefix and an index. The index increases as the kernel initializes the network devices. For example,
eth0 represents the first Ethernet device being probed on start-up. If you add another network interface controller to the system, the assignment of the kernel device names is no longer fixed because, after a reboot, the devices can initialize in a different order. In that case, the kernel can name the devices differently.
To solve this problem,
udev assigns consistent device names. This has the following advantages:
- Device names are stable across reboots.
- Device names stay fixed even if you add or remove hardware.
- Defective hardware can be seamlessly replaced.
- The network naming is stateless and does not require explicit configuration files.
Generally, Red Hat does not support systems where consistent device naming is disabled. For exceptions, see the Is it safe to set net.ifnames=0 solution.
1.1. How the udev device manager renames network interfaces
To implement a consistent naming scheme for network interfaces, the
udev device manager processes the following rule files in the listed order:
/usr/lib/udev/rules.d/60-net.rulesfile defines that the deprecated
/usr/lib/udev/rename_devicehelper utility searches for the
/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
DEVICEparameter of the
If the system uses only NetworkManager connection profiles in keyfile format,
udevskips this step.
Only on Dell systems:
This file exists only if the
biosdevnamepackage is installed, and the rules file defines that the
biosdevnameutility renames the interface according to its naming policy, if it was not renamed in the previous step.Note
Install and use
biosdevnameonly on Dell systems.
This file defines how
udevexamines the network interface and sets the properties in
udev-internal variables. These variables are then processed in the next step by the
/usr/lib/udev/rules.d/80-net-setup-link.rulesfile. Some of the properties can be undefined.
This file calls the
net_setup_linkbuiltin of the
udevrenames the interface based on the order of the policies in the
NamePolicyparameter in the
/usr/lib/systemd/network/99-default.linkfile. For further details, see Network interface naming policies.
If none of the policies applies,
udevdoes not rename the interface.
1.2. Network interface naming policies
By default, the
udev device manager uses the
/usr/lib/systemd/network/99-default.link file to determine which device naming policies to apply when it renames interfaces. The
NamePolicy parameter in this file defines which policies
udev uses and in which order:
NamePolicy=kernel database onboard slot path
The following table describes the different actions of
udev based on which policy matches first as specified by the
If the kernel indicates that a device name is predictable,
This policy assigns names based on mappings in the
Device names incorporate firmware or BIOS-provided index numbers for onboard devices.
Device names incorporate firmware or BIOS-provided PCI Express (PCIe) hot-plug slot-index numbers.
Device names incorporate the physical location of the connector of the hardware.
Device names incorporate the MAC address. By default, Red Hat Enterprise Linux does not use this policy, but administrators can enable it.
- How the udev device manager renames network interfaces
1.3. Network interface naming schemes
udev device manager uses certain stable interface attributes to generate consistent device names. For details about the naming schemes for different device types and platforms, see the
systemd.net-naming-scheme(7) man page.
1.4. Determining a predictable RoCE device name on the IBM Z platform
On Red Hat Enterprise Linux (RHEL) 8.7 and later, the
udev device manager sets names for RoCE interfaces on IBM Z as follows:
If the host enforces a unique identifier (UID) for a device,
udevassigns a consistent device name that is based on the UID, for example
If the host does not enforce a UID for a device, the behavior depends on your settings:
udevuses unpredictable names for the device.
If you set the
net.naming-scheme=rhel-8.7kernel command line option,
udevassigns a consistent device name that is based on the function identifier (FID) of the device, for example
- By default,
Manually configure predictable device name for RoCE interfaces on IBM Z in the following cases:
Your host runs RHEL 8.6 or earlier and enforces a UID for a device, and you plan to update to RHEL 8.7 or later.
After an update to RHEL 8.7 or later,
udevuses consistent interface names. However, if you used unpredictable device names before the update, NetworkManager connection profiles still use these names and fail to activate until you update the affected profiles.
- Your host runs RHEL 8.7 or later and does not enforce a UID, and you plan to upgrade to RHEL 9.
Before you can use a
udev rule or a
systemd link file to rename an interface manually, you must determine a predictable device name.
- An RoCE controller is installed in the system.
sysfsutilspackage is installed.
Display the available network devices, and note the names of the RoCE devices:
# ip link show ... 2: enP5165p0s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 ...
Display the device path in the
# systool -c net -p Class = "net" Class Device = "enP5165p0s0" Class Device path = "/sys/devices/pci142d:00/142d:00:00.0/net/enP5165p0s0" Device = "142d:00:00.0" Device path = "/sys/devices/pci142d:00/142d:00:00.0"
Use the path shown in the
Device pathfield in the next steps.
Display the value of the
<device_path>/uid_id_uniquefile, for example:
# cat /sys/devices/pci142d:00/142d:00:00.0/uid_id_unique
The displayed value indicates whether UID uniqueness is enforced or not, and you require this value in later steps.
Determine a unique identifier:
If UID uniqueness is enforced (
1), display the UID stored in the
<device_path>/uidfile, for example:
# cat /sys/devices/pci142d:00/142d:00:00.0/uid
If UID uniqueness is not enforced (
0), display the FID stored in the
<device_path>/function_idfile, for example:
# cat /sys/devices/pci142d:00/142d:00:00.0/function_id
The outputs of the commands display the UID and FID values in hexadecimal.
Convert the hexadecimal identifier to decimal, for example:
# printf "%d\n" 0x00001402 5122
To determine the predictable device name, append the identifier in decimal format to the corresponding prefix based on whether UID uniqueness is enforced or not:
If UID uniqueness is enforced, append the identifier to the
enoprefix, for example
If UID uniqueness is not enforced, append the identifier to the
ensprefix, for example
- If UID uniqueness is enforced, append the identifier to the
Use one of the following methods to rename the interface to the predictable name:
- IBM documentation: Network interface names
1.5. Customizing the prefix for Ethernet interfaces during installation
If you do not want to use the default device-naming policy for Ethernet interfaces, you can set a custom device prefix during the Red Hat Enterprise Linux (RHEL) installation.
Red Hat supports systems with customized Ethernet prefixes only if you set the prefix during the RHEL installation. Using the
prefixdevname utility on already deployed systems is not supported.
If you set a device prefix during the installation, the
udev service uses the
<prefix><index> format for Ethernet interfaces after the installation. For example, if you set the prefix
net, the service assigns the names
net1, and so on to the Ethernet interfaces.
udev service appends the index to the custom prefix, and preserves the index values of known Ethernet interfaces. If you add an interface,
udev assigns an index value that is one greater than the previously-assigned index value to the new interface.
- The prefix consists of ASCII characters.
- The prefix is an alphanumeric string.
- The prefix is shorter than 16 characters.
The prefix does not conflict with any other well-known network interface prefix, such as
- Boot the Red Hat Enterprise Linux installation media.
In the boot manager, follow these steps:
Install Red Hat Enterprise Linux <version>entry.
- Press Tab to edit the entry.
net.ifnames.prefix=<prefix>to the kernel options.
- Press Enter to start the installation program.
- Select the
- Install Red Hat Enterprise Linux.
To verify the interface names, display the network interfaces:
# ip link show ... 2: net0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff ...
1.6. Configuring user-defined network interface names by using udev rules
You can use
udev rules to implement custom network interface names that reflect your organization’s requirements.
Identify the network interface that you want to rename:
# ip link show ... enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff ...
Record the MAC address of the interface.
Display the device type ID of the interface:
# cat /sys/class/net/enp1s0/type 1
/etc/udev/rules.d/70-persistent-net.rulesfile, and add a rule for each interface that you want to rename:
70-persistent-net.rulesas a file name if you require consistent device names during the boot process. The
dracututility adds a file with this name to the
initrdimage if you regenerate the RAM disk image.
For example, use the following rule to rename the interface with MAC address
Optional: Regenerate the
initrdRAM disk image:
# dracut -f
You require this step only if you need networking capabilities in the RAM disk. For example, this is the case if the root file system is stored on a network device, such as iSCSI.
Identify which NetworkManager connection profile uses the interface that you want to rename:
# nmcli -f device,name connection show DEVICE NAME enp1s0 example_profile ...
connection.interface-nameproperty in the connection profile:
# nmcli connection modify example_profile connection.interface-name ""
Temporarily, configure the connection profile to match both the new and the previous interface name:
# nmcli connection modify example_profile match.interface-name "provider0 enp1s0"
Reboot the system:
Verify that the device with the MAC address that you specified in the link file has been renamed to
# ip link show provider0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff ...
Configure the connection profile to match only the new interface name:
# nmcli connection modify example_profile match.interface-name "provider0"
You have now removed the old interface name from the connection profile.
Reactivate the connection profile:
# nmcli connection up example_profile