Starting with systemd/udev v197, predictable network interface naming is enabled by default and it’s recommended. The names of the network interfaces are incorporating the physical location of the hardware. Example of predictable interface name is enp0s3
, where enp stands for Ethernet Network Peripheral, 0 is the #bus_id and 3 is the #device_id.
lspci | grep -i eth
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
This new naming scheme is harder to read but is more stable ( read more ). If you want to name your network devices the old-fashioned way, you need to create new udev rules with higher priority or disable predictable naming scheme.
Tested on Debian 9.2 and CentOS 7.3
Method 1 – New udev rules
Create /etc/udev/rules.d/10-persistent-net.rules
with your favorite text editor, add the network devices by their MAC addresses and reboot the system.
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:01", NAME="eth0" ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:02", NAME="eth1"
Method 2 – Disable predictable naming scheme
1. Edit /etc/default/grub
and add net.ifnames=0
to GRUB_CMDLINE_LINUX=””.
Example:
GRUB_CMDLINE_LINUX="quiet net.ifnames=0"
2. Update the GRUB configuration file.
a.) Debian
grub-mkconfig -o /boot/grub/grub.cfg
b.) CentOS
grub2-mkconfig -o /boot/grub2/grub.cfg
3. Reboot