<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Thank you for your help! I've found my problem and it was way
    simpler than I thought.<br>
    <br>
    The systemd.link manpage mentions:<br>
    "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."<br>
    <br>
    My .link file wasn't considered because its file name came lexically
    after '99-default.link'.<br>
    <br>
    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.<br>
    <br>
    <br>
    On Tue, Mar 3, 2020, 10:59 Mantas Mikulėnas
    <a class="moz-txt-link-rfc2396E" href="mailto:grawity@gmail.com"><grawity@gmail.com></a> wrote:
    <blockquote type="cite"
cite="mid:CAPWNY8XAWLPOk+6aXNQNdkJbqE=-tiO_k5c41RZCcmwuDN0cRQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="auto">
          <div><br>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Mon, Mar 2, 2020,
                16:59 Felix <<a
                  href="mailto:systemd-devel@fj.hamme.net"
                  target="_blank" moz-do-not-send="true">systemd-devel@fj.hamme.net</a>>
                wrote:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello
                everybody,<br>
                <br>
                I'm failing to set an alias for a link using
                systemd-networkd. Am I<br>
                doing something wrong? Is this a bug?<br>
                <br>
                <br>
                I'm on this systemd version:<br>
                systemd 244 (244.3-1~bpo10+1)<br>
                +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT
                +UTMP<br>
                +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP
                +BLKID +ELFUTILS<br>
                +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid<br>
                <br>
                This runs on a Debian Buster inside a virtual machine
                hosted on a<br>
                proxmox 6.1 server, if that matters.<br>
                <br>
                I'm trying to set an alias for a link using
                systemd-networkd, following<br>
                this documentation:<br>
                <a
href="https://www.freedesktop.org/software/systemd/man/systemd.link.html#Alias="
                  rel="noreferrer noreferrer" target="_blank"
                  moz-do-not-send="true">https://www.freedesktop.org/software/systemd/man/systemd.link.html#Alias=</a>
                .<br>
                I put my file in /etc/systemd/network/, as<br>
                -rw-r--r-- 1 root root  56 Mär  2 14:06 ens19.link<br>
                with this content:<br>
                <br>
                ```<br>
                [Match]<br>
                Path=/sys/class/net/ens19<br>
              </blockquote>
              <div><br>
              </div>
              <div>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.)</div>
              <div> </div>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <br>
                [Link]<br>
                Alias=myalias<br>
                ```<br>
                <br>
                I also tried to replace `Path=/sys/class/net/ens19` with<br>
                `MACAddress=be:19:32:ed:c0:61` and `OriginalName=ens19`.<br>
              </blockquote>
            </div>
          </div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">OriginalName matches the kernel-assigned name
            (udev property 'INTERFACE'), which is always either eth# or
            wlan# or usb# or similar.</div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">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.)</div>
          <div dir="auto">
            <div class="gmail_quote">
              <div><br>
              </div>
              <div> </div>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <br>
                After `systemctl restart systemd-networkd` or even
                rebooting the alias<br>
                is still not set:<br>
              </blockquote>
              <div> </div>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                How can I set the link alias using systemd-networkd?<br>
              </blockquote>
              <div><br>
              </div>
              <div>
                <div>.link files are not applied by networkd – they're
                  applied by udev.</div>
              </div>
              <div><br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>