Score:0

Networkctl: Manual VLAN IP Link

in flag

I've a network interface eth0 that carries my main network as untagged traffic and a "management" network with tagged traffic with the id 18. This is how it's configured:

10-eth0.network:

[Match]
Name=eth0

[Link]
RequiredForOnline=yes

[Network]
DHCP=v4
VLAN=vlan18

vlan18.netdev:

[NetDev]
Name=vlan18
Kind=vlan

[VLAN]
Id=18

vlan18.network:

[Match]
Name=vlan18

[Network]
Address=10.10.1.1/24

On boot the server will start eth0 get an IP via DHCP and also create vlan18@eth0 for the "management" network with the static IP 10.10.1.1 and it all works.

How can I tell networkctl to create the vlan18@eth0 interface but without bringing it UP on boot? The idea is to have a bunch of scripts that will do ip link set vlan18 up / ip link set vlan18 down to access to that network when required.

Thank you.

Score:0
in flag

The solution to this, according to the documentation, is to add ActivationPolicy=manual to the Link section of the network definition:

ActivationPolicy=

Specifies the policy for systemd-networkd managing the link administrative > state. Specifically, this controls how systemd-networkd changes the network device's "IFF_UP" flag, which is sometimes controlled by system administrators by running e.g., ip link set dev eth0 up or ip link set dev eth0 down, and can also be changed with networkctl up eth0 or networkctl down eth0.

Takes one of "up", "always-up", "manual", "always-down", "down", or >"bound". When "manual", systemd-networkd will not change the link's admin state >automatically; the system administrator must bring the interface up or down >manually, as desired.

Source: https://www.freedesktop.org/software/systemd/man/systemd.network.html#ActivationPolicy=

vlan18.network:

[Match]
Name=vlan18

[Network]
Address=10.10.1.1/24

[Link]
ActivationPolicy=manual

Unfortunately as reported here (github/systemd) and here (superuser) there seems to be a bug in systemd that makes it ignore ActivationPolicy in VLANs. The config applies to regular network interfaces with no problem.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.