[systemd-devel] "[Match]" section in systemd.link file doesn't match interface

Felix systemd-devel at fj.hamme.net
Mon Mar 2 14:51:15 UTC 2020


Hello everybody,

I'm failing to set an alias for a link using systemd-networkd. Am I
doing something wrong? Is this a bug?


I'm on this systemd version:
systemd 244 (244.3-1~bpo10+1)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS
+KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

This runs on a Debian Buster inside a virtual machine hosted on a
proxmox 6.1 server, if that matters.

I'm trying to set an alias for a link using systemd-networkd, following
this documentation:
https://www.freedesktop.org/software/systemd/man/systemd.link.html#Alias= .
I put my file in /etc/systemd/network/, as
-rw-r--r-- 1 root root  56 Mär  2 14:06 ens19.link
with this content:

```
[Match]
Path=/sys/class/net/ens19

[Link]
Alias=myalias
```

I also tried to replace `Path=/sys/class/net/ens19` with
`MACAddress=be:19:32:ed:c0:61` and `OriginalName=ens19`.


After `systemctl restart systemd-networkd` or even rebooting the alias
is still not set:
```
3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 1000
    link/ether be:19:32:ed:c0:61 brd ff:ff:ff:ff:ff:ff
```

I expected/want to see this:
```
3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 1000
    link/ether be:19:32:ed:c0:61 brd ff:ff:ff:ff:ff:ff
    alias myalias
```

`networkctl status ens19` doesn't show my .link file: `Link File:
/usr/lib/systemd/network/99-default.link`.

`udevadm test-builtin net_setup_link /sys/class/net/ens19` prints this:
```
Load module index
Parsed configuration file /etc/systemd/network/ens19.link
Parsed configuration file /usr/lib/systemd/network/99-default.link
Created link configuration context.
ID_NET_DRIVER=virtio_net
Config file /usr/lib/systemd/network/99-default.link applies to device ens19
link_config: autonegotiation is unset or enabled, the speed and duplex
are not writable.
Using default interface naming scheme 'v240'.
ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
Unload module index
Unloaded link configuration context.
```

How can I set the link alias using systemd-networkd?

Thanks,
Felix


More information about the systemd-devel mailing list