20140818 disable renaming of network interfaces - plembo/onemoretech GitHub Wiki

title: Disable renaming of network interfaces link: https://onemoretech.wordpress.com/2014/08/18/disable-renaming-of-network-interfaces/ author: phil2nc description: post_id: 8221 created: 2014/08/18 13:50:31 created_gmt: 2014/08/18 17:50:31 comment_status: closed post_name: disable-renaming-of-network-interfaces status: publish post_type: post

Disable renaming of network interfaces

I am convinced that Consistent Network Device Naming was always a bad idea. Here's the latest way to get rid of it. This is not going to be an editorial on how "Consistent Network Device Naming" is a badly conceived, poorly documented, horribly implemented idea that fails to deliver the consistency it promises. Others far more knowledgeable and eloquent than I have already made that case. This has been part of Fedora for a long time, first implemented using the udev-based biosdevname utility, and now replaced by a systemd udev policy. The idea originated with a Dell engineer who wanted to make supporting his company's server hardware easier by having network device names identify where they were located on the system bus. The way biosdevname and the later systemd policy do this is by changing the original logical name of the device assigned by the kernel to a new location based name. Embedded NICs should therefore be renamed "em1", "em2", etc. NICs in a PCI expansion slot would be p-something, like "p2p1" or "p4p1". Unfortunately this system doesn't always work. For example, on one of my servers with a late model non-HP motherboard the embedded NIC was renamed to "p4p1", not "em1" as one would expect. When that device failed I replaced it with an add-on PCIe NIC that was renamed... "p4p1". The procedure to disable Consistent Naming has changed several times over time, and the method required depends upon the systemd (or earlier udev) version in use on the machine. The official documentation, Predictable Network Interface Names, discusses these differences in prose that is certain not to win a Nobel for Literature. Of the four methods provided to disable device re-naming it appears that adding "net.ifnames=0" to the kernel command line is applicable to most recent versions of Linux. This procedure was tested on a fully updated Fedora 20 system. To add "net.ifnames=0" to the kernel command line in Fedora 20 you would modify /etc/default/grub to insert the parameter at the end of GRUB_CMDLINE_LINUX. Here is how it looks on my system:

GRUB_CMDLINE_LINUX="rd.md=0 rd.dm=0 vconsole.keymap=us $([ -x /usr/sbin/rhcrashkernel-param ]
/usr/sbin/rhcrashkernel-param ||:) rd.luks=0 vconsole.font=latarcyrheb-sun16
rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root net.ifnames=0 rhgb quiet"

(DO NOT copy and paste this text into your grub file! It is formatted for this screen and will cause problems if used to simply overwrite the text on another machine!) To effect this change you then need to recompile your grub configuation:

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

Many of us have switched from NetworkManager.service to the (Red Hat) traditional network.service to manage our network devices. This involves following the procedure outlined in this and other articles. If you have disabled NetworkManager you'll also have to modify the interface scripts under /etc/sysconfig/network-scripts to reflect the new device names. Start by renaming each script appropriately, for example:

mv ifcfg-p4p1 ifcfg-eth0

Then edit each script to substitute the old "consistent" device name for the original logical name:

perl -pi -e 's/p4p1/eth0/g' ifcfg-eth0

Finally, reboot.

Copyright 2004-2019 Phil Lembo