I have a problem setting up uplink load balancing, i followed lartc
instructions and set up this
P0_NET="10.10.1.0/24"
P1_NET="10.10.2.0/24"
P2_NET="10.10.3.0/24"
IF1=eth0
IF2=eth2
IF0=eth1
IP1="10.10.2.1"
IP2="10.10.3.1"
P1="10.10.2.2"
P2="10.10.3.2"
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
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
ip route add default via $P1
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 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
ip route add default scope global nexthop via $P1 dev $IF1 weight 1 nexthop
via $P2 dev $IF2 weight 1
10.10.2.2 and 10.10.3.2 are both NAT boxes. The problem is that, route set
in "ip route add default scope global nexthop via $P1 dev $IF1 weight 1
nexthop via $P2 dev $IF2 weight 1
" command as last will always be used. if i switch the order the other one
will be used.
this is my main rt:
~# ip route
10.10.2.0/24 dev eth0 proto kernel scope link src 10.10.2.1
10.10.3.0/24 dev eth2 proto kernel scope link src 10.10.3.1
10.10.1.0/24 dev eth1 proto kernel scope link src 10.10.1.21
default
nexthop via 10.10.2.2 dev eth0 weight 1
nexthop via 10.10.3.2 dev eth2 weight 1
if the active route goes down, no route will be used.
tHanks
|