I have rocky 9 and would like to add a few permanent routes, using
/sbin/ip route add 10.84.14.0/24 via 188.8.131.52
It works but it doesn’t survive a reboot. Am I using the correct syntax to add permanent routes?
Thank you for your help.
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 184.108.40.206? Check with:
nmcli c s
If it is “XYZ”, then one can:
sudo nmcli con mod XYZ +ipv4.routes "10.84.14.0/24 220.127.116.11"
Thank you for pointing me to the right direction. I just tried
nmcli con mod enp0s31f6 +ipv4.routes “10.84.14.0/24 18.104.22.168”
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?
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