You can change network interface naming conventions for RHEL, CentOS, Oracle Linux, and Suse Linux systems.
Procedure
-
Open the grub file:
$ vi /etc/default/grub
-
Add
net.ifnames=0 biosdevname=0
at the end of the GRUB_CMDLINE_LINUX line:GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.keymap=us crashkernel=auto rd.lvm.lv=centos/root vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0 biosdevname=0"
-
Save the file and exit.
-
Check to ensure the changes you made are correct:
$ grub2-mkconfig
-
If changes are correct, update the grub configuration:
$ grub2-mkconfig -o /boot/grub2/grub.cfg
If VM uses UEFI boot, update the grub configuration:
grub2-mkconfig -o /boot/efi/EFI/{version}/grub.cfg
where:
-
For ubuntu, {
version
}= ubuntu
-
For centos, {
version
}= centos
-
For RHEL & Oracle Linux, {
version
}= redhat
-
-
Change directory to network-scripts folder:
$ cd /etc/sysconfig/network-scripts
-
Copy the interface file name from the original name ens192 to eth0:
$ cp ifcfg-ens192 ifcfg-eth0
-
Open the ifcfg-eth0 file and change the NAME and DEVICE variables inside the file (that reflect the names of the interface) to eth0.
This parameter should be set in ifcfg-eth0:
ONBOOT=yes
Sample output:
Type=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=ens192 UUID=9a8547cd-4d40-4d51-bdfc-e213dl8828a6 DEVICE=ens192 ONBOOT=yes IPV6_PRIVACY=no