From: favero@grad.ufsc.br Date: Tue, 31 Aug 2004 17:28:24 +0000 Subject: [LARTC] Finally: A working case of two adsl load balance Message-Id: <1093973303.4134b53803850@webmail.grad.ufsc.br> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: lartc@vger.kernel.org First of all i wanna thanks Christoph Simon for the support.=20 Only after his reply to my email i could see the real solution to=20 the problem (Valeu mesmo cara... me ajudou pra caramba!=20 Fico te devendo essa!) :)=20 Here is what i learned in a month of research:=20 I tried A LOT of things to do load balance, including the one at=20 LARTC homepage. The only tutorial that REALLY works in my=20 case is the Christoph Simon at http://www.ssi.bg/~ja/nano.txt=20 Maybe LARTC can replace the erroneous tutorial at=20 http://lartc.org/howto/lartc.rpdb.multiple-links.html with the=20 nano.txt.=20 I will not write a tutorial, first of all cause my english is very=20 bad. Second because the nano.txt tutorial can do the trick. I=20 will just give some hints i used here.=20 First of all the load balance DOESN=B4T work without the Julian=20 Anastasov route patch. You can get it at:=20 http://www.ssi.bg/~ja/#routes So don=B4t be lazy, get the kernel=20 source code, aplly the patch and compile the kernel.=20 Pay attention to your nat configuration. In the first attempt I=20 had problems cause i forgot to mask the nated ips on the=20 postrouting table (this command is the last on my example=20 below).=20 I used the ip adress of the external interface, not the mask=20 for the external network (nano.txt tutorial gives the 2=20 options...)=20 Be sure that you don=B4t have a default route on your main=20 table. If u have any, delete it!=20 I have a linux box with:=20 - Kernel 2.6.3 with Julian Anastasov patch to kernel 2.6.0- 2.6.3 http://www.ssi.bg/~ja/routes-2.6.0-test11-10.diff=20 - iproute2-ss010824=20 - 4 ethernet cards:=20 eth0 - internal lan ip range 192.168.1.x=20 eth1 - internal lan ip range 192.168.2.x=20 eth2 (ppp0) - external adsl with 600 Kb/sec down and 300=20 Kb/sec up=20 eth3 (ppp1) - external adsl with 600 Kb/sec down and 300=20 Kb/sec up=20 I have nat and my 2 lan access the internet using the linux=20 box as gateway.=20 I run 2 rp-pppoe daemon, one for each adsl connection.=20 ppp0 ip: 200.101.233.120=20 ppp0 gateway: 200.138.225.254=20 ppp1 ip: 201.3.219.70=20 ppp1 gateway: 201.3.196.254=20 Here is the commands i use:=20 #table main with priority 50, the highest one=20 ip rule add prio 50 table main #table 201=20 ip rule add prio 201 from 201.3.219.70 table 201 ip route add default via 201.3.196.254 dev ppp1 src=20 201.3.219.70 proto static table 201 ip route append prohibit default table 201 metric 1 proto static #table 202=20 ip rule add prio 202 from 200.101.233.120 table 202 ip route add default via 200.138.225.254 dev ppp0 src=20 200.101.233.120 proto static table 202 ip route append prohibit default table 202 metric 1 proto static #table 222=20 ip rule add prio 222 table 222 ip route add default table 222 proto static nexthop via=20 201.3.196.254 dev ppp1 nexthop via 200.138.225.254 dev=20 ppp0 #essential masquerade option=20 iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j=20 MASQUERADE=20 iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j=20 MASQUERADE=20 Here is the route output:=20 [root@localhost root]# route Tabela de Roteamento IP do Kernel Destino Roteador M=E1scaraGen. Op=E7=F5es M=E9trica Ref Uso Iface 200.138.225.254 * 255.255.255.255 UH 0 0 0 ppp0 201.3.196.254 * 255.255.255.255 UH 0 0 0 ppp1 192.168.2.0 * 255.255.255.0 U 0 0 0 eth1 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo Here is the ip route list output for the 4 tables (main, 201,=20 202, 222):=20 [root@localhost root]# ip route list table main 200.138.225.254 dev ppp0 proto kernel scope link src=20 200.101.233.120 201.3.196.254 dev ppp1 proto kernel scope link src=20 201.3.219.70 192.168.2.0/24 dev eth1 scope link 192.168.1.0/24 dev eth0 scope link 127.0.0.0/8 dev lo scope link [root@localhost root]# ip route list table 201 default via 201.3.196.254 dev ppp1 proto static src=20 201.3.219.70 prohibit default proto static metric 1 [root@localhost root]# ip route list table 202 default via 200.138.225.254 dev ppp0 proto static src=20 200.101.233.120 prohibit default proto static metric 1 [root@localhost root]# ip route list table 222 default proto static nexthop via 200.138.225.254 dev ppp0 weight 1 nexthop via 201.3.196.254 dev ppp1 weight 1 And that=B4s all! I have a working and very well balanced=20 system. I=B4m getting combined download speed of 120 Kb/sec=20 running multiple simultaneous downloads (p2p, html, ftp, etc),=20 40 kb/sec simultaneous upload speed. I can play online=20 games without problems. MSN/ICQ remains connected all the=20 time using the same ip address. No packet loss problems.The=20 two 600/300 lines really looks very similar to a 1200/600 line.=20 It=B4s really wonderful.=20 I hope this can help someone. The load balance isn=B4t so hard=20 to do when you know which commands you really need. I did=20 it, why can=B4t you do it too? :)=20 Fernando Favero=20 favero@grad.ufsc.br _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/