I am on RHEL7 with NetworkManager disabled and no additional legacy scripts installed.
Meaning, that I still use:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/route-eth0
/etc/sysconfig/network-scripts/rule-eth0
I have a problem with the rule-eth0
file. It loads nicely, and whenever I modify it and run $ systemctl restart networking
, the new routing rules are getting picked up and are visible with $ ip rule
. They also get picked up if I use the ifup-routes
.
However, if I modify the rule-eth0
file, the old rules that were there before dont get removed. New ones get added though. I've tried running scripts in the network-scripts
directory, they stay there unless I manually delete one after another.
I resorted to using:
$ ip rule flush
Which deleted all the rules, including the ones for the main
and default
table, meaning any SSH connection would get lost.
MY CONFUSION
If I delete all rule
files and reboot the machine, I get my default routes back. By running $ ip rules
is see:
0: from all lookup local
32766 from all lookup main
32767 from all lookup default
Question
How do I get the same behavior without a reboot?
How do I get these default rules back after running $ ip rule flush
, without rebooting the machine or specifying the rules manually one after another?