How to restore the old network interface name in RHEL 7 / Centos 7

on November 3rd, 2016 by Hades | No Comments »

As people were complaining about network interface names changing each time a new one was added, it was decided to call a network interface according to its physical location. The details of the naming convention are available in the RHEL 7 Networking Guide.

The old naming convention

To restore the old naming convention, you need to edit the /etc/default/grub file and add net.ifnames=0 biosdevname=0 at the end of the GRUB_CMDLINE_LINUX variable:

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"
Then, test the new configuration to see if no mistake has been made:

grub2-mkconfig
If everything is fine, update the grub2 configuration:

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

Update the network interface configuration file (here the initial interface name was em1 or enp2s0 and the new one is eth0):

# cd /etc/sysconfig/network-scripts
# cp ifcfg-em0 ifcfg-eth0

Edit the ifcfg-eth0 file and replace the network interface name in the NAME variable with “eth0“.

After a reboot, everything should be OK.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.