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:
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:
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.This documentation might help a little bit. See the section under "What precisely has changed in v197?". Yes, I realize this is of somewhat limited value, but it might give you an avenue for further research.
We're using the following "one-liner" in our company to map existing interfaces to their respective predictable name:
It implements the ordering described on https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ can be quickly copy-pasted via SSH.
Example output from my machine: