hi, i keep on fighting with balancing my two internet conections.. ive improved a routing like this: root@debian:/wk/ESTADISTICAS/Trafico_en_kisero_hq# ip route list 172.0.0.0/24 dev eth0 proto kernel scope link src 172.0.0.82 172.0.0.0/24 dev eth1 proto kernel scope link src 172.0.0.81 default nexthop via 172.0.0.1 dev eth0 weight 1 nexthop via 172.0.0.1 dev eth1 weight 1 root@debian:/wk/ESTADISTICAS/Trafico_en_kisero_hq# (the 172.0.0.1 is my gateway) i made a simple script to generate traffic to many diferent ip address..while i graph the traffic from the ethX.. the result was that the %78 of traffic goes to eth0 and the rest from eth1..!!!. any idea? i still dont understand based on what dsecicion the kernel routes one paquet to eth0 or eth1...any idea? well, thanks in advance.. this is geting really interesting :) _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
On 4 Nov 2002, Esteban Ribicic wrote:> root@debian:/wk/ESTADISTICAS/Trafico_en_kisero_hq# ip route list > 172.0.0.0/24 dev eth0 proto kernel scope link src 172.0.0.82 > 172.0.0.0/24 dev eth1 proto kernel scope link src 172.0.0.81 > default > nexthop via 172.0.0.1 dev eth0 weight 1 > nexthop via 172.0.0.1 dev eth1 weight 1 > root@debian:/wk/ESTADISTICAS/Trafico_en_kisero_hq# > > the result was that the %78 of traffic goes to eth0 and the rest from > eth1..!!!. > > any idea? i still dont understand based on what dsecicion the kernel > routes one paquet to eth0 or eth1...any idea?Kernel get [randomly] one of "nexthop" gateway to achieve required IP addres and make routing entry in own route cache. Next request to the same IP will be routed due to previous cache entry [until entry expires]. Than if all Your clients wants connect to considered IP all get the same gateway [and interface]. It''s also important to know that its not packet-by-packet load balancing but "entry-by-entry" balancing - thats why traffic isnt always distributed fair but looks balanced when considered during large number of sessions. To check if it works coorect You can count cache entries for your both interfaces ie. ip r l ta cache |grep eth0 |wc -l and ip r l ta cache |grep eth1 |wc -l and than You should see that numbers are close to each other. There is also "equalize" option which do packet-by-packet balancing but to do it working You need special setup and cooperation with Your gateway AFAIK. [If You have the same gateway on both interfaces maybe its possible to prepare network config to work with equalize option] I am not shure what I wrote is 100% true but I believe that it works in such a manner. Regrds tw -- ---------------- ck.eter.tym.pl "Never let shooling disturb Your education" _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
On 5 Nov 2002, Esteban Ribicic wrote:> i see what you are seing. in fact, the cache stuff in kernel > make things dificult.I though about using some iptables stuff like "nth" or "random" modules also with "connmark" and/or "conntrack [extra addon]" to do balancing but need some more reading to prepare setup. However You can also try change factors for nexthop gateways to manual tuning or make more complex setup using marking packets and using separate muliple gateway setup for each trafic. Forks fine for me.> i''ll have to look some way to make things better > (perl script cleaning cache?!)..cache expires in some time [but how much is some ?] ...instead perl maybe try "ip r[oute] f[lush] ta[ble] cache" ;)> i also thought making two routes with mask''s to odd/even networks..that > would be some kind of balance..Worth to try and check results. Regards tw -- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/