systemd-networkd & vlans

Updated

This might be obvious for everyone but me, but this surprised me a bit in the systemd-netdev manual:

If this option is not set, “vlan” devices inherit the MAC address of the physical interface. For other kind of netdevs, if this option is not set, then MAC address is generated based on the interface name and the machine-id(5).

OK, so that is why I never got a public IP using DHCP on a virtual interface on my lab machine. And all results when bing’ing it1 were basically old github issues that eventually forced me to read the manual.

After taking the five seconds required to read the above, I started to make up new MAC addresses for my virtual interfaces.

# filename.netdev
[NetDev]
Name=enp1s0.x
Kind=vlan
MACAddress=xx:xx:xx:xx:xx:xy

[VLAN]
Id=x

# filename.network
[Match]
Name=enp1s0.x

[Network]
DHCP=yes

This was an interesting quirk but for some reason I still like using systemd-networkd. I don’t know enough about networking to really understand why you’d want to default to the same MAC address, so it’s hard to be annoyed at anyone yet (without revealing my own ignorance).


  1. Haha, just kidding! ↩︎