| View previous topic :: View next topic |
| Author |
Message |
onezeroinc Naik
Joined: 22 May 2004 Posts: 53 Location: Karachi
|
Posted: Sat May 12, 2007 5:24 am Post subject: load balance 2 DSL Modem in one server |
|
|
Hi, How to load balance 2 DSL Modem in one server. I have two dsl modems (128kbps each) which is connected via ethernet to my server. i
installed three lan cards on the server. lancard1 and lancard2 is connected to both dsl modems and lancard3 is connected to the 8 port hub.
I want to use both dsl modems for internet, but at the same time. means, want to share both dsl modem to get 256kbps at the same time.
I think you got my point. please help me and show me the way.
waiting...
Best regards.
onezeroinc. |
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Sat May 12, 2007 12:53 pm Post subject: |
|
|
| i don't think it'll work. or maybe the last guy who tried missed something. |
|
| Back to top |
|
 |
onezeroinc Naik
Joined: 22 May 2004 Posts: 53 Location: Karachi
|
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Sat May 12, 2007 6:12 pm Post subject: |
|
|
| the damia.net setup looks like it'll work. the only way to be sure is for you to set it up. |
|
| Back to top |
|
 |
compucated Naik

Joined: 13 Oct 2003 Posts: 75 Location: Karachi, Pakistan
|
Posted: Sun May 13, 2007 12:43 am Post subject: |
|
|
http://lartc.org/howto/
Read whole document for better understanding and section 4.2. (Routing for multiple uplinks/providers) to get more specific. |
|
| Back to top |
|
 |
siddiqi8 Naik
Joined: 25 Feb 2005 Posts: 88
|
Posted: Mon May 14, 2007 12:12 am Post subject: |
|
|
| What you can do is to route all your web traffic through 1 dsl modem and rest to the other dsl connection.. |
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Mon May 14, 2007 2:15 pm Post subject: |
|
|
| siddiqi8 wrote: | | What you can do is to route all your web traffic through 1 dsl modem and rest to the other dsl connection.. | which will probably work far less efficiently than the damia solution (if it works). |
|
| Back to top |
|
 |
LinuxFreaK Site Admin

Joined: 02 May 2003 Posts: 5130 Location: Karachi
|
|
| Back to top |
|
 |
onezeroinc Naik
Joined: 22 May 2004 Posts: 53 Location: Karachi
|
Posted: Tue May 15, 2007 6:14 pm Post subject: |
|
|
hurra i done it.... thanks for damia solution.
but when i enter there commands, first error come, so i change IPTABLES to iptables. then again error come in SNAT, its says "Bad argument `SNAT' now what todo? ( but with out giving this commands, my both dsl modems are working but without natting.
| Quote: | IPTABLES=/sbin/iptables
$IPTABLES -t nat -A POSTROUTING -o $EXTIF1 -j SNAT --to-source 81.203.149.126
$IPTABLES -t nat -A POSTROUTING -o $EXTIF2 -j SNAT --to-source 81.203.144.81
$IPTABLES -t nat -A POSTROUTING -o $EXTIF3 -j SNAT --to-source 81.203.128.69
$IPTABLES -t nat -A POSTROUTING -o $EXTIF4 -j SNAT --to-source 81.203.144.88 |
my second questions is, when ever system restart eth1 and eth2 gateways changed, so please confirm me every time i enter these commands or what?
is there any script to get eth1 and eth2 gateway automatically?
please help me and others,
best regards,
Onezero |
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Tue May 15, 2007 6:50 pm Post subject: |
|
|
| those are the commands on the page. what are the commands you ran? please paste the exact commands. |
|
| Back to top |
|
 |
onezeroinc Naik
Joined: 22 May 2004 Posts: 53 Location: Karachi
|
Posted: Tue May 15, 2007 7:15 pm Post subject: |
|
|
| Quote: | root@ubuntu:~ # iptables -t nat -A POSTROUTING -o $EXTIF1 -j SNAT --to-source 202.38.48.66
Bad argument `SNAT'
Try `iptables -h' or 'iptables --help' for more information.
root@ubuntu:~ # |
|
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Wed May 16, 2007 12:13 am Post subject: |
|
|
in a shell prompt $something refers to a shell variable. before you can use $EXTIF1 in a command, you must first define it. that's probably also why $IPTABLES didn't work for you.
change that to | Code: | | iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 202.38.48.66 | or whatever the interface should be. |
|
| Back to top |
|
 |
onezeroinc Naik
Joined: 22 May 2004 Posts: 53 Location: Karachi
|
Posted: Wed May 16, 2007 3:31 am Post subject: |
|
|
done.
i give these commands with no error come. that mean all are ok. but please tell me that what is the effect of these commands? as i already told that with out these commands, my problem already solved. both the dsl modem working and give me 256kbps speed. what this do?
| Quote: | | root@ubuntu:~ # iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 202.38.48.66 |
my other question is: when my pc restart. all browsing stops. i manually gave this gateway because of dhcp of dsl modem. what to do?
best regards
onezero. |
|
| Back to top |
|
 |
lambda Major General
Joined: 27 May 2003 Posts: 3410 Location: Lahore
|
Posted: Wed May 16, 2007 12:22 pm Post subject: |
|
|
| onezeroinc wrote: | | my other question is: when my pc restart. all browsing stops. i manually gave this gateway because of dhcp of dsl modem. what to do? |
i guess you'll need to write a script. on startup, you'll need to do the following:
- get the local ip addresses for each ethernet interface
- get the remote gateway addresses for each interface
- delete the default routes and use the "ip route add" command to set the routes
- run iptables for SNAT with the local ip addresses
here's how you get the gateway address for, say, eth0: | Code: | | netstat -rn | grep ^0.0.0.0 | grep eth0 | awk '{print $2}' |
here's how you get the ip address for, say, eth1: | Code: | | ifconfig eth1 | grep 'inet addr' | awk '{ print $2 }' | sed -e 's/.*://' |
the damia page tells you how to use these two pieces of information.
i googled for shell scripting and found this guide. time to start learning, 10. |
|
| Back to top |
|
 |
LinuxFreaK Site Admin

Joined: 02 May 2003 Posts: 5130 Location: Karachi
|
Posted: Thu May 17, 2007 3:08 pm Post subject: Re: |
|
|
Dear onezeroinc,
Salam,
This will also help
# route -n | awk /UG/'{print $2}'
Best Regards. _________________ Farrukh Ahmed |
|
| Back to top |
|
 |
|