predictable network interface names in systemd

Recent version of Ubuntu and Debian (stretch) bring a new network interface naming scheme.

Now, when updating from a system that's using old style names like "eth0", I'd like to know prior to booting what the new name will be.

How can I do this? Is there a magic invocation of "systemd" I can use to edit /etc/network/interface befor booting (and subsequently losing network connectivity)?


There's two different schemes available: biosdevname vs predictable network interface name.

biosdevname

Biosdevname seems to be the default in ubuntu. It is activated by installing the biosdevname package.

The biosdevname of an interface can be found with:

biosdevname -i eth0

Predictable network interface names

I believe this is the default in Debian stretch, but needs to be explicitly enabled on upgrade from previous releases.

The predictable name for eth0 can be found with:

udevadm test-builtin net_id /sys/class/net/eth0 | grep '^ID_NET_NAME_'

The new scheme is apparently called "predictable network interface names" but I'm not finding a lot of documentation on how to actually predict the name. Everything I've found about it basically points to this source code comment (which itself points back to the first link). From the comment, it's not clear at all how to know which addressing scheme udev is going to use for the network device name.

Per the first link, you can disable it and use the traditional names by adding net.ifnames=0 on the kernel command line in Grub. According to this comment it might be necessary if you plan on creating a VLAN tagged interface, since the added extension will make the interface name too long.

Otherwise, it might be better to re-ask the question to explain what you're trying to do with the name (eg configure the interface through ansible or something similar)


I'm not sure if this is still the case with updated versions, but on my old systems I was able to create an empty file at /etc/udev/rules.d/80-net-name-slot.rules and it would disable the "predictable" naming feature. You can also create your own rule and name the interfaces by yourself based on mac address or PCI/USB connections.