# Network Load Balancing - 4 DSL Connections

## StinkiePhish

I have taken it upon myself to completely reorganize the internet connection possibilities for my fraternity house at the University of Illinois and have come across the possibility of SBC providing multiple DSL lines into the house, each with about 2 Mbps download speed. We have around 45 computers in the house requiring internet connections.

One thought I had was to divide the house into segments of about 10 computers each with a dedicated DSL line, behind a cheap Linksys router type piece of hardware. That seemed too easy though, and doesn't have the level of control and monitoring I would like.

My next thought was the possibility of setting up a linux server that was capable of network load balancing over the 4+ DSL lines, acting as a firewall and DHCP server. I could then set up a Squid proxy server for even more speed.

I know this is possible, but haven't gotten into the trenches yet as to what this actually involves. The bridging of the DSL connections and the network load balancing is what concerns me the most though.

Does anyone have any opinions of what would be the best course of action? Is it worth the hassle of a gentoo box?

Thanks!

----------

## halz

Take a look at 'Class Based Queueing'; you can get a system that will dynamically allocate bandwidth to different areas of the network, depending on how you set it up

----------

## nobspangle

Don't know if any ISPs do it in your area but in the UK there are a few offering "bonded" ADSL lines. The ISP bond 2-4 lines together for you and you bond them at your end, the entire bonded set simply acts as one Internet connection. There is a linux based bootable router distro to make it all work details here

----------

## StinkiePhish

Thank you for the reply. I do not believe that SBC provides this, as I bounced my ideas above off the SBC salesman I had on the phone and he made no mention of a bonded DSL feature. 

That would be exactly what we need however  :Smile: 

I've continued my search around and have begun a basic understanding of what needs to be done. I've been using Linux for a few years now, but haven't done anything this complex with the network.

So I'll start with the Gentoo Router How-To: http://www.gentoo.org/doc/en/home-router-howto.xml

Then move onto the actual network balancing following this document:

http://www.ssi.bg/~ja/nano.txt

I have read about problems with network balancing, such as AOL Instant Messanger (obviously a very popular program in a college fraternity) not working. Is this usually the result?

http://www.nwfusion.com/newsletters/frame/2005/0103wan1.html

Edit: CBQ does look promising, and I'll keep investigating. Thanks Halz!: http://db.ilug-bom.org.in/Documentation/HOWTO/Adv-Routing-HOWTO-9.html

----------

## The Shadow Surfer

Take a look at this:

Routing for multiple uplinks/providers

----------

## StinkiePhish

Thank you again for your replies.

Following the "Routing for multiple uplinks/providers" link above, I have to ask if it is possible to do this with dynamic IP addresses from the DSL modems. 

Do I have to get static IPs from SBC?

----------

## opm8

 *StinkiePhish wrote:*   

> Thank you again for your replies.
> 
> Following the "Routing for multiple uplinks/providers" link above, I have to ask if it is possible to do this with dynamic IP addresses from the DSL modems.  
> 
> Do I have to get static IPs from SBC?

 

Yes, it is possible with dynamic IPs.  It's what I do, splitting my outgoing connections between cable and dsl.  You'll have to get very familiar with the 'ip' set of commands in iproute.  Lartc.org is your friend.   :Smile: 

```
emerge iproute2
```

I'll forewarn you that it's not easy and may involve a lot of frustration.  It took me a very long time to get this to work because documentation is scarce and outdated. If you're interested I can post my multipath routing script that I use to get this working.  There are a couple of bugs/features, in it but it works in the end.   I based it on the netsane.sh script from http://muse.linuxmafia.org/netsane/.  The one glaring thing missing would be dynamically picking up dhcp info in /var/lib/dhcpc/dhcpcd-ethX.info and using the assigned IP in your routing.  This would be easy to add into the script, though.  My IPs, though dynamic, don't change for months so I update my script by hand when they occur.

--opm8

