Hello
I have rocky 9 and would like to add a few permanent routes, using
/sbin/ip route add 10.84.14.0/24 via 192.64.30.250
It works but it doesn’t survive a reboot. Am I using the correct syntax to add permanent routes?
Thank you for your help.
No.
The network connections are managed by NetworkManager (NM).
You have to tell the NM about the static route; NM will store it in its config.
What is the name of the connection that knows about 192.64.30.250? Check with:
ip ro
nmcli c s
If it is “XYZ”, then one can:
sudo nmcli con mod XYZ +ipv4.routes "10.84.14.0/24 192.64.30.250"
Hello,
Thank you for pointing me to the right direction. I just tried
nmcli con mod enp0s31f6 +ipv4.routes “10.84.14.0/24 192.64.30.250”
No errors are returned, which would make you think that the route has been added, however when I check if it is there, with ip r, I do not see it.
I don’t need to reboot, do I?
Thank you
I’d reload the connection:
sudo nmcli con down enp0s31f6
sudo nmcli con up enp0s31f6
or – if that does not do it – restart NM:
sudo systemctl restart NetworkManager