Re: "[Match]" section in systemd.link file doesn't match interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for your help! I've found my problem and it was way simpler than I thought.

The systemd.link manpage mentions:
"The first (in lexical order) of the link files that matches a given device is applied. Note that a default file 99-default.link is shipped by the system. Any user-supplied .link should hence have a lexically earlier name to be considered at all."

My .link file wasn't considered because its file name came lexically after '99-default.link'.

I'm now happily using the mac address for matching. I use `udevadm test-builtin net_setup_link /sys/class/net/ens19` for applying a changed .link file to my link.


On Tue, Mar 3, 2020, 10:59 Mantas Mikulėnas <grawity@xxxxxxxxx> wrote:


On Mon, Mar 2, 2020, 16:59 Felix <systemd-devel@xxxxxxxxxxxx> 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.


_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux