Networking.interfaces.<name>.ipv4.routes not working?

I am trying to route traffic through a specific gateway. On the commandline I can add the specific route using this ip command:

ip r add 10.111.210.0/24 via 10.111.30.1

I am trying to replicate this using my system config:

networking.interfaces.ens18.ipv4.routes = [{
  address = "10.111.210.0";
  prefixLength = "24";
  via = "10.111.30.1";
}];

but that does not seem to do anything at all.
Am I misunderstanding what this option does?

1 Like

i have same problem

i was fix use ifconfig up after this route added and after reboot its works too

you can try this magic :slight_smile:

sudo ifconfig ens18 up

Iā€™m pretty sure it works if I reboot, too, but any way this can have an immediate effect?:wink: