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

2020-03-03 Thread Felix
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  wrote:
>
>
> On Mon, Mar 2, 2020, 16:59 Felix  > 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-: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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-03-03 Thread Mantas Mikulėnas
On Mon, Mar 2, 2020, 16:59 Felix  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-: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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-03-02 Thread Felix
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:  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:  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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel