5

I'm running Armbian Buster on an Odroid HC2. Actually, my interfaces names looks like that : enx001e0632c19d for eth0, and wlx503eaa4a712a for wlan0.

I would like to not use the predictive interfaces names to get eth0 and wlan0 instead.

So I created 2 files in /etc/systemd/network/ :

# ls -l /etc/systemd/network/
total 2
-rw-r--r-- 1 root root 54 Sep  2 00:32 10-eth.link
-rw-r--r-- 1 root root 55 Sep  2 00:32 10-wlan.link

Here is the content for eth0 :

# cat 10-eth.link
[Match]
MACAddress=00:1e:06:32:c1:9d
[Link]
Name=eth0

And for wlan0 :

# cat 10-wlan.link
[Match]
MACAddress=50:3e:aa:4a:71:2a
[Link]
Name=wlan0

Then, I saw on a topic (Why is my systemd link file being ignored?) that I had to do :

update-initramfs -u

Then I did a reboot.

But it's still not working...

[EDIT] The systemd-networkd service wasn't enabled. So I enabled it with the command :

systemctl enable systemd-networkd.service

Then I did a reboot. But it's still not working and the interfaces names are not changing to eth0 and wlan0.

Here is the output of systemctl status systemd-networkd.service :

# systemctl status systemd-networkd.service
* systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor
   Active: active (running) since Mon 2019-09-02 00:59:54 UTC; 7min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 297 (systemd-network)
   Status: "Processing requests..."
   Memory: 2.3M
   CGroup: /system.slice/systemd-networkd.service
           `-297 /lib/systemd/systemd-networkd

Sep 02 00:59:54 ohc2 systemd[1]: Starting Network Service...
Sep 02 00:59:54 ohc2 systemd-networkd[297]: Enumeration completed
Sep 02 00:59:54 ohc2 systemd[1]: Started Network Service.
Sep 02 00:59:56 ohc2 systemd-networkd[297]: wlan0: Interface name change detecte
Sep 02 00:59:59 ohc2 systemd-networkd[297]: enx001e0632c19d: Gained carrier
Sep 02 01:00:01 ohc2 systemd-networkd[297]: enx001e0632c19d: Gained IPv6LL

It says wlan0: Interface name change detecte but when I run ip addr, nothing changed :

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enx001e0632c19d: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1e:06:32:c1:9d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::9b38:fe20:a87c:287/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: wlx503eaa4a712a: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 50:3e:aa:4a:71:2a brd ff:ff:ff:ff:ff:ff

Can anyone help me ? Thanks

4
  • Is systemd-networkd enabled? Commented Sep 18, 2019 at 15:05
  • @炸鱼薯条德里克 Thanks for your answer ! The service wasn't enabled, so i did : systemctl enable systemd-networkd.service. Then I did a reboot. But it's still not working. I will edit my first question to give more information
    – amprxc
    Commented Sep 18, 2019 at 15:16
  • Why do you have them both named 10-xxx.link? Commented Sep 18, 2019 at 23:40
  • Yes I do. Is it a problem ?
    – amprxc
    Commented Sep 18, 2019 at 23:42

3 Answers 3

5

I'm having exactly the same problem for one interface. If it makes any difference it's a usb interface using asix driver.

Two of my interfaces get renamed using the .link files, this one doesn't. Another (identical) setup which is still using the udev renaming successfully renames all three interfaces.

Nov 23 22:12:16 xen17 vmunix: [ 7256.680568] asix 1-2:1.0 eth0: register 'asix' at usb-0000:00:14.0-2, ASIX AX88772 USB 
2.0 Ethernet, 00:0e:c6:b2:fb:30
Nov 23 22:12:16 xen17 vmunix: [ 7256.680691] usbcore: registered new interface driver asix
Nov 23 22:12:16 xen17 vmunix: [ 7256.684159] systemd-udevd[6406]: Using default interface naming scheme 'v240'.
Nov 23 22:12:16 xen17 vmunix: [ 7256.688004] systemd-udevd[6406]: link_config: autonegotiation is unset or enabled, the 
speed and duplex are not writable.
Nov 23 22:12:16 xen17 vmunix: [ 7256.688284] asix 1-2:1.0 enx000ec6b2fb30: renamed from eth0

But even ignoring the .link file it's getting the wrong name:

root@xen17:/var/log# udevadm test-builtin net_id /sys/class/net/enx000ec6b2fb30 2>/dev/null
ID_NET_NAMING_SCHEME=v240
ID_NET_NAME_MAC=enx000ec6b2fb30
ID_OUI_FROM_DATABASE=ASIX ELECTRONICS CORP.
ID_NET_NAME_PATH=enp0s20u2

Should be being called enp0s20u2 as PATH takes priority over MAC

And usbadm test says it should have the correct name from my .link file:

root@xen17:/var/log# udevadm test /sys/class/net/enx000ec6b2fb30 2>/dev/null
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/net/enx000ec6b2fb30
INTERFACE=enx000ec6b2fb30
IFINDEX=48
ACTION=add
SUBSYSTEM=net
ID_NET_NAMING_SCHEME=v240
ID_NET_NAME_MAC=enx000ec6b2fb30
ID_OUI_FROM_DATABASE=ASIX ELECTRONICS CORP.
ID_NET_NAME_PATH=enp0s20u2
ID_VENDOR=ASIX_Elec._Corp.
ID_VENDOR_ENC=ASIX\x20Elec.\x20Corp.
ID_VENDOR_ID=0b95
ID_MODEL=AX88772A
ID_MODEL_ENC=AX88772A
ID_MODEL_ID=7720
ID_REVISION=0001
ID_SERIAL=ASIX_Elec._Corp._AX88772A_000BAF
ID_SERIAL_SHORT=000BAF
ID_TYPE=generic
ID_BUS=usb
ID_USB_INTERFACES=:ffff00:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=asix
ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass
ID_VENDOR_FROM_DATABASE=ASIX Electronics Corp.
ID_MODEL_FROM_DATABASE=AX88772
ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
ID_NET_DRIVER=asix
ID_NET_LINK_FILE=/etc/systemd/network/10-persistent-net-usblan2.link
ID_NET_NAME=usblan2
USEC_INITIALIZED=7256957740
run: 'bridge-network-interface'
run: 'ifupdown-hotplug'

Fortunately, I'm using this device in a bridge interface so I can just tell it to import via all three names (two will obviously fail) so if something changes and this starts working in the future I won't be scratching my head trying to work out what has changed and why my networking is broken.

I've found my problem:

I'm using debian and there is:

/lib/udev/rules.d/73-usb-net-by-mac.rules

Which seems to take priority over the systemd rules. Commenting this entire file out and now the .link file is working.

So I'd suggest the OP looks for a similar udev rule somewhere that is beating the systemd naming.

I think I'd consider this a bug. I am only switching from udev rules because the documentation I've seen says that they're going away with the next stable release. But it appears that you cannot trivially switch if you're using usb network devices.

3
  • 1
    In Debian, /lib/udev/rules.d/73-usb-net-by-mac.rules checks for the existence of /etc/systemd/network/99-default.link and if it exists, it aborts. Therefore if you create your link file with this exact name, it works; whereas if you create it with any other name (as per most instructions) it fails. This avoids the requirement to comment out the contents of 73-usb-net-by-mac.rules. Commented Jun 14, 2020 at 19:55
  • @garethTheRed Even adding the 99-default.link file didn't work and I don't see any reference to that file in my 73-usb-net-by-mac.rules.
    – meelash
    Commented Jul 14, 2021 at 2:02
  • I see TEST!="/etc/udev/rules.d/80-net-setup-link.rules", \ TEST!="/etc/systemd/network/99-default.link", \
    – Tim
    Commented Jul 15, 2021 at 6:38
1

It's possible to change the interface names with udev: Edit /etc/udev/rules.d/70-persistent-net.rules:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:32:c1:9d", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:3e:aa:4a:71:2a", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="wlan0"

It works, and after a reboot, the interfaces names changed.

But my problem isn't resolved. I still don't know why it's not working with systemd-networkd.

2
  • Use systemd-networkd .link files or write udev rules, don't do both. Methods may not work as expected, but it doesn't mean your computer doesn't change at all. Commented Sep 18, 2019 at 23:42
  • Ok. But even if I remove the lines I added for udev, it's still not working for systemd-networkd
    – amprxc
    Commented Sep 18, 2019 at 23:44
0

I had a similar issue caused by the .link rules placed in /etc/systemd/network being superseded by default rules located in /lib/systemd/network which isn't supposed to be the cases according to the docs. Specifically, 99-default.link was superseding me so i called my file 98-something.link and it worked as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .