Enabling Predictable Naming Scheme for Network Interfaces
- 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.
If custom
udev
rules for assigning network interface names exist, they are used.If the biosdevname package is installed, its
udev
rules are used.If the device's firmware / BIOS index number for onboard devices is available, it is used. For example,
eno1
.If the device's firmware / BIOS PCI Express hotplug slot index number is available, it is used. For example,
ens1
.If the device's names incorporating physical / geographical location of the connector of the hardware are available, they are used. For example,
enp2s0
.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.
Boot the SLE installation media.
On the initial boot menu, enter
net.ifnames=1
at the prompt.Figure 1: Initial boot menu #Confirm with Enter and continue with the regular system installation.
If the biosdevname package is installed, uninstall it.
>
sudo
zypper rm biosdevnameBack up existing naming rules from
/etc/udev/rules.d
if they exist, for example:>
sudo
cp /etc/udev/rules.d/70-persistent-net.rules /backupRegenerate the initrd.
>
sudo
mkinitrdStart the YaST Boot Loader module and append
net.ifnames=1
to the kernel command line. Confirm with and reboot the system.Figure 2: GRUB 2 kernel command line #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.
Recover or create your own network interface naming scheme under
/etc/udev/rules.d/
, or reinstall the biosdevname package.Start the YaST Boot Loader module, delete
net.ifnames=1
if present, and appendnet.ifnames=0
to the kernel command line. Confirm with .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 #
For more detailed information about naming customization, read the
systemd.net-naming-scheme
man page (man 7 systemd.net-naming-scheme
).A more detailed description and reasoning behind the predictable naming scheme are given in https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/.
6 Legal Notice #
Copyright© 2006–2024 SUSE LLC and contributors. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”.
For SUSE trademarks, see https://www.suse.com/company/legal/. All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its affiliates. Asterisks (*) denote third-party trademarks.
All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors, nor the translators shall be held liable for possible errors or the consequences thereof.