One of my long-standing pet projects – Consistent Network Device Naming, is finally coming to Fedora (emphasizing the 2 of the Fedora F’s: Features and First), and thereafter, all Linux distributions. What is this, you ask?
Systems running Linux have long had ethernet network devices named ethX. Your desktop likely has one ethernet port, named eth0. This works fine if you have only one network port, but what if, like on Dell PowerEdge servers, you have four ethernet ports? They are named eth0, eth1, eth2, eth3, corresponding to the labels on the back of the chassis, 1, 2, 3, 4, respectively. Sometimes. Aside from the obvious confusion of names starting at 0 verses starting at 1, other race conditions can happen such that each port may not get the same name on every boot, and they may get named in an arbitrary order. If you add in a network card to a PCI slot, it gets even worse, as the ports on the motherboard and the ports on the add-in card may have their names intermixed.
While several solutions have been proposed over time (detailed at Linux Plumbers Conference last year), none were deemed acceptable, until now.
Enter biosdevname, the tool Dell has developed to bring sanity (and consistency!) to network device names. Biosdevname is a udev helper, which renames network interfaces based on information presented by system BIOS.
The new naming convention is as follows:
- em[1-N] for on-board (embedded) NICs (# matches chassis labels)
- pci<slot>#<port> for cards in PCI slots, port 1..N
- NPAR & SR-IOV devices add a suffix of _<vf>, from 0..N depending on the number of Partitions or Virtual Functions exposed on each port.
- Other Linux conventions, such as .<vlan> and :<alias> suffixes remain unchanged and are still applicable.
This provides a sane mapping of Linux network interface name to externally visible network port (RJ-45 jack).
Where do we get this information? The algorithm is fairly simple:
- If system BIOS exposes the new PCI Firmware Specification 3.1 ACPI _DSM method, we get the interface label and index from ACPI, and use those.
- Else if system BIOS exposes an index and label in SMBIOS 2.6 types 9 and 41, use the index value.
- Else if system BIOS exposes index via the HP proprietary SMBIOS extension, use that.
- Else fall back to using the legacy PCI IRQ Routing Table to figure out which slots devices are in, sort the PCI device list in breadth-first order, and assign index values.
How will this affect you?
If you have scripts that have hard-coded eth0 or have assumptions that ethX is a particular port, your scripts are already broken (you may just not know it yet). Begin planning on using the new interface names going forward, adjusting your scripts as necessary.
Fedora 15 will be the first distribution to use biosdevname by default. There will be a Test Day on Thursday, January 27. I encourage you to download the Live image, boot it on your system, and verify that your network interfaces are now named according to the above convention, and that all works as expected. You may also take the opportunity to review your custom scripts, looking for hard-coded ethX values, and prepare for the coming name change.
Once we get sufficient exposure and verification using Fedora, I expect to see this change roll into other Linux distributions, and other operating systems, over time. Consider yourself warned.