In CentOS 8 , consistent device mapping is enabled in which udev device manager generates device names based on various schemes mentioned in Redhat link.

1. eno1 -- Device names based on firmware or BIOS-provided index numbers for onboard devices. If this information is not available or applicable, udev uses scheme 2.

2. ens1 -- Device names based on firmware or BIOS-provided PCI Express (PCIe) hot plug slot index numbers, like in case of KVM Machine. If this information is not available or applicable, udev uses scheme 3.

3. ensp2s0 -- Device names based on the physical location of the connector of the hardware, if we have two ports in one nic. If this information is not available or applicable, udev uses scheme 5.

4. enx525400d5e8gc -- Device names based on MAC address. 

5. eth0 -- The traditional unpredictable kernel naming scheme. Only apply if udev cannot apply any other schemes, then device manager use this scheme.

In this CentOS8 Virtual machine on KVM Ubuntu, interface name as ens2 like below

[root@srv16 ~]# pifconfig ens2
ens2
        HWaddr 52:54:00:68:74:49
        inet addr:192.168.0.16 Bcast:192.168.0.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST

If we check dmesg messages, we can check there is messages which stats reaming from eth0 to ens2, like below.

[    1.877141] 8139cp 0000:00:02.0 eth0: RTL-8139C+ at 0x(____ptrval____), 52:54:00:68:74:49, IRQ 11
[    1.892287] 8139too: 8139too Fast Ethernet driver 0.9.28
[    1.895323] 8139cp 0000:00:02.0 ens2: renamed from eth0

It always suggested to use consistent device mapping, but still we need to use old style of device names, because many user don’t want to use new style or need common names for all type of machine and interfaces. So in this post we will see how we can rename these consistent device mapping to traditional mapping like ethX.

How to disable consistent interface naming

To disable consistent interface naming on CentOS8 we need to edit grub configuration parameters through editing on /etc/default/grub file.
We need to net.ifnames=0 parameter to GRUB_CMDLINE_LINE variable

GRUB_CMDLINE_LINUX="... net.ifnames=0"

To put this is effect we need to rebuild grub.cfg file and reboot machine. Any change in grub parameter need to rebuild grub.cfg file

# grub2-mkconfig -o /boot/grub2/grub.cfg

In case you have UEFI boot mode.

# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Now reboot machine

reboot

Once machine comes up we can check interface will change to old style like ethX

[root@srv16 ~]# pifconfig 
lo
        inet addr:127.0.0.1 Mask:255.0.0.0
        UP LOOPBACK RUNNING

eth0
        HWaddr 52:54:00:68:74:49
        inet addr:192.168.0.16 Bcast:192.168.0.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST