The problem with Linux's 'predictable network interface names'

March 29, 2018

I tweeted:

I find modern Linux auto-generated Ethernet device names to be a big pain, because they're such long jumbles. enp0s31f6? enp1s0f0? Please give me a break (and something short).

The fundamental problem with these 'predictable network interface names' is that they aren't. By that I mean that if you tell me that a system has, say, a motherboard 1G Ethernet port and a 10G-T Ethernet port on a PCIE card, I can't predict what those interfaces will be called unless I happen to have an exactly identical second machine that I can check. If I want to configure the machine's networking or ssh in to run a status check command on the 10G-T interface, I'm pretty much out of luck; I'm going to have to run ifconfig or some similar command to see what this machine has decided to call the interfaces.

(Yes, even for the motherboard network port, which may or may not show up as eno1 depending on the vagaries of life and your specific configuration. The enp0s31f6 from my tweet is such a port, and we have other machines where the motherboard port is, eg, enp7s0.)

The other problem with these names is that they're relatively long jumbles that are different from each other at various random positions (not just at the end). Names like this are hard to tell apart, hard to tell to people, and invite errors when you're working with them (because such errors won't stand out in the jumble). This might be tolerable if we were getting predictability in exchange for that jumble, but we aren't. If all we're going to get is stability, it would be nice to have names that are easier to deal with.

(We aren't even entirely getting stability, since PCI slot numbering isn't stable and that's what these names are based on.)

PS: There is a benefit to this naming scheme, which is that identical hardware will have identical names and you can freely transplant system disks (or system images) around between such hardware. If I have a fleet of truly identical machines (down to the PCIE cards being in the same physical slots), I know that enp1s0f0 on one machine is enp1s0f0 on every machine.

(Over the years, these device names have been implemented with somewhat different names by a number of different Linux components (eg). These days they come from udev, which is now developed as part of systemd in case you wish to throw the usual stones. I'm not sure if udev considers the specific naming scheme to be stable, considering the official documentation points you to the source code.)

Sidebar: What this scheme does give us

Given identical and unchanging hardware (and BIOS), we get names that are consistent from boot to boot, from machine to machine, and are 'stateless' in that they don't depend on the past history of the Linux install running on the machine (your five year old install that's been been moved between three machines sees the same names as a from-scratch install made yesterday).

Comments on this page:

From at 2018-03-29 02:53:11:

In practice the name format is not stable; e.g. the 3 last commits in udev-builtin-net_id.c rework the names for SR-IOV and some odd PCI layouts.

So on the one hand, that means nicer names in the next version... but on the other hand, it means different and not-very-predictable names.

I've long ago decided to boot all my systems with net.ifnames=0, and assign informative names based on MAC-based udev rules where necessary (e.g. wan0).

By Zev Weiss at 2018-03-29 07:25:44:

Hear hear. I recently set about removing a video card from a machine that shouldn't have had a discrete one to start with (and for which the driver was causing occasional stability problems) only to abort and put it back in when I found that doing so caused a change in the so-called "consistent" name of its ethernet device, and putting the stupid graphics card back where it was was faster and easier than rooting through and updating everything in /etc with the new name it suddenly had. Maddening.

[Accidentally typed this comment in on the wrong post earlier (PCINamesNotStable); feel free to delete that one (and this note) if you want.]

By Sam Hathaway at 2018-03-29 20:26:34:

I wonder if it'd be worthwhile to set up aliases for Ethernet devices and the like, to minimize the hassle of renaming when something does change. I've never bothered, but changing one udev alias or symlink sure seems easier than updating a half-dozen config files. Maybe I'll try to get in the habit...

Written on 29 March 2018.
« The correlation between Spamhaus Zen listings and attachment types (March 2018 edition)
Sometimes, not trying to reject some sort of spam is the right answer »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Mar 29 00:45:16 2018
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.