Score:0

Predictable network interface names not showing up

ne flag

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

guntbert avatar
ng flag
Please move the answering part of your question to a new answer.
Score:1
pt flag

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.

nEmai avatar
ne flag
Great advice, didn't know that these scripts were actually pulled from another place! See my edit on how I seemingly got it to work. Thanks!
Score:0
ne flag

..on request to put this to a separate answer:

Edit in response to larsks: I seem to have gotten it to work (for now, fingers crossed)!

#@#:~$ ll /etc/systemd/network
total 12
drwxr-xr-x 2 root root 4096 Feb  5 17:14 ./
drwxr-xr-x 5 root root 4096 Feb  5 14:10 ../
lrwxrwxrwx 1 root root    9 Feb  5 17:07 10-raspi-eth0.link -> /dev/null
lrwxrwxrwx 1 root root    9 Feb  5 17:08 73-usb-net-by-mac.link -> /dev/null
-rw-r--r-- 1 root root  498 Feb  5 17:14 99-default.link

I am now masking the 10- and 73- file out of /usr/lib/systemd/network. This alone changed the way my USB wifi NIC showed up, but didnt help with the internal wifi of the Pi still being wlan0 (and occasionally wlan1).

To solve the problem I copied over 99-default.link and changed it:

[Match]
OriginalName=*

[Link]
NamePolicy=mac kernel database onboard slot path
AlternativeNamesPolicy=database onboard slot path
MACAddressPolicy=persistent

The first entry for NamePolicy was "keep". I exchanged that for "mac". Gives me "nice" interface names for all interfaces now. I do hope they stay like this across reboots now.

#@#:~$ ip link show
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: enxdca632023082: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether dc:a6:32:02:30:82 brd ff:ff:ff:ff:ff:ff
3: wlxdca632023083: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether dc:a6:32:02:30:83 brd ff:ff:ff:ff:ff:ff
4: wlxe84e06fa2979: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether e8:4e:06:fa:29:79 brd ff:ff:ff:ff:ff:ff
    altname wlp1s0u1u4
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.