Author
Published
5 Mar 2025Form Number
LP2175PDF size
11 pages, 243 KBAbstract
Since the 1990s, the Linux kernel has undergone significant changes, including notable updates to the network naming scheme to address various concerns. For instance, starting with version 197, systemd/udev enhanced the naming scheme by incorporating MAC addresses and the physical locations of network interfaces, ensuring consistent and stable interface names across reboots.
This paper explores different network naming schemes and provides guidance on how to use them effectively. It is intended for Linux administrators with limited knowledge of network naming who want to quickly implement these schemes on a Lenovo ThinkSystem server.
Introduction
In the 1990s, network names were assigned by kernel, typically as eth0, eth1, and so on. However, as the boot process became increasingly parallel, these network names were no longer fixed or predictable. To address this issue, starting with version 197, systemd/udev introduced an improved naming scheme based on MAC addresses and the physical locations of network interfaces, ensuring consistent and stable interface names across reboots.
This paper explains various network naming schemes and provides guidance on configuring them to suit your preferences on a ThinkSystem server running Red Hat Enterprise Linux (RHEL) 9.2, SLES 15 SP4, or Ubuntu Server 22.04.
Traditional Naming Scheme
When the Operating System (OS) boots, network interfaces are assigned by kernel with format eth[Index]. The [Index] is the order number of network devices that match the order of the loaded driver modules. As the detection is in parallel, the assigned names may not be consistent after reboot, especially on a server with multiple network interfaces. This will cause the network to be unavailable due to firewall rules and other limitations. Most of the Linux distributions already change the default naming scheme to “Predictable naming” scheme, such as RHEL and Ubuntu, as described in the next section. However, for the users who prefer the ethX format or only have one network port, they still can use this scheme by passing the parameter net.ifnames=0 on the kernel command line.
Predictable Naming Scheme
This section introduces the benefits and workflow of predictable naming schemes.
Benefits
The users can get the following benefits from this new scheme compared to the traditional naming scheme:
- Consistent network port names across reboots.
- Compatible with all the Linux distributions with systemd/udev.
- The names are predictable as it maps to a unique attribute, such as MAC addresses, physical slots of the hardware, and others.
- Easy to customize the names for the appropriate ports.
- Easy to switch to another naming scheme.
Workflow
The udev manager defines the network name via 99-default.link files located in the /usr/lib/systemd/network/ and the local administration directory /etc/systemd/network/ (Files in /etc/ have the highest priority), once a higher priority rule is used, the lower priority rules will not run.
Figure 1. The name policy order of 99-default.link
The table below introduces the definition of each name policy.
The predictable naming structure is based on the interface types (represented by a two-character prefix) and supported attributes. Table 2 outlines the components that make up a fixed name.
Setting up the network port names in Linux
In this section, we provide a detailed guide on how to set the network name to your desired preference.
Switch to traditional naming scheme
If you want to use traditional naming scheme, all the name-assignment mechanisms need to be removed.
- Create an empty 99-default.link file in the /etc/systemd/network/ and regenerate the initrd RAM disk file.
# mkdir -p /etc/systemd/network/ # echo > /etc/systemd/network/99-default.link
For Red Hat and SLES:
# dracut -f
For Ubuntu:
# sudo update-initramfs -u -k all
- Remove the above customized configuration files. For example:
# rm -f /usr/lib/udev/rules.d/71-biosdevname.rules /etc/systemd/network/70-persistent-net.rules
- Remove the naming content in the relevant configuration files. For example, delete the content within the red rectangle in the 01-net.yml file and apply the new configuration in Ubuntu.
- All the network ports will use the traditional naming scheme after reboot.
Switch to predictable naming schemes
Most Linux distributions have adopted the predictable naming scheme as the default, but some, like SUSE, still use the traditional naming scheme by default. You can simply switch to the predictable naming scheme by adding boot parameter net.ifnames=1.
The following is an example of SLES 15 SP4:
Customized naming schemes
For a server with multiple network ports, the users may assign them to different tasks or prevent unexpected name changes by creating a custom naming scheme.
In this section:
Customize the name by switching the udev policy order
For a server with multiple network cards, the port names of the different network cards may flow different udev policy and have different format by default. Some names with slot policy, the other names with path policy. The users can adjust the udev policy order to have the uniform name format.
- Copy the system configuration file to the higher priority directory.
# cp /usr/lib/systemd/network/99-default.link /etc/systemd/network/
- Modify the 99-default.link. For example, set policy path priority over slot.
- Regenerate the initrd RAM disk file.
For Red Hat and SLES:
# dracut -f
For Ubuntu:
# sudo update-initramfs -u -k all
- Reboot the OS.
- The name scheme replaces slot to path.
Customize the name by using udev .rules files
The users can assign a fixed name for any interface via /etc/udev/rules.d/70-persistent-net.rules. The example below will use MAC address and bus info to name two different network ports.
- Identify the device MAC address and bus info.
Figure 7. Network port attribute (type, MAC address, dev_id) - Edit the file /etc/udev/rules.d/70-persistent-net.rules.
- Regenerate the initrd RAM disk file
- Reboot the OS.
- Verify the new network name.
Figure 10. Customized network name with udev rules and MAC address
Customize the name by using systemd .link files
In addition to the new default naming scheme, the users can customize it to fit their needs by using the /etc/systemd/network/70-*.link file.
- Identify the device MAC address and bus info (Same as the steps in Customize the name by .using udev .rules files section).
- Create a systemd configuration file for two network ports.
- Regenerate the initrd RAM disk file
- Reboot the OS.
- Verify the new network name.
Figure 14. Customized network name with systemd and MAC address
Limitations
If users want to change the default naming scheme, they should also be mindful of the following limitations.
- Be careful to use the MAC address to map the network name, as the systemd file may replace the MAC address from persistent to random via MACAddressPolicy=random, resulting in network’s unavailability.
- The custom network name must differ from the predefined naming schemes to avoid conflicts.
References
For more information, see these resources:
- Enabling predictable naming scheme for network interfaces
https://documentation.suse.com/smart/network/html/network-interface-predictable-naming/index.html - cmdline(7) — Linux manual page
https://man7.org/linux/man-pages/man7/dracut.cmdline.7.html - Configuring and managing networking on RHEL 9
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/configuring_and_managing_networking/index#assigning-alternative-names-to-a-network-interface-by-using-systemd-link-files_consistent-network-interface-device-naming - Configuring networks on Ubuntu
https://ubuntu.com/server/docs/configuring-networks
Author
Song Shang is a Linux Engineer in Lenovo Infrastructure Solutions Group, based in TianJin, China.
Thanks to the following people for their contributions to this project:
- David Watts, Lenovo Press
- Adrian Huang, Lenovo Linux Engineer
- Gary Cudak, Lenovo Lead Architect
Trademarks
Lenovo and the Lenovo logo are trademarks or registered trademarks of Lenovo in the United States, other countries, or both. A current list of Lenovo trademarks is available on the Web at https://www.lenovo.com/us/en/legal/copytrade/.
The following terms are trademarks of Lenovo in the United States, other countries, or both:
Lenovo®
ThinkSystem®
The following terms are trademarks of other companies:
Linux® is the trademark of Linus Torvalds in the U.S. and other countries.
Other company, product, or service names may be trademarks or service marks of others.
Configure and Buy
Full Change History
Course Detail
Employees Only Content
The content in this document with a is only visible to employees who are logged in. Logon using your Lenovo ITcode and password via Lenovo single-signon (SSO).
The author of the document has determined that this content is classified as Lenovo Internal and should not be normally be made available to people who are not employees or contractors. This includes partners, customers, and competitors. The reasons may vary and you should reach out to the authors of the document for clarification, if needed. Be cautious about sharing this content with others as it may contain sensitive information.
Any visitor to the Lenovo Press web site who is not logged on will not be able to see this employee-only content. This content is excluded from search engine indexes and will not appear in any search results.
For all users, including logged-in employees, this employee-only content does not appear in the PDF version of this document.
This functionality is cookie based. The web site will normally remember your login state between browser sessions, however, if you clear cookies at the end of a session or work in an Incognito/Private browser window, then you will need to log in each time.
If you have any questions about this feature of the Lenovo Press web, please email David Watts at dwatts@lenovo.com.