2

I want to add aliases to my network links to use them as short descriptions. I am configuring my interfaces using systemd-networkd, having systemd version 241 on a debian buster server.

I've created the file -rw-r--r-- 1 root root 68 Feb 9 12:53 /etc/systemd/network/ens19.link with the content:

[MATCH] MACAddress=7a:08:e8:12:fc:c7 [LINK] Alias=myalias 

I've tried to reboot the system, but the alias does not appear:

3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 7a:08:e8:12:fc:c7 brd ff:ff:ff:ff:ff:ff 

Doing ip l set ens19 alias myalias gives the intended result:

3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 7a:08:e8:12:fc:c7 brd ff:ff:ff:ff:ff:ff alias myalias 

How can I achieve that using systemd-networkd?

2 Answers 2

4

I should have read the manual more carefully.

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.

Renaming /etc/systemd/network/ens19.link to /etc/systemd/network/00-ens19.link helped.

[MATCH] should be [Match] and [LINK] should be [Link].

To apply a changed .link file to the link I can reboot or run

udevadm test-builtin net_setup_link /sys/class/net/ens19 

(Because .link files are processed by udev and not systemd-networkd, restarting systemd-networkd is insufficient.)

0

As per systemd.network link aliases are not (yet?) supported.

1
  • The link alias configuration is mentioned in systemd.link... Commented Feb 19, 2020 at 23:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.