Change multiple interface IP’s with networkd on coreos

spacewalk92 asked:

I have a working CoreOS machine where I need to change two virtual network interface IP’s in the /etc/systemd/network file like this:

[Match]
Name=interface name

[Network]
Address=ip address.

This works great for one interface, but when I add a second interface, which needs a different IP address, like this:

[Match]
Name=interface name

[Network]
Address=ip address.

[Match]
Name=interface name2

[Network]
Address=ip address2.

This doesn’t work.
I can’t find an example where two interface IP’s are changed anywhere online.

Any help is very much appreciated. Thanks!

My answer:


You put them in different files, named after their interface. For example, for interfaces named enp4s0f0, enp4s0f1, enp4s0f2, and enp4s0f3 you would create files for each of them:

/etc/systemd/network/enp4s0f0.network
/etc/systemd/network/enp4s0f1.network
/etc/systemd/network/enp4s0f2.network
/etc/systemd/network/enp4s0f3.network

Technically the files can be named anything ending with .network, but unless you want a configuration that configures multiple interfaces with a Match (e.g. to set up DHCP on every interface) then naming the files after their corresponding interfaces eliminates confusion.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.