Linux : How to rename the network interface in CentOS/RHEL7

By | April 2, 2016

Since the latest major version release of CentOS/RHEL 7, it seem that we wen’t a bit crazy about the whole systemd thing…

Seriously, having a network interface named “eno16780032” isn’t that great! Fortunately, there is a a way of getting back the old naming convention by following these steps :

1. Edit the Grub configuration file :

/etc/default/grub

2. Locate the line “GRUB_CMDLINE_LINUX=” and append the following parameter :

net.ifnames=0 biosdevname=0

Example :

GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 biosdevname=0"

3. Rebuild the Grub configuration :

For BIOS:

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

For EFI:

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

4. Copy the network configuration file, matching the new interface name :

cp -p /etc/sysconfig/network-scripts/ifcfg-<ifname> /etc/sysconfig/network-scripts/ifcfg-<new-ifname>

Example, assuming your interface name is “ens192” and the new interface name “eth0” :

cp -p /etc/sysconfig/network-scripts/ifcfg-ens192 /etc/sysconfig/network-scripts/ifcfg-eth0

5. Edit the net interface configuration :

/etc/sysconfig/network-scripts/ifcfg-eth0

Change the following values from the old to the new interface name :

NAME=
DEVICE=

You may now reboot your system.