I have a file /etc/rc.d/routes.rc that I use to put them. An example would look like:
-----------------------------
#!/bin/bash
#
# Route entries for the local site
ROUTE=/sbin/route
IP=/sbin/ip
if [ -e /etc/sysconfig/route-addr ]
then
. /etc/sysconfig/route-addr
else
echo "Could not load routing addresses"
exit 0
fi
$IP rule add from $NETWORKADDR1 table $NETTABLE
$IP route add $NETWORKADDR2 via $GATEADDR dev $IPSECDEV table $NETTABLE
$IP route add default via $GATEADDR dev $ETHDEV table $NETTABLE
echo "Passed addition of routes"
exit 0
------------------------------
And you'll need to add a file called /etc/sysconfig/route-addr which looks like
-------------------------------
NETWORKADDR1=192.168.0.0/24
NETWORKADDR2=192.168.1.0/24
GATEADDR=3.25.236.29
NETTABLE=Ops
IPSECDEV=ipsec0
ETHDEV=eth2
--------------------------------
Note: I haven't actually put this particular script to a test, as my script uses an array, and the route command. This should work though. Just make sure you debug any problems. Also, the routes.rc file needs to be chmod 0755. Also, add it to your init scipt process somewhere. The way to do this under sysV init is to make links in rc{0,1,2,3,4,5,6}.d to either S99routes.rc or K99routes.rc
It will ignore whatever arguments are passed in, but you can fiddle with that more if you really want to.
Aaron
|