Skip to contentSkip to conversation

Load Balancing Problems

LARTC Alan Romaniuc 3 participants 5 messages Jan 5, 2007 – Jan 10, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I have a router that got its second link. I was trying to do load balancing, but i can not get it to work properly.

Just one link works at time, and is always the second in the command ip route add default table 222 proto static.

Am I missing something? My script is below. I am using Debian, tried with kernel 2.6.19 (my compilation) or debian's one (2.6.18-3-486), same results

Thanks

====================================ip rule add prio 50 table main ip route del default table main

ip rule add prio $PRIO1 from $NET1 table $PRIO1
ip route add default via $IPGW1 dev $INTERFACE1 src $IP1 proto static table $PRIO1
ip route append prohibit default table $PRIO1 metric 1 proto static

ip rule add prio $PRIO2 from $NET2 table $PRIO2
ip route add default via $IPGW2 dev $INTERFACE2 src $IP2 proto static table $PRIO2
ip route append prohibit default table $PRIO2 metric 1 proto static

ip rule add prio 222 table 222
ip route add default table 222 proto static \
nexthop via $IPGW1 dev $INTERFACE1 weight $WE1 \
nexthop via $IPGW2 dev $INTERFACE2 weight $WE2
================================

Signature · 6 lines
Alan Romaniuc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
#1 lore raw

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:

Quoted 1 line
Quoted 1 line

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
Quoted 1 line
Quoted 1 line

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

Quoted 1 line
Quoted 1 line

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

Quoted 1 line
Quoted 1 line

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;

Signature · 18 lines
Alan Romaniuc
Phone : +55 11 5105-4955
Mobile : +55 11 8270-2520

[email protected]
 

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

 

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
#2 lore raw
In reply to Alan Romaniuc
Quoted 11 lines · Alan Romaniuc

Hi,

I have a router that got its second link. I was trying to do load balancing, but i can not get it to work properly.

Just one link works at time, and is always the second in the command ip route add default table 222 proto static.

Am I missing something? My script is below. I am using Debian, tried with kernel 2.6.19 (my compilation) or debian's one (2.6.18-3-486), same results

Try "your compilation" without CONFIG_IP_ROUTE_MULTIPATH_CACHED

there are several threads on this topic in the archive, one as reference:
http://archives.free.net.ph/message/20060618.150532.8a6cc07f.en.html

If it solves the problem, maybe is time to contact the author of Multipath Cached and send some report.

Signature · 5 lines
Luciano
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
#3 lore raw
In reply to Alan Romaniuc

Hi all,

After setting the CONFIG_IP_ROUTE_MULTIPATH_CACHED to no and apply patches from http://www.ssi.bg/~ja/#routes , everything is working fine. No more problems with the two uplinks and one route only.

Thanks for the help... I've been fighting with that for one week....

I will point this solution in another places too.

Thanks again,

Alan

Luciano Ruete escreveu:

Quoted 15 lines · Alan Romaniuc
Quoted 6 lines

Hi,

I have a router that got its second link. I was trying to do load balancing, but i can not get it to work properly.

Quoted 7 lines

Just one link works at time, and is always the second in the command ip route add default table 222 proto static.

Am I missing something? My script is below. I am using Debian, tried with kernel 2.6.19 (my compilation) or debian's one (2.6.18-3-486), same results

Quoted 8 lines

Try "your compilation" without CONFIG_IP_ROUTE_MULTIPATH_CACHED

there are several threads on this topic in the archive, one as reference:
http://archives.free.net.ph/message/20060618.150532.8a6cc07f.en.html

If it solves the problem, maybe is time to contact the author of Multipath Cached and send some report.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#4 lore raw
In reply to Alan Romaniuc

Hi ,

Are U test it for same remote site and same client ??

----- Original Message -----
From: "Alan Romaniuc" <[email protected]>
To: <[email protected]>
Sent: Wednesday, January 10, 2007 6:42 AM
Subject: Re: [LARTC] Load Balancing Problems

Quoted 53 lines

Hi all,

After setting the CONFIG_IP_ROUTE_MULTIPATH_CACHED to no and apply patches from http://www.ssi.bg/~ja/#routes , everything is working fine. No more problems with the two uplinks and one route only.

Thanks for the help... I've been fighting with that for one week....

I will point this solution in another places too.

Thanks again,

Alan

Luciano Ruete escreveu:

Quoted 15 lines · Alan Romaniuc
Quoted 6 lines

Hi,

I have a router that got its second link. I was trying to do load balancing, but i can not get it to work properly.

Quoted 7 lines

Just one link works at time, and is always the second in the command ip route add default table 222 proto static.

Am I missing something? My script is below. I am using Debian, tried with kernel 2.6.19 (my compilation) or debian's one (2.6.18-3-486), same results

Quoted 8 lines

Try "your compilation" without CONFIG_IP_ROUTE_MULTIPATH_CACHED

there are several threads on this topic in the archive, one as reference:
http://archives.free.net.ph/message/20060618.150532.8a6cc07f.en.html

If it solves the problem, maybe is time to contact the author of Multipath Cached and send some report.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. 
Signature · 8 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc