Getting old network interface name back in RHEL/CentoS 7

Ever since the release of RHEL version 7, i have been most annoyed by the way the network interfaces have been named in OS. Earlier, the names for interfaces would be eth0 or eth1 for ethernet interfaces & wlan0 for wifi interfaces. But now we have names like enp1s0 or enp2sf0, which does not make sense at all and moreover you might find different names for same port in different machine, which only complicates the thing.
So, i have looked up a way to bring back old interfaces names on latest versions of RH EL/Centos, tested the method & now sharing the method with you guys in this short tutorial.
Word of caution, this method requires us to make changes to grub configuration file, so make sure you take a backup of the file before you decide to proceed further.

Step 1 – Edit the grub configuration file

Open the file grub file i.e. ‘/etc/default/grub’ ,
$ vi /etc/default/grub
& add net.ifnames=0 biosdevname=0 at the end of the GRUB_CMDLINE_LINUX line, so it looks like,
GRUB_CMDLINE_LINUX=”rd.lvm.lv=centos/swap vconsole.keymap=us crashkernel=auto rd.lvm.lv=centos/root vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0 biosdevname=0″
Save the file & exit.
 ——–

Step 2 -Testing & updating grub configurations

We will now make sure that the changes made are correct by running,
$ grub2-mkconfig
If we don’t get any errors, then we are good to move ahead & update the grub configurations by running,
$ grub2-mkconfig -o /boot/grub2/grub.cfg
After the grub update finishes, we can move to last step of the method.
 ———

Step 3 – Updating the network interfaces file

We will now only have to update the network interfaces configuration file names. To do that, goto
$ cd /etc/sysconfig/network-scripts
& change the files interfaces file names,
$ cp ifcfg-enp3s0 ifcfg-eth0
$ cp ifcfg-wlp2s0 ifcfg-wlan0

Now open the both the files i.e. eth0 & wlan0 & change the ‘NAME’ variable inside the files to reflect the correct names of the interfaces.
Next & last thing to do is to REBOOT the systems & your system will identify the network interfaces by the old naming convention used prior to RHEL/CentOS 7. Though i have not tested this tutorial for Ubuntu, but it should work on latest versions of Ubuntu as well. If you plan to test it out, do let us know.

If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Become a Supporter – Donate us some of you hard earned money:

Linux TechLab is thankful for your continued support.

Shusain

Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

You may also like...

Leave a Reply

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