aMule Forum
English => Offtopic Section (Nonsense inside) => Small talk => Topic started by: lfroen on June 15, 2005, 01:24:42 PM
-
Connection Type: 2 adsl connections 600 down / 300 up each
Have too match money pay to your ISP ? Unless you have each service dedicated to specific line (like ftp on eth0 and http+amule on eth1), you can't really use it.
Being precize - you can use it, if your provider is stupid enough to turn off rpf check on incoming packets.
-
Originally posted by lfroen
Connection Type: 2 adsl connections 600 down / 300 up each
Have too match money pay to your ISP ? Unless you have each service dedicated to specific line (like ftp on eth0 and http+amule on eth1), you can't really use it.
Being precize - you can use it, if your provider is stupid enough to turn off rpf check on incoming packets.
I share my internet connection with my friends. We are 7 peoples using this two connections, so it become cheap for us. We run only one aMule on the server, and we all use VNC to control it.
Its possible to do load balance between 2 or more connections to the internet. http://www.ssi.bg/~ja/nano.txt is a good guide and works here (and for many people i talk on mail list). The traffic is balanced by ip (each ip is assigned to one of the two connections). So if 202.20.20.22 use ppp0 to send me a packet, i send a packet to 202.20.20.22 using ppp0. If 202.50.50.55 send me a packet on ppp1, i use ppp1 to send a packet to 202.50.50.55, and so on. So, the traffic isnt messed up by the 2 adsls. I cant get one tcp connection to go through the 2 adsls lines, but when i have multiple simultaneous downloads/uploads (using amule, bittorrent and with 7 guys browsing internet) the traffic is evenly balanced between the two connections.
Here is a screenshot from the statistics page of my server:
http://i2.photobucket.com/albums/y46/punksc/2adsls.jpg
(http://i2.photobucket.com/albums/y46/punksc/2adsls.jpg)
The Green lines are download, blue lines are upload. ADSL1 is the first adsl, ADSL2 is the second adsl, and ADSL1+ADSL2 is the sum of the traffic of the 2 adsls.
-
I would think it's nothing more than setting up default routes and/or possible load balance between the 2 data lines. That's how I do it with my linksys router. 2 IP address assigned to my single eth0. I have default routes specifying that certain computers use IP#1 while others use IP#2.
I wouldn't think it's any different, but I could be wrong. It's been a few years since I've dealt with 2 WAN connections.
-
Ateo: and I think that you better check "what is RPF check is". It's not the same as assigning 2 ip's to one interface.
PunkSC: your provider have RPF check turned off. That's why it works. Consider this:
amule want to open connection. It sends SYN packet. It listen on 0.0.0.0 (any interface), and you have 2. So OS will choose one of them for SIP of outgoing packet.
But, since you using load ballancing, you're not respecing OS choice and forwarding packet from another interface. Your provider may detect situation, where packet with SIP1 coming from interface with ANOTHER IP, not the one it's assigned. Provider may choose silently drop this packets (SIP spoofing prevention). Your provider simply ignore this situation and forward packet according to it's DIP. Everyone happy.
-
Sorry the BIG delay. I wasnt with email notification on this topic.
I disagree with you lfroen. When u say "OS choose a interface, but load balance may send a packet using another interface" you are wrong.
The OS do load balance, isnt any outside program. So, when amule needs to open a connection it sends a SYN. The OS choose one of the 2 interfaces, and store the information "the SYN packet sent to ip xxx.xxx.xxx.xxx was sent using ppp0", so the OS keep watching the right interface for the syn response.
Here is the code i use to do the load balance. Maybe it can make the things a little clear.
#!/bin/bash
#get ppp0 ip address
pp0=$(ifconfig ppp0 | grep 'inet end' | awk -F: '{ print $2 } ' | awk '{ print $1 }')
#get ppp1 ip address
pp1=$(ifconfig ppp1 | grep 'inet end' | awk -F: '{ print $2 } ' | awk '{ print $1 }')
#if ppp0 is down, start ppp0
if [ -z "$pp0" ]; then
adsl-start
fi
#if ppp1 is down, start ppp1
if [ -z "$pp1" ]; then
adsl-start /home/punksc/1ppp.conf
fi
#delete all rules, except rules 0,50,32766 e 32767
ip rule show | grep -Ev '^(0|50|32766|32767):' \
| while read PRIO RULE; do
ip rule del prio ${PRIO%%:*} $( echo $RULE | sed 's|all|0/0|' )
done
#Do the Load Balance
ppp0=$(ifconfig ppp0 | grep 'inet end' | awk -F: '{ print $2 } ' | awk '{ print $1 }')
ppp1=$(ifconfig ppp1 | grep 'inet end' | awk -F: '{ print $2 } ' | awk '{ print $1 }')
ip rule del prio 50 table main
ip rule add prio 50 table main
ip rule add prio 201 from "$ppp0" table 201
ip route add default via 200.138.225.254 dev ppp0 src "$ppp0" proto static table 201
ip route append prohibit default table 201 metric 1 proto static
ip rule add prio 202 from "$ppp1" table 202
ip route add default via 200.138.225.254 dev ppp1 src "$ppp1" proto static table 202
ip route append prohibit default table 202 metric 1 proto static
ip rule add prio 222 table 222
P.S.: To make this work, u need to patch the kernel, with Julian Anastov patch. The website is: http://www.ssi.bg/~ja/#routes
-
PuncSC: tweaking routing tables is not what people calling "load ballancing". This works because you specifying target ip's up-front.
I personally have no idea where my amule is going to connect. But if you do - you can make special rule for it in routing table and direct it to right interface. Just don't call it "load ballancing"