----------

## StinkiePhish

Posting or PMing your routing tables would be greatly helpful.

At this point, I'm just trying to decide which of the two paths to take. IPTables with the nano.txt document I linked above? Or iproute2?

They both seem to get the job done, and I don't see any glaring problems with either one of them. Am I missing something why one approach is better then the other?

----------

## opm8

They are one and the same.  If you notice in nano.txt there are all the 'ip route add' type commands.  That's the iproute2 command line executable, 'ip.'  My config is a mix of the nano.txt document and the netsane script to which I linked to.

You may be confused about the firewalling part, which is not handled by ip routing, and you didn't ask about earlier  :Smile:  .  Your original question can be answered with routing.

Firewalling is a different animal, but something you must pay attention to, as well.  I use shorewall for that. It's in portage and at http://www.shorewall.net.  There are many other iptables firewall implementations out there (search for firewall in packages.gentoo.org), but I chose shorewall because configuring two ISPs is one of its features.

I'll PM you my script tonight when I get home.

--opm8

----------

## StinkiePhish

I am showing my ignorance.  :Smile: 

I use APF http://www.rfxnetworks.com/apf.php on a RedHat box I admin (just simple http and email server, along with some off-site backups). Obviously, nothing as complex as this task requires, but it gets the job done. Configuration was easy enough, although I don't have the intimate knowledge of iptables I would like.

Continuing this side note, I'm more comfortable with Gentoo, as I've had more hands-on experience with it. This experience has been more directed towards desktop usage and configuration, but running a RedHat server remotely has helped me considerably and given me the courage to take this problem on with Gentoo.

----------

## opm8

StinkiePhish,

I sent you a PM but I'm not sure it made it through, so let me know if you didn't get it.  I forgot to mention that I also run a gateway keepalive script which, in theory, detects a dead connection and marks it as dead, thereby bypassing it all together.  The kernel does this automatically, but by pinging an interface you force the action to occur much more frequently.  I don't know for sure if it works or is even necessary, but I read about it somewhere and thought it couldn't hurt.

```
#!/bin/bash

        while : ; do

          ping -c 1 24.221.108.1 > /dev/null 2>&1

          ping -c 1 192.168.0.1 > /dev/null 2>&1

          sleep 20

        done

```

Maybe someone will correct me if they know it to be unneccessary.

The first IP (made up) is the default gateway of the cable connection, and the second is the one for the dsl modem. The dsl modem is actually a router on its own and this is the gateway IP I configured.

--opm8

----------

## StinkiePhish

Just an update:

The load balancing is working beautifully for http traffic. However, AOL Instant Messanger is having a very tough time connecting.

Is there a way to force AIM traffic over a single external connection? Will a SOCKS server solve this problem?

Thanks!

----------

## StinkiePhish

Answering my own latest question, running Dante socks5 server and routing the users' AIM clients through it is working as desired.

----------

## seigen

One thing that might work well if you are aggregating many dialup lines or other low capacity links into one clean big pipe is to send everything to a central server.  (You can rent them for as little as $30 a month.)

The central server can then send any request meant for your destination through the ip's associated with your active links.

Add vpn's into the picture and this becomes even easier, since your destination IP's become the VPN endpoints and thus knowable.

Have I done this?  No, but it does seem to be a feasible way to deal with using many modems to maintain a connection.  

There are a lot of details I haven't worked out.  If I knew about a year ago what I know now I'd have just used 4 phone lines and not purchased isdn for $145 line + 40 isp.  At any rate I'm fairly sure I could get it all working.  When you combine traffic shapping on both ends of the links, you should have a fairly responsive network build from something as bad as 56k modems.

Do note that this solution becomes less workable as the speeds get faster.  If you route say 4-- 1Mb/sec connections through a remote server you might not end up with a 4Mb/sec aggregate due to other factors.  There is also the fact that most servers like that do have a usage limit..

----------

