Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
documentation.suse.com / Enabling Predictable Naming Scheme for Network Interfaces

Enabling Predictable Naming Scheme for Network Interfaces

Publication Date: 27 Jun 2024
WHAT?

The predictable naming scheme provides stable and persistent names to system network interfaces. Such names offer more security and can survive system reboots and hardware changes.

WHY?

Learn what network interface naming schemes are and how to activate and deactivate the predictable naming scheme on your system.

EFFORT

It takes 15 minutes to read and understand how to activate the predictable naming scheme for network interfaces on your system.

REQUIREMENTS

You need root privileges to perform tasks described in this article.

1 Introduction

1.1 Traditional naming schemes

When SLE boots, network interface names are assigned. The traditional naming scheme used to assign names beginning with ethX, where X is the order number of the discovered matching driver of the related network device. Because the driver probing is not predictable, the assigned names may become unstable and on the next boot, eth0 may become eth1, for example. Such behavior has security implications because firewall rules are sensitive to unpredictable changes in network interface names.

Another and more recent approach based on the biosdevname package tries to find fixed slot topology information in certain firmware interfaces and uses them to assign fixed names to interfaces that incorporate their physical location on the mainboard.

1.2 What is a predictable naming scheme?

To make network interface naming persistent and customizable, you can activate more predictable naming of network interfaces based on systemd.

systemd offers a stable naming scheme closer to kernel-internal device identification. Together with udev rules, they create flexible algorithms for assigning network device names.

1.3 How does the predictable naming scheme work?

The following is the process of deriving the network interface naming. The priority of steps is top to bottom—if the device information outlined in a specific step is not available, the next step is a fallback.

  1. If custom udev rules for assigning network interface names exist, they are used.

  2. If the biosdevname package is installed, its udev rules are used.

  3. If the device's firmware / BIOS index number for onboard devices is available, it is used. For example, eno1.

  4. If the device's firmware / BIOS PCI Express hotplug slot index number is available, it is used. For example, ens1.

  5. If the device's names incorporating physical / geographical location of the connector of the hardware are available, they are used. For example, enp2s0.

  6. If none of the above information is available, the traditional unpredictable kernel-based naming is applied. For example, eth0.

1.4 Benefits of the predictable naming scheme

If you activate the systemd-based network interface naming scheme, you get the following benefits:

  • Persistent interface names between reboots.

  • Persistent interface names even if hardware is added or removed.

  • Interface names are automatically determined without user configuration.

  • The interface names are fully predictable. For example, by looking at the output of the lspci command, you can determine the name of the interface.

  • Fully stateless operation—changing the hardware configuration does not modify the content of /etc.

  • Compatibility with the read-only root / file system.

2 Enabling the predictable naming scheme

You can enable the predictable naming scheme either during a new system installation, or on an already installed system. Select one of the following procedures that matches your case.

Procedure 1: Enabling the naming scheme during the system installation
  1. Boot the SLE installation media.

  2. On the initial boot menu, enter net.ifnames=1 at the Boot Options prompt.

    Initial boot menu
    Figure 1: Initial boot menu
  3. Confirm with Enter and continue with the regular system installation.

Procedure 2: Enabling the naming scheme on an already installed system
  1. If the biosdevname package is installed, uninstall it.

    > sudo zypper rm biosdevname
  2. Back up existing naming rules from /etc/udev/rules.d if they exist, for example:

    > sudo cp /etc/udev/rules.d/70-persistent-net.rules /backup
  3. Regenerate the initrd.

    > sudo mkinitrd
  4. Start the YaST Boot Loader module and append net.ifnames=1 to the kernel command line. Confirm with OK and reboot the system.

    GRUB 2 kernel command line
    Figure 2: GRUB 2 kernel command line
  5. If the system is using wicked as a network manager, align the configuration of network interfaces. You can use the yast lan module or rename /etc/sysconfig/network/ifcfg-* files accordingly. Then restart wicked.

    > sudo systemctl restart wicked.service

3 Disabling the predictable naming scheme

The following procedure describes steps to disable the predictable naming scheme if you had previously enabled it and now have decided to revert to the traditional naming scheme.

  1. Recover or create your own network interface naming scheme under /etc/udev/rules.d/, or reinstall the biosdevname package.

  2. Start the YaST Boot Loader module, delete net.ifnames=1 if present, and append net.ifnames=0 to the kernel command line. Confirm with OK.

  3. Reboot the host.

4 Troubleshooting

udev-based network interface names mixed with traditional names

When mixed up naming schemes appear on your system, udev may not be able to create proper names for certain devices. There are two most common reasons for such behavior:

  • There is no usable information provided by the kernel to udev. Therefore, udev cannot figure out a device name.

  • The information provided to udev is not suitable, such as non-unique device IDs.

The solution is to create custom naming udev rules for the devices that are not properly named by the udev rules that are currently in use. Inspect files in the /etc/udev/rules.d directory, for example, 70-persistent-net.rules.

5 For more information