How to Change Interface Names Back to eth0, eth1 in CentOS 7

CentOS7 interface naming has changed from the older version, you usually see the interface as ensXX or enoXX. We usually change these interface name to use the older interface naming convention if we are handling a huge and a bit complex system like Openstack.#


1. Assuming you have a fresh installed CentOS7 x64. All we need to do is to disable the new interface naming rule. We do this by editing GRUB

[root@Controller3 ~]# nano /etc/default/grub

And add


So it should have something like:

[root@Controller3 ~]# cat /etc/default/grub
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 rhgb quiet"

2. Now we need to regenerate GRUB with this command:

[root@Controller3 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

3. Next is to create the old renaming rules. If it doesn’t exist its ok to create a new one

[root@Controller3 ~]# nano /etc/udev/rules.d/70-persistent-net.rules

Within this file add a line like this for each interface on your machine.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:06:be:8f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:06:be:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Always take note of the proper MAC Address

4. Go  to the folder that contains the interfaces config files, copy the ifcfg-ensXX files and make them a new name as ifcfg-ethXX. So..

[root@Controller3 ~]# cd /etc/sysconfig/network-scripts
[root@Controller3 network-scripts]# cp ifcfg-ens32 ifcfg-eth0
[root@Controller3 network-scripts]# cp ifcfg-ens33 ifcfg-eth1

5. Now lets change a few things in the newly named file to match our new config.

[root@Controller3 network-scripts]# nano ifcfg-eth0

6. You need to change the “NAME=ens32” and “DEVICE=ens32” field to appear as:


7. Reboot the server, once the server comes back up it will have the eth0 and eth1 instead of ensXX

Spread the love

Leave a Reply

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