Menu Close
Chapter 1. Consistent network interface device naming
Red Hat Enterprise Linux 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 initializes 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, 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 place.
- Defective hardware can be seamlessly replaced.
1.1. Network interface device naming hierarchy
If consistent device naming is enabled, which is the default in Red Hat Enterprise Linux, the udev
device manager generates device names based on the following schemes:
Scheme | Description | Example |
---|---|---|
1 |
Device names incorporate firmware or BIOS-provided index numbers for onboard devices. If this information is not available or applicable, |
|
2 |
Device names incorporate firmware or BIOS-provided PCI Express (PCIe) hot plug slot index numbers. If this information is not available or applicable, |
|
3 |
Device names incorporate the physical location of the connector of the hardware. If this information is not available or applicable, |
|
4 | Device names incorporate the MAC address. Red Hat Enterprise Linux does not use this scheme by default, but administrators can optionally use it. |
|
5 |
The traditional unpredictable kernel naming scheme. If |
|
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.
1.2. How the network device renaming works
By default, consistent device naming is enabled in Red Hat Enterprise Linux. 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:
-
The
/usr/lib/udev/rules.d/60-net.rules
file defines that the/lib/udev/rename_device
helper utility searches for theHWADDR
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 theDEVICE
parameter of the file. This file only exists after installing theinitscripts
package. -
The
/usr/lib/udev/rules.d/71-biosdevname.rules
file defines that thebiosdevname
utility renames the interface according to its naming policy, provided that it was not renamed in the previous step. -
The
/usr/lib/udev/rules.d/75-net-description.rules
file defines thatudev
examines the network interface device and sets the properties inudev
-internal variables that will be processed in the next step. Note that some of these properties might be undefined. The
/usr/lib/udev/rules.d/80-net-setup-link.rules
file calls thenet_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 ofudev
. 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 tomac
for media access control (MAC) address-based interface names.The
/usr/lib/udev/rules.d/80-net-setup-link.rules
file defines thatudev
renames the interface based on theudev
-internal parameters in the following order:-
ID_NET_NAME_ONBOARD
-
ID_NET_NAME_SLOT
-
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 Network interface device naming hierarchy.
Additional resources
- Customizing the prefix of Ethernet interfaces
-
For details about the
NamePolicy
parameter, see thesystemd.link(5)
man page.
1.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 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 function0
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 not0
.[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
).
1.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.
1.5. Disabling consistent interface device naming during the installation
This section describes how to disable consistent interface device naming during the installation.
Red Hat recommends not to disable consistent device naming and does not support this feature on hosts with more than one network interface. 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
- Boot the Red Hat Enterprise Linux 9 installation media.
-
In the boot manager, select
Install Red Hat Enterprise Linux 9
, and press the Tab key to edit the entry. Append the
net.ifnames=0
parameter to the kernel command line:vmlinuz... net.ifnames=0
- Press Enter to start the installation.
1.6. Disabling consistent interface device naming on an installed system
This section describes how to disable consistent interface device naming on a RHEL system that is already installed.
Red Hat recommends not to disable consistent device naming and does not support this feature on hosts with more than one network interface. Disabling consistent device naming can cause different kinds 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
Edit the
/etc/default/grub
file and append thenet.ifnames=0
parameter to theGRUB_CMDLINE_LINUX
variable:GRUB_CMDLINE_LINUX="... net.ifnames=0"
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
Display the current profile names and the associated device names:
# nmcli -f NAME,DEVICE,FILENAME connection show NAME DEVICE FILENAME System enp1s0 enp1s0 /etc/sysconfig/network-scripts/ifcfg-enp1s0 System enp7s0 enp7s0 /etc/NetworkManager/system-connections/enp7s0.nmconnection
Note which profile name and configuration file is associated with each device.
Remove
HWADDR
parameters from all connection profiles:# sed -i '/^HWADDR=/d' /etc/sysconfig/network-scripts/ifcfg-enp1s0 /etc/NetworkManager/system-connections/enp7s0.nmconnection
Display the MAC addresses that are associated with the Ethernet devices:
# ip link show ... 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:53:00:c5:98:1c brd ff:ff:ff:ff:ff:ff 3: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:53:00:b6:87:c6 brd ff:ff:ff:ff:ff:ff
Reboot the host:
# reboot
After the reboot, display the Ethernet devices and identify the new interface name based on the MAC address:
# ip link show ... 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:53:00:b6:87:c6 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:53:00:c5:98:1c brd ff:ff:ff:ff:ff:ff
If you compare the current output with the previous one:
-
Interface
enp7s0
(MAC address00:53:00:b6:87:c6
) is now namedeth0
. -
Interface
enp1s0
(MAC address00:53:00:c5:98:1c
) is now namedeth1
.
-
Interface
Rename the configuration file:
# mv /etc/NetworkManager/system-connections/enp7s0.nmconnection /etc/NetworkManager/system-connections/eth0.nmconnection # mv /etc/sysconfig/network-scripts/ifcfg-enp1s0 /etc/sysconfig/network-scripts/ifcfg-eth1
Reload NetworkManager:
# nmcli connection reload
If no profile name is set in the configuration files, NetworkManager uses a default value. To determine the current profile name after you renamed and reloaded the connections, enter:
# nmcli -f NAME,DEVICE,FILENAME connection show NAME FILENAME System enp7s0 /etc/NetworkManager/system-connections/eth0.nmconnection System enp1s0 /etc/sysconfig/network-scripts/ifcfg-eth1
You require the profile names in the next step.
Rename the NetworkManager connection profiles and update the interface name in each profile:
# nmcli connection modify "System enp7s0" connection.id eth0 connection.interface-name eth0 # nmcli connection modify "System enp1s0" connection.id eth1 connection.interface-name eth1
Reactivate the NetworkManager connections:
# nmcli connection up eth0 # nmcli connection up eth1
1.7. Customizing the prefix of Ethernet interfaces
You can customize the prefix of Ethernet interface names during the Red Hat Enterprise Linux installation.
Red Hat does not support customizing the prefix using the prefixdevname
utility on already deployed systems.
After the RHEL installation, the udev
service names Ethernet devices <prefix>.<index>
. For example, if you select the prefix net
, RHEL names Ethernet interfaces net0
, net1
, and so on.
Prerequisites
The prefix you want to set meets the following requirements:
- It consists of ASCII characters.
- It is an alpha-numeric string.
- It is shorter than 16 characters.
-
It does not conflict with any other well-known prefix used for network interface naming, such as
eth
,eno
,ens
, andem
.
Procedure
- Boot the Red Hat Enterprise Linux installation media.
In the boot manager:
-
Select the
Install Red Hat Enterprise Linux <version>
entry, and press Tab to edit the entry. -
Append
net.ifnames.prefix=<prefix>
to the kernel options. - Press Enter to start the installer.
-
Select the
- Install Red Hat Enterprise Linux.
Verification
After the installation, display the Ethernet 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:53:00:c5:98:1c brd ff:ff:ff:ff:ff:ff 3: net1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:53:00:c2:39:9e brd ff:ff:ff:ff:ff:ff ...
1.8. Assigning user-defined network interface names using udev rules
The udev
device manager supports a set of rules to customize the interface names.
Procedure
Display all network interfaces and their MAC addresses:
# ip link list enp6s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:58 brd ff:ff:ff:ff:ff:ff enp6s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:5a brd ff:ff:ff:ff:ff:ff enp4s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:90:fa:6a:7d:90 brd ff:ff:ff:ff:ff:ff
Create the file
/etc/udev/rules.d/70-custom-ifnames.rules
with the following contents:SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="b4:96:91:14:ae:58",ATTR{type}=="1",NAME="provider0" SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="b4:96:91:14:ae:5a",ATTR{type}=="1",NAME="provider1" SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:90:fa:6a:7d:90",ATTR{type}=="1",NAME="dmz"
These rules match the MAC address of the network interfaces and rename them to the name given in the NAME property. In these examples, ATTR{type} parameter value 1 defines that the interface is of type Ethernet.
Verification
Reboot the system.
# reboot
Verify that interface names for each MAC address match the value you set in the
NAME
parameter of the rule file:# ip link show provider0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:58 brd ff:ff:ff:ff:ff:ff altname enp6s0f0 provider1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:5a brd ff:ff:ff:ff:ff:ff altname enp6s0f1 dmz: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:90:fa:6a:7d:90 brd ff:ff:ff:ff:ff:ff altname enp4s0f0
Additional resources
-
udev(7)
man page -
udevadm(8)
man page -
/usr/src/kernels/<kernel_version>/include/uapi/linux/if_arp.h
provided by thekernel-doc
package
1.9. Assigning user-defined network interface names using systemd link files
Create a naming scheme by renaming network interfaces to provider0
.
Procedure
Display all interfaces names and their MAC addresses:
# ip link show enp6s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:58 brd ff:ff:ff:ff:ff:ff enp6s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:5a brd ff:ff:ff:ff:ff:ff enp4s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 00:90:fa:6a:7d:90 brd ff:ff:ff:ff:ff:ff
For naming the interface with MAC address b4:96:91:14:ae:58 to provider0, create the /etc/systemd/network/70-custom-ifnames.link file with following contents:
[Match] MACAddress=b4:96:91:14:ae:58 [Link] Name=provider0
This link file matches a MAC address and renames the network interface to the name set in the
Name
parameter.
Verification
Reboot the system:
# reboot
Verify that the device with the MAC address you specified in the link file has been assigned to
provider0
:# ip link show provider0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether b4:96:91:14:ae:58 brd ff:ff:ff:ff:ff:ff
Additional resources
-
systemd.link(5)
man page
1.10. Additional resources
-
See the
udev(7)
man page for details about theudev
device manager.