Fedora 29 not persisting source route rules

Hello,

I have setup files to add source policy routing in /etc/sysconfig/network-scripts/rule-ens1f0np0 and /etc/sysconfig/network-scripts/route-ens1f0np0 but they are not read or honored after the machine is rebooted.

/etc/sysconfig/network-scripts/rule-ens1f0np0:
from xx.xx.xx.xx lookup source-ens1f0np0 priority 200

/etc/sysconfig/network-scripts/route-ens1f0np0:
default via ty.yy.yy.yy dev ens1f0np0 table source-ens1f0np0

Also /etc/iproute2/rt_tables has:
200 source-ens1f0np0

If I add the rule and the route using up it works but they disappear if the machine gets restarted. This mechanism works on RedHat 7.

Any suggestions will be greatly appreciated.

Thanks.

SO it seems than a way to solve this is to use a script similar to the old ifup-routes (which is part now if the deprecated network-scripts package https://github.com/fedora-sysv/initscripts/blob/master/network-scripts/ifup-routes) and make it a dispatcher script on /etc/NetworkManager/dispatcher.d directory.

Looks like this is the best way unless someone else can point something different.

The old script works with minimal modifications, I’ll post if anybody else is interested.

2 Likes