Multipath load balance issues

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,
I've configured a mutlipath as detailed in the HOWTO.  
For the most part it's great, but when the cheap DSL line drops it's
connection, as it regularly does, the outbound routing doesn't
automatically use the remaining path for internal outbound traffic. 
Ip route show lists no default route once the default path dies, and if
the ppp connection is revived we still lack a default route.
I've tried adding connection specific up-down scripts to the ppp config,
but it hasn't worked. I need to run connection specific scripts as I
have other ppp's going up & down which aren't related.


The routing script starts  as follows...
#!/bin/sh
## ip route multi path configuration script
## Provider 1 (SWIFTEL)network
P1_NET="202.154.xxx.0/24"
## Provider 2(NTT) network
P2_NET="202.53.xxx.xxx/30"
## Provider 2 alias network
P2_ALIAS_NET="xxx.xxx.xxx.xxx/30"
## Interface for Provider 1
IF1="ppp0"
## Interface for Provider 2
IF2="eth1"
## Static IP Address of provider 1 connection
IP1="218.xxx.xxx.xxx"
## Static IP Address of provider 2 connection
IP2="202.xxx.xxx.xxx"
## Alias IP Address of provider 2 connection
SPIP1="203.xxx.xxx.xxx"

## Gateway address for provider 1
P1="202.154.xxx.xxx"
## Gateway address for provider 2
P2="202.53.xxx.xxx"
## Routing Table Config
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 $P2_ALIAS_NET dev $IF2 src $IP2 table T2

ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
ip route add $P2_ALIAS_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 rule add from $SPIP1 table T2
ip route add default scope global nexthop via $P1 dev $IF1 weight 1
nexthop via $P2 dev $IF2 weight 1
ip rule add fwmark 1 table mail.out
ip rule add fwmark 2 table ipsec.out
ip route add default via $IP1 dev $IF1 table mail.out
ip route add default via $IP2 dev $IF2 table ipsec.out


I then use iptables to mark & direct traffic out the interfaces in
preference to cost/speed. 

This works very well til the DSL line drops ($P1), at which time we
loose web browsing (as the default route is lost).

Any ideas how to use $IF2 path as fail-over automatically when $IF1
drops???

If I change the default route to the more reliable interface and direct
ports using routing tables out the cheapo one, I'm still stuck with loss
of service.

I was under the false impression that ...
ip route add default scope global nexthop via $P1 dev $IF1 weight 1
nexthop via $P2 dev $IF2 weight 1
... would provide some fault tolerance. 
If the default path (ip route add default via $P1) was too congested
eventually packets will go out against the default route via $P2?

Also, for iptables marked traffic directed though the routing tables
mail.out or ipsec.out, is it possible to acheive fault tolerance here
with something like....?
ip route add default nexthop via $P1 dev $IF1 weight 5 nexthop via $P2
dev $IF2 weight 1 table mail.out
(I know this doesn't work, but hopefully the idea is conveyed).
In which direction does the value of the weight attribute work?  I've
looked high and low but can't find any info on this.  
Does the increase in the weight from 1 to 5 make a packet more biased to
go the given path or less?  

Anyway,  after partially failing on the multipath front, the idea was to
simply rewrite the routing tables by using connection specific up/down
scripts via the pppd.
If I run the scripts manually all is well; but they don't get called in
a specific manner by ppp. I have linkname="swiftel" in the peers/
configuration file also named "swiftel" and  a sub folder named swiftel
in /etc/ppp/ip-down.d/ /etc/ppp/ip-up.d/.



When the DSL link fails, I have attempted fire the rerouting scripts off
from /etc/ppp/ip-down.d/ with...
if [ -n "$LINKNAME" ] ; then
        run-parts /etc/ppp/ip-down.d/$LINKNAME
        fi

        exit 0

This was intended to call the following script among others residing in
the /etc/ppp/ip-down.d/swiftel/ folder...
#!/bin/sh
## ip route multi path configuration script

*** All the unlisted but required variables....

## START WITH CLEAN ROUTING TABLE
route del default gw $P2 $IF2
route del default gw $P1 $IF2
ip route del $P1_NET dev $IF1 src $IP1 table T1
ip route del $P2_NET dev $IF2 src $IP2 table T2
ip rule del from $IP1 table T1
ip rule del from $IP2 table T2
ip rule del fwmark 1 table T1
ip rule del fwmark 2 table T2
ip rule del fwmark 1 table mail.out
ip rule del fwmark 2 table l2tp.out
ip route del default via $IP1 dev $IF1 table mail.out
ip route del default via $IP2 dev $IF2 table l2tp.out
ip route del default via $IP1 dev $IF1 table T1
ip route del default via $IP2 dev $IF2 table T2
ip route flush cache

ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2
ip route add $P2_ALIAS_NET dev $IF2 src $IP2 table T2

ip route add $P2_NET dev $IF2 src $IP2
ip route add $P2_NET dev $IF2 src $IP2
ip route add default via $P2

ip rule add from $IP2 table T2
ip rule add from $ALIASIPS2 table T2
ip route add default scope global nexthop via $P2 dev $IF2 weight 1
ip rule add fwmark 1 table mail.out
ip rule add fwmark 2 table ipsec.out
ip route add default via $IP2 dev $IF2 table ipsec.out
ip route add default via $IP2 dev $IF2 table mail.out


If anyone can offer some advice here I'd be most appreciative.

Thanks to all!

Lewis Shobbrook
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux