Load Balancing Problems

Linux Advanced Routing and Traffic Control

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

 




I am having with loadbalancing. I can get it working never....

I have this scenario:


INTRANET -------- (IP0, INTERFACE0) ROUTER (IP1,INTERFACE1) ---- NET1 --- (IPGW1) EXTRANET 1
                                           |
|----(IP2,INTERFACE2) ---- NET2 --- (IPGW2) EXTRANET 2

I have a Debian box with debian kernel, and I have a my kernel too, ith patches from Julian's route patch page.

Here is my scritp... copied from lartc
====
ip route add $NET1 dev $INTERFACE1 src $IP1 table $TABLE1
ip route add default via $IPGW1 table $TABLE1
ip route add $NET2 dev $INTERFACE2 src $IP2 table $TABLE2
ip route add default via $IPGW2 table $TABLE2

ip route add $NET1 dev $INTERFACE1 src $IP1
ip route add $NET2 dev $INTERFACE2 src $IP2

#ip route add default via $IPGW1

ip rule add from $IP1 table $TABLE1
ip rule add from $IP2 table $TABLE2

# MAGIC LINE !!!!!!!!!!!!!!!!!!!!!!!
ip route add default scope global \
       nexthop via $IPGW1 dev $INTERFACE1 weight $WE1 \
       nexthop via $IPGW2 dev $INTERFACE2 weight $WE2



ip route add $NET0 dev $INTERFACE0 table $TABLE1
ip route add $NET2 dev $INTERFACE2 table $TABLE1
ip route add 127.0.0.0/8 dev lo table $TABLE1

ip route add $NET0 dev $INTERFACE0 table $TABLE2
ip route add $NET1 dev $INTERFACE1 table $TABLE2
ip route add 127.0.0.0/8 dev lo table $TABLE2


#Extra rule for cable router
if [ "$ROUTER1" ]; then
ip route add $ROUTER1 dev $INTERFACE1 src $IP1
fi


======

with this script, I am getting always rooted using the second gateway from "MAGIC LINE", with am i doing a download (bittorrent for example) and redefine the routes (changing the first by the second) I can get a full download speedy (link1 + link2 bitrate) and both interface works normally. If I stop my torrent, flush the table, and start the download again, only the second link will work again, so load balancing never works...


here is some more debug information:
>>ip rule
0:      from all lookup 255
32764:  from 189.1.1.130 lookup uplink_e
32765:  from 201.1.1.88 lookup uplink_v
32766:  from all lookup main
32767:  from all lookup default

>>ip route
192.168.100.1 dev eth_virtua  scope link  src 201.6.156.88
189.1.1.128/26 dev eth_embratel  proto kernel  scope link  src 189.1.1.130
10.0.0.0/24 dev eth_wifi  proto kernel  scope link  src 10.0.0.1
192.168.1.0/24 dev eth_intra1  proto kernel  scope link  src 192.168.1.1
201.1.1.0/24 dev eth_virtua  proto kernel  scope link  src 201.1.1.88
default
       nexthop via 201.1.1.1  dev eth_virtua weight 1
       nexthop via 189.1.1.129  dev eth_embratel weight 1


>>Iptables (All ACCEPT)
$IPTABLES -t nat -A POSTROUTING -o $INTERFACE1 -j SNAT --to-source $IP1
$IPTABLES -t nat -A POSTROUTING -o $INTERFACE2 -j SNAT --to-source $IP2


>>rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
203     uplink_e
202     uplink_v



PS: Ip numbers are not real .... :/


Thanks in advance for any  help;


--
Alan Romaniuc
Phone : +55 11 5105-4955
Mobile : +55 11 8270-2520

alan.romaniuc@xxxxxxxxxxxxxxxxxx


INTELIGENSA DO BRASIL
Rua Quintana, 887, 5o. andar - Brooklin
04569-011 - São Paulo - SP - BRASIL
www.inteligensa.com.br



_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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