This may be slightly OT for this forum. If so, please nudge me with a
suggestion and I’ll move it.
Picking up on an old thread (see “Saving policy routes and rules” in
this group if interested in the earlier discussion), I’ve been working
toward the goal of having my policy routes and rules reloaded at system
restart under openSUSE 12.1.
Suggestions from other (read: non-SUSE-specific) sources seem to focus
on adding these “ip rule add” and “ip route add” statements to rc.local.
As we do not have an rc.local per se, it seemed that an appropriate
place to put them would be in /etc/init.d/after.local.
To keep things neat, I created a new script in
/etc/systeconfig/network/scripts, called policy-routes. Here is a snippet:
#! /bin/sh
#
ip rule del from all lookup main
ip rule del from all lookup default
ip rule add from all pref 32767 lookup default
ip rule add from all pref 32766 lookup main
ip rule add from 192.168.102.2/32 table table2
ip rule add to 192.168.102.2/32 table table2
ip rule add tos 0x10 table table2
ip route add 192.168.102.0/24 dev eth0 src 192.168.102.2 table table2
ip route add default via 192.168.102.201 table table2
(The deletions and fresh additions of the main and default lookup table
rules are only there in case an ip rule flush is performed and this
script needs to be run again. Normally, it should not be necessary to
delete the main and default lookup rules, but if they are subsequently
re-added without a preference, they will be assigned a priority of 0,
and rules with a 0 priority apparently do not get flushed with ip rule
flush.)
The script is executable and when run manually, does what it is supposed
to do.
I have added the following (the only line) to after.local:
test "$RUNLEVEL" = "5" && /etc/sysconfig/network/scripts/policy-routes
Yet I see no evidence that after.local is calling policy-routes. ip rule
show reveals no rules added. Running it as root from a terminal,
however, does exactly what it is supposed to do.
Likewise, removing the above test, and simply placing the contents of
policy-routes into after.local yields the same results (i.e., removing
the runlevel condition).
It is/was my understanding that after.local is called after every
runlevel change.
Thoughts? Better place for these rules?
TIA