Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:

ip route add default via dev ens32 table EXAMPLE_TABLE
ip rule add from lookup EXAMPLE_TABLE prio 1000

either through nmcli (ideally) or through some other, similarly, sane way.

I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.

If you run ip route show table EXAMPLE_TABLE after a reboot you'll realize it doesn't stick - at least in my experience.

Any insights into this would be lovely, thank you.

  • My recollection is that every line in route-(device) will generate a ip route add (contents of line here) and every line in rule-(device) will generate a ip rule add (contents of line here), but it's possible that NetworkManager has different ideas. – Ulrich Schwarz Dec 7 '15 at 20:36
  • Sadly the route-(device) file seems to completely ignore the table parameter. :( – Canha Dec 7 '15 at 21:14

The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device> file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device> files in the same directory.

  • Unfortunately this doesn't work if you are using policy based routing... – Canha Dec 7 '15 at 22:33

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.