Here is the script:
-----------------
#!/bin/sh
#
# This script will be executed *after* all the other init scripts in
/etc/rc.d.
# we are going to create Routing for multiple uplinks/providers.
#### current subnets are fiction, for Ex. use only ####
# IP1_NET is 203.100.1.24/28
# IP2_NET is 203.100.2.36/30
#start
#-----
ip route flush cache
# name of the private interface
IF0="eth1"
# name of the first public interface
IF1="eth0"
# name of the second public interface
IF2="eth2"
#IP address associated with IF1
IP1="203.100.1.26"
#IP address associated with IF2
IP2="203.100.2.38"
#Local network
P0_NET="192.168.1.0"
#IP address of the gateway at Provider 1
P1="203.100.1.25"
#IP address of the gateway at Provider 2
P2="203.100.2.37"
#the IP network P1 is in
IP1_NET="203.100.1.24"
#the IP network P1 is in
IP2_NET="203.100.2.36"
#One creates two additional routing tables, say T1 and T2.
#These are added in /etc/iproute2/rt_tables.
#Then you set up routing in these tables as follows:
ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2
#set up the main routing table
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
#your preference for default route:
ip route add default via $P1
#set up the routing rules
ip rule add from $IP1 table T1
ip rule add from $IP2 table T2
#This set of commands makes sure all answers to traffic
#coming in on a particular interface
#get answered from that interface.
ip route add $P0_NET dev $IF0 table T1
ip route add $P2_NET dev $IF2 table T1
ip route add 127.0.0.0/8 dev lo table T1
ip route add $P0_NET dev $IF0 table T2
ip route add $P1_NET dev $IF1 table T2
ip route add 127.0.0.0/8 dev lo table T2
#..........end
I also added these lines in /etc/iproute2/rt_tables
= = = = = = = = =
201 T1
202 T2
0: from all lookup local
32760: from 192.168.1.1 lookup T1
32761: from all lookup main
32762: from all lookup default
32763: from 192.168.1.1 lookup T2
= = = = = = = = = = = = = = =
When I run this script, I lose all access to the server from outside( can't
ping or telnet etc..).
I'm not sure if all the statements in the scrip are correct, I just searched
for iproute2 howto and this is what I could make out of the articles I was
reading.
The source I sniped from is this:
http://www.lartc.org/howto/lartc.rpd...ple-links.html
I only hope someone out there done this and can put me on the right track.
Thanks.
Vania
"Michael Heiming" <michael+(E-Mail Removed)> wrote in message
news:j9n8h2-(E-Mail Removed)...
> In comp.os.linux.networking Vania Lolham
<(E-Mail Removed)>:
>
> [ problems with two simultaneous ADSL connections ]
> Best idea you show us the exact error message (cut&paste) and the
> script, or part where it happens if it's huge.
>
> --
> Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
> mail: echo (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
> #bofh excuse 316: Elves on strike. (Why do they call EMAG
> Elf Magic)