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 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.