0

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!

1 Answers1

0

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972