add multiple static ip addresses to a server with systemd-networkd

According to systemd.network(5), you can simply add multiple Address= lines to the [Network] section, with the required addresses.

[Network]
Address=10.2.3.4/16
Address=10.6.7.8/16
Gateway=...

Alternatively, create a separate [Address] section for each address.

[Network]
Gateway=...

[Address]
Address=10.2.3.4/16

[Address]
Address=10.6.7.8/16

(The same applies to [Route] sections and Gateway= parameters.)

Note that systemd-networkd is still very new and receives bug fixes almost daily. Make sure you're using the latest systemd release, and test the Git builds if possible. See the mailing list and the IRC channels #systemd & #gentoo-systemd on freenode in case of bugs.


I'm using a container under Proxmox, and Proxmox writes its own /etc/systemd/network/eth0.network in the container. To get around not being able to rely on that file not being overwritten, you can create a drop-in file with the additional IP address(es), /etc/systemd/network/eth0.network.d/additional-ips.conf

[Match]
Name = eth0

[Address]
Address = 192.168.1.102/24