| Martin Jeppesen 2004-01-23, 4:50 pm |
| Hi,
I have a network with 2 providers, and I want to split the traffic up in
two.
My problem is that when I tcpdump like this:
tcpdump -n -i eth1 net 192.168.44.0/24
I fetch packages that are not suppose to the routed to eth1=(
Can anyone please debug my routing script???
#!/bin/sh
IF1=eth1
IP1=192.168.43.2
P1=192.168.43.1
P1_NET=192.168.43.0/24
T1=adsl43
IF2=eth2
IP2=192.168.44.2
P2=192.168.44.1
P2_NET=192.168.44.0/24
T2=adsl44
IF0=eth0
P0_NET=172.20.0.0/16
IP=/sbin/ip
###
# Makes routing tables for packages from and to adslrouter
###
$IP route add $P1_NET dev $IF1 src $IP1 proto static table $T1
$IP route add default via $P1 proto static table $T1
$IP route add $P2_NET dev $IF2 src $IP2 proto static table $T2
$IP route add default via $P2 proto static table $T2
$IP route del $P1_NET
$IP route add $P1_NET dev $IF1 src $IP1 proto static
$IP route del $P2_NET
$IP route add $P2_NET dev $IF2 src $IP2 proto static
$IP rule add from $IP1 table $T1
$IP rule add from $IP2 table $T2
$IP route add $P0_NET dev $IF0 table $T1
$IP route add $P2_NET dev $IF2 table $T1
$IP route add $P0_NET dev $IF0 table $T2
$IP route add $P1_NET dev $IF1 table $T2
###
# Default route, share the traffic to the 2 adsl lines:
###
# Delete the old default route:
$IP route del default
# and make the new:
$IP route add default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P2 dev $IF2 weight 1
#All traffic from mainserver to the Internet over adsl44 line:
$IP route add table mainserver $P1_NET dev $IF1
$IP route add table mainserver $P2_NET dev $IF2
$IP route add table mainserver default via $P2 dev $IF2
$IP rule add from 172.20.1.1 table mainserver
#Flush cache when there are changed rules:
$IP route flush cache
#Set the number of possible connections from 4096 to 16384:
/bin/echo 16384 > /proc/sys/net/ipv4/ip_conntrack_max
|