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.