Dualstack multiple IP addresses with systemd-networkd
I’m using systemd-networkd on Archlinux on one of my servers to configure the static IP addresses. While this seems pretty straight-forward, there’s a big issue that you can bump into when trying to configure multiple IP addresses. As this took me some time to figure out and it’s not well documented, I decided to leave a blog post for future me (and possibly others).
Apparently, the configuration described in the Archlinux wiki is not feasible when trying to configure multipe addresses. You need to use the alternative method using one [Network]
block. Using multiple Address=
lines in the [Address]
block is apparently not valid.
Unfortunately, systemctl restart systemd-networkd
doesn’t complain about an invalid configuration, but instead leaves you without any network config at all - Which then requires a rescue system to boot when you’re on a server without physical access.
So here’s the working configuration I ended up with:
# cat /etc/systemd/network/eno0.network
[Match]
Name=eno1
[Network]
DNS=2.x.x.x
DNS=2.x.x.x
Address=1.x.x.x/26
Address=2001:xxxx:xxxx::1/64
Address=2001:xxxx:xxxx::2/64
Gateway=1.x.x.x
Update: According to this post I wasn’t reading through man systemd.network
carefully enough. It’s also possible to just use multiple [Address]
sections with one IP each.