right..
this didnt make it through as an attachment, so lets try in-line.
Below script sets up rules to look up ISP1 source-addr packets in
table isp1, etc..
then all you do is set a multi hop default route in your main table.
--paulj
#!/bin/bash
# this script sets up ip rules to handle our dual ISP setup (ie make
# sure packets /not/ going to internal - hence going to internet - are
# sent via appropriate ISP)
#isp_nets - describe isps in form:
# tablename,ip-range,realm,gateway
isp_nets="isp1,123.45.67.8/29,isp1-realm,123.45.67.9 \
isp2,1.2.3.4/28,isp2-range,1.2.3.5"
intranets="192.168.0.0/16 10.0.0.0/8 172.16.0.0/12"
intrarealm=mycompany
pref=21000
for prefix in $intranets; do
ip ru add to $prefix table main realm $intrarealm pref $pref ;
pref=$(($pref+100))
done
for net in $isp_nets ; do
table=`echo $net | sed 's/^\(.*\),.*,.*,.*$/\1/'`
prefix=`echo $net | sed 's/^.*,\(.*\),.*,.*$/\1/'`
realm=`echo $net | sed 's/^.*,.*,\(.*\),.*$/\1/'`
gw=`echo $net | sed 's/^.*,.*,.*,\(.*\)$/\1/'`
#echo "$net: prefix: $prefix realm: $realm table: $table gw: $gw"
ip ro add table $table default via $gw
ip ru add to $prefix table main realm $realm pref $pref
pref=$(($pref+100))
ip ru add from $prefix table $table realm $realm pref $pref
pref=$(($pref+100))
done
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!