skip to main content

Linux Network Naming Schemes

Planning / Implementation

Home
Top
Author
Published
5 Mar 2025
Form Number
LP2175
PDF size
11 pages, 243 KB

Abstract

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:

  1. Consistent network port names across reboots.
  2. Compatible with all the Linux distributions with systemd/udev.
  3. The names are predictable as it maps to a unique attribute, such as MAC addresses, physical slots of the hardware, and others.
  4. Easy to customize the names for the appropriate ports.
  5. 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.

The name policy order of 99-default.link
Figure 1. The name policy order of 99-default.link

The table below introduces the definition of each name policy.

Table 1. Name policy definition
Policy Property/Configuration File Example Description
Customized udev rules /etc/systemd/network/70-*.link PXE Defines a custom name for the specified device.
The biosdevname rules /usr/lib/udev/rules.d/71-biosdevname.rules em1 A predictable naming rule created by Dell.
kernel N/A lo If kernel detects the device name is predictable, it will be skipped.
database ID_NET_NAME_FROM_DATABASE idrac Only have an entry.
onboard ID_NET_NAME_ONBOARD eno0 Based on index number.
slot ID_NET_NAME_SLOT ens9f0 Based on the PCI Express hotplug network devices with available slot index number.
path ID_NET_NAME_PATH enp33s0f0 Based on the physical/geographical location of the hardware.
MAC address ID_NET_NAME_MAC enxAABBCCDDEEFF It does not used by default.
Traditional kernel-based name N/A eth0 If none of the above polices can be met, it will apply the unpredictable naming scheme.

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.

Table 2. Predictable Naming Scheme
Interface Type Prefix   Name Policy Format (abbreviation)
ethernet en + Onboard o (Lowercase O, not zero)
wlan wl Slot s[f][d]
wwan ww Path [P]ps[f][d]
    All x

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.

  1. 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
    
  2. 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
    
  3. 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.

    Customized netplan file
    Figure 2. Customized netplan file

  4. All the network ports will use the traditional naming scheme after reboot.

    Traditional network name list
    Figure 3. Traditional network name list

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:

  1. Edit the /etc/default/grub file and regenerate the grub.cfg file.
    # sed -i "/GRUB_CMDLINE_LINUX=/s/\"/\"net.ifnames=1 /" /etc/default/grub
    # grub2-mkconfig -o /boot/grub2/grub.cfg
    
  2. The name of network ports should be predictable after reboot.

    Predictable name list
    Figure 4. Predictable name list

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.

  1. Copy the system configuration file to the higher priority directory.
    # cp /usr/lib/systemd/network/99-default.link /etc/systemd/network/
    
  2. Modify the 99-default.link. For example, set policy path priority over slot.

    Customized 99-default.link
    Figure 5. Customized 99-default.link

  3. Regenerate the initrd RAM disk file.

    For Red Hat and SLES:

    # dracut -f
    

    For Ubuntu:

    # sudo update-initramfs -u -k all
    
  4. Reboot the OS.
  5. The name scheme replaces slot to path.

    Network name list with policy “path”
    Figure 6. Network name list with policy “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.

  1. Identify the device MAC address and bus info.

    Network port attribute (type, MAC address, dev_id)
    Figure 7. Network port attribute (type, MAC address, dev_id)

    The path of network port
    Figure 8. The path of network port

  2. Edit the file /etc/udev/rules.d/70-persistent-net.rules.

    Customized 70-persistent-net.rules
    Figure 9. Customized 70-persistent-net.rules

  3. Regenerate the initrd RAM disk file
  4. Reboot the OS.
  5. Verify the new network name.

    Customized network name with udev rules and MAC address
    Figure 10. Customized network name with udev rules and MAC address

    Customized network name with udev rules and path
    Figure 11. Customized network name with udev rules and path

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.

  1. Identify the device MAC address and bus info (Same as the steps in Customize the name by .using udev .rules files section).
  2. Create a systemd configuration file for two network ports.

    systemd 70-mac.link
    Figure 12. systemd 70-mac.link

    systemd 70-path.link
    Figure 13. systemd 70-path.link

  3. Regenerate the initrd RAM disk file
  4. Reboot the OS.
  5. Verify the new network name.

    Customized network name with systemd and MAC address
    Figure 14. Customized network name with systemd and MAC address

    Customized network name with systemd and path
    Figure 15. Customized network name with systemd and path

Customize the name by using netplan files (Ubuntu only)

In Ubuntu, the software netplan also can set a fixed name for a specified MAC address.

  1. Create the YAML format file for a specified MAC address and apply it.

    Customized netplan file with MAC address
    Figure 16. Customized netplan file with MAC address

  2. Verify the new network name.

    Customized network name with netplan and MAC address
    Figure 17. Customized network name with netplan and MAC address

Limitations

If users want to change the default naming scheme, they should also be mindful of the following limitations.

  1. 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.
  2. The custom network name must differ from the predefined naming schemes to avoid conflicts.

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

Related product families

Product families related to this document are the following:

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.