大网数据广告活动
服务器运维问答

Predictable network interface names not showing up

· 52CE 我爱测

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. …

问题原文

原帖链接 · nEmai · CC BY-SA 4.0

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

已采纳解答

原帖链接 · larsks · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-02-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。