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 details).

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

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz

RHCSA7: Task of the day

Allowed time: 15 minutes.
Get an iso image of CentOS 7 (or a DVD) and set up a local repository.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria and create a table named people with two columns respectively name varchar(20) and age int(10) unsigned.

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 ...

Recent Comments