How to rename the network interface in CentOS/RHEL7

I think everyone noticed that in Linux 7 network interface name has been changed from eth[0,1..] to ens. But in some organization they what to use eth as a standard network interface name. In this article we will explain how to can change the network interface name.

network interface

See Also:

Grub Configuration:

First we need to edit grub configuration file to append some parameters.

# vim /etc/default/grub

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

net.ifnames=0 biosdevname=0

For Eq:

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"

Rebuilt Grub Configuration:

After implementing the changes in grub configuration file we need to rebuilt the grub configuration file so the changes will reflect.

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

Network Configuration:

Copy or move the network configuration file from ens to eth and change the Device and Name parameter in network file.

# mv /etc/sysconfig/network-scripts/ifcfg-ens /etc/sysconfig/network-scripts/ifcfg-eth0 
# vim /etc/sysconfig/network-scripts/ifcfg-eth0

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

NAME= 
DEVICE=

After completing all the above steps reboot the server to reflect the changes.

# reboot

Enjoy it!

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.