Consistent Network Device Naming

Submitted by Admin on

Traditionally Linux uses name ethX for the network interfaces. Unfortunately, the "X" is non-deterministic and the ethX names have no correlation to the chassis labels. Red Hat Enterprise Linux 6.1 introduces biosdevname, an optional convention for naming network interfaces. biosdevname assigns names to network interfaces based on their physical location. This BIOS-provided names, which are consistent and not arbitrarily named, eliminates the confusion that non-deterministic naming brings, and eliminates the use of hard-coded MAC address based port renaming which a) is racy and error-prone, and b) introduces state into an otherwise stateless system.

Ethernet ports now have a naming scheme corresponding to physical locations, rather than ethX. Ethernet ports embedded on server motherboards will be named em<port_number>, while ports on PCI cards will be named p<slot_number>p<port_number>, corresponding to the chassis labels. Additionally, if the network device is an SR-IOV Virtual Function or has Network Partitioning (NPAR) capability, the name will have a suffix of _<virtual_function> or _<partition>. We finally no longer have to guess at the ethX to physical port mapping, or invoke workarounds on each system to rename them into some "sane" order.

Biosdevname is developed by Dell and released under the GNU General Public License (GPL): http://linux.dell.com/biosdevname  All the Dell PowerEdge servers I have tried support biosdevname. In general, any systems that expose network port naming information in SMBIOS 2.6 or later (specifically field types 9 and 41) should work. Dell PowerEdge 10G and newer servers (PowerEdge 1950 III family, PowerEdge R710 family, and newer), and HP ProLiant G6 servers and newer are known to expose this information, as do some newer desktop models. Furthermore, most older systems expose some information in the PCI IRQ Routing Table, which will be consulted if information is not provided by SMBIOS.

If you are installing RHEL 6.1 or later on those supported system, biosdevname will automatically be used. You can disable that by appending biosdevname=0 to the grub boot command line. One thing I have noticed is if you are upgrading from 6.0, biosdevname will be disabled by default. I have one Dell PowerEdge R210 running Centos 6.0 using the old ethX convention. I tried to upgrade it to Centos 6.2 hoping to test the new naming conventions, but only to find out it still has the ethX. I have been playing around to convert existing old iface names to the new format, and finally get it working.

How To Convert / Migrate to Use Biodevname When Upgrading from CENTOS 6.0 to 6.2

First make sure you have the biosdevname package installed: yum install biosdevname

Remove the lines corresponding to your ethX in /etc/udev/rules.d/70-persistent-net.rules file. In my case, I have eth0 and eth1.

Find the new names corresponding to your ethX. Below commands tell me my eth0 is em1 and eth1 is em2.

/sbin/biosdevname -i eth0
em1
/sbin/biosdevname -i eth1
em2

Now go to /etc/sysconfig/network-scripts, and rename ifcfg-eth0 to ifcfg-em1 and ifcfg-eth1 to ifcfg-em2. Edit ifcfg-em1 and ifcfg-em2 to set the DEVICE to em1 and em2, instead of the old eth0 and eth1.

To make it easier for you, I am attaching a script here that does all above: biosdevname-upgrade.sh

Now that you are using the new names, you will need to update any of your custom scripts or service configuration files if you have hardcoded ethX. In my case, I had to modify the iptables rule to change eth0 and eth1 to em1 and em2.

Finally, reboot the system and once it comes up, we have the new NIC naming convention!