I Hope you all guys noticed that in many of new Linux version Linux/Unix machine network interface name has been changed from eth to ens. In these case sometime we think to change it to old eth naming. In this post we will see howTo Change default network interface name “ens” to old “eth”.


We are working on CentOS 7.4 latest as of now

[root@srv7-1 ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@srv7-1 ~]# uname  -r
3.10.0-693.2.2.el7.x86_64

Let’s see its interface name

[root@srv7-1 ~]# ip link show ens7
2: ens7:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:5f:d0:20 brd ff:ff:ff:ff:ff:ff

we have two Interface cards, but its enough to show one interface output just to make post short.

Now we need to make changes in /etc/default/grub file against GRUB_CMDLINE_LINUX like below.

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap console=ttyS0,115200n8 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us net.ifnames=0 biosdevname=0"

Further we have to update grub2 with following command.

[root@srv7-1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.2.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.2.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-0ddcb4e36c9ad645a09b978c217c375c
Found initrd image: /boot/initramfs-0-rescue-0ddcb4e36c9ad645a09b978c217c375c.img
[ 1405.723140] xor: automatically using best checksumming function:
[ 1405.733014]    avx       : 29476.000 MB/sec
[ 1405.754027] raid6: sse2x1    7902 MB/s
[ 1405.771014] raid6: sse2x2   10707 MB/s
[ 1405.788121] raid6: sse2x4    9148 MB/s
[ 1405.805012] raid6: avx2x1   15699 MB/s
[ 1405.822103] raid6: avx2x2   15746 MB/s
[ 1405.840014] raid6: avx2x4   23445 MB/s
[ 1405.840506] raid6: using algorithm avx2x4 (23445 MB/s)
[ 1405.841121] raid6: using avx2x2 recovery algorithm
[ 1405.876419] bio: create slab  at 2
[ 1405.879786] Btrfs loaded
[ 1405.892629] fuse init (API version 7.22)
done

Further we should need to reboot machine. After login we could see same mac-address interface card name has been changed.

[root@srv7-1 ~]# ip addr show eth0
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:5f:d0:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.12/24 brd 192.168.11.255 scope global dynamic eth0
       valid_lft 2888sec preferred_lft 2888sec
    inet6 fe80::f9fe:696d:1ed9:3f2b/64 scope link 
       valid_lft forever preferred_lft forever