RHEL7: How to restore the old network interface name.

Share this link

Presentation

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.

However, having a network interface called enp2s0 or enp4s2f0 doesn’t satisfy everybody.

Hopefully, a solution exists to restore the previous behavior.

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="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"

Then, test the new configuration to see if no mistake has been made:

# grub2-mkconfig

Note: When preparing this tutorial, I forgot the last quote in the GRUB_CMDLINE_LINUX variable.
I got the following error: /etc/default/grub: line 7: unexpected EOF while looking for matching `”‘.
This is only to remind you that testing can be useful!

If everything is fine, update the grub2 configuration:

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.9.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.9.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-eda26f60d4c948d09cd50d9086a87fcc
Found initrd image: /boot/initramfs-0-rescue-eda26f60d4c948d09cd50d9086a87fcc.img
done

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

# cd /etc/sysconfig/network-scripts
# cp ifcfg-enp2s0 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.

Source: Nerdy’s blog.

Additional Resources

In addition, you can read the reasons why the naming schema was changed for predictable network interface names, follow a discussion on the Red Hat customer portal about network device naming in RHEL 7 or read this tutorial about Changing Ethernet Device Names in EL7.

Caution: When upgrading to RHEL 7.3 and using very long network interface names (for example eno16780032), specific precautions need to be taken before any reboot (see here and here).

1 Star2 Stars3 Stars4 Stars5 Stars (15 votes, average: 4.47 out of 5)
Loading...

1
Leave a Reply

Please Login to comment
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
smstong Recent comment authors
  Subscribe  
newest oldest
Notify of
smstong
Member
smstong

Thank you for your detailed and complete information about consistent network interface naming.

Upcoming Events (Local Time)

  1. Feb
    1
    Fri

    1. 8:30 am - View Details
      CentOS: Dojo, Brussels, Belgium.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create two new user accounts "steve" and "oliver".
Create a group "team". Create a directory "shared".
All files put into the "shared" directory by "steve" or "oliver" should belong to the "team" group and be only visible by them.

RHCE7: Task of the day

Allowed time: 8 minutes.
Set up an iScsi target based on a fileio backstore of 100MB called /opt/shareddata with CHAP authentication (username=usr/password=pwd), xfs filesystem and standard firewall configuration.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...