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

Mantas Mikulėnas grawity at gmail.com
Tue Mar 3 09:59:39 UTC 2020


On Mon, Mar 2, 2020, 16:59 Felix <systemd-devel at fj.hamme.net> wrote:

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

The Path= setting is documented to match against the ID_PATH udev property,
not against the list of sysfs paths. (For example udevadm shows
"pci-0000:01:00.0" on my machine.)


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

OriginalName matches the kernel-assigned name (udev property 'INTERFACE'),
which is always either eth# or wlan# or usb# or similar.

Names such as ens# or eno# are not original – the interfaces are renamed by
udev, and this actually happens *after* applying .link files (as the .link
files specify which naming policy to use in the first place.)



>
> After `systemctl restart systemd-networkd` or even rebooting the alias
> is still not set:
>


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

.link files are not applied by networkd – they're applied by udev.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200303/995ec82f/attachment.htm>


More information about the systemd-devel mailing list