Ubuntu – Fixing Predictable Network Interface Names Not Showing Up

interfacenetworkingraspberryUbuntu

I seem to have the opposite problem of the internet. When you search for predictable network names not working all you find for the love of god is how to go back to wlan0, eth0 etc and disable it.
I do have the opposite problem. I have a freshly installed Ubuntu 22.04 server on Raspberry 4 and it will not use predictable net names. In fact I have heavy problems with interfaces wlan0 and wlan1 randomly switching their places.

There is nothing in /etc/systemd/network.

On /etc/default/grub.d/50-cloudimg-settings.cfg nothing suspicious like net.ifnames=0 is passed to the kernel command line.

Any advice on where to start digging, why this is not working?

Thanks

Best Answer

If you run raspi-config, select "Advanced Options", then "Network Interface Names", you will be prompted to enable predictable device names. This works by manipulating files in /etc/systemd/network to mask the corresponding units in /usr/lib/systemd/network. With predictable device names disabled, we see:

root@raspberrypi:~# ls -l /etc/systemd/network
total 0
lrwxrwxrwx 1 root root 9 Feb  5 15:12 73-usb-net-by-mac.link -> /dev/null
lrwxrwxrwx 1 root root 9 Feb  5 15:12 99-default.link -> /dev/null

Those symlinks to /dev/null mask the files with the same name in /usr/lib/systemd/network. When we enable predictable device names, those masking files are removed.


If you're familiar with predictable device names on other systems, you may be disappointed; on my Pi, with two wireless interfaces (the built-in interface and a USB interface), I get:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enxb827ebb3d5ba: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:27:eb:b3:d5:ba brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
    link/ether b8:27:eb:e6:80:ef brd ff:ff:ff:ff:ff:ff
4: wlx00e1b0679867: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:e1:b0:67:98:67 brd ff:ff:ff:ff:ff:ff

What that tells us is that the Pi simply doesn't provide the information that systemd generally uses to create predictable device names on other systems (bus, device id, etc). It might be sufficient for what you're doing: in the above output, the devices that were previously eth0 and wlan1 have been replaced with device names using the MAC address.