2

We have 2 flatrates in the house and have double bandwith theoretically. There is a local network in the house that connects everything.

But when I am alone I wonder how I can use both connections at the same time.

I want to build a solution where I can browse the web and page requests are spread between the 2 connections.

I imagine there are expensive routers who can split the traffic between 2 lines (Edit: which I do not want to buy or install). But is there a good way to do it with linux (Edit: which I prefer)?

The solution I am looking for will split the requests already for one page (multiple images, css files, javascrfipt files) between the two lines.

user12096
  • 917
  • 5
  • 23
  • 39
  • This is just called "Load Balancing" - no need for reverse. It's also common, and there's a few links on serverfault about it already. I'll see if I can find it. – Mark Henderson Apr 06 '10 at 01:47
  • 3
    http://serverfault.com/questions/89560/best-router-to-combine-two-home-office-dsl-connections or http://serverfault.com/questions/58525/2-dsl-lines-any-benefit or http://serverfault.com/questions/102239/linux-firewall-loadbalancer-distribution or http://serverfault.com/questions/18512/split-access-on-a-windows-server or http://serverfault.com/questions/93678/load-balancing-nat-ing-multiple-isp-connections-on-linux or http://serverfault.com/questions/95732/firewall-or-other-solution-for-automatic-fail-over-to-a-second-server - these will all answer different parts of your question – Mark Henderson Apr 06 '10 at 01:48
  • @Farseeker thank youm I will update the question with the right terms tomorrow but I need some sleep now, and curious about your links then. – user12096 Apr 06 '10 at 01:48
  • No worries. We use pfSense in our office for load balancing outbound internet connections, but there are a few caveats, which are outlined in those questions. – Mark Henderson Apr 06 '10 at 01:50
  • If they are both PPPoE/PPPoA, you may want to check if your ISP supports Multilink PPP (http://www.linktionary.com/m/mlppp.html) as I know some DSL providers do. – squircle Apr 06 '10 at 02:40

3 Answers3

0

I've heard of Dual-WAN routers. Could you buy one of those to do the job?

I suspect its possible to use the Linux distro called Vyatta, which does WAN Load Balancing i think: http://www.vyatta.com/downloads/doc_registration.php

Another name for this kind of thing is "Bonding" or "Trunking" I think .

djangofan
  • 4,172
  • 10
  • 45
  • 59
0

I think "ip route default equalize" can solve your problem.

ip route replace default equalize nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 1   

ppp0 is a device, ppp1 is another device
weight 1 means the probability that packet will choose

JK-Hu
  • 3
  • 4
-1

You can't do this with only the machines in your house unless both connections are to the same ISP and that ISP supports load balancing across two multiple connections, which would be rare for a residential service.

If you have access to a Linux computer that is out on the Internet you might be able to do the following (this is off the top of my head, it's not well researched, so I don't have specific software in mind).

  • C1, C2: Two client machines at home.
  • R1: Linux computer at home acting as your router to the Internet.
  • R2: Linux computer, virtual server, whatever out on the Internet somewhere.
  • L1, L2: Two flat rate links to your ISP
  • R1 establishes two VPN, PPP, or L2TP links over L1/L2 to R2.
  • Setup load balancing software on both ends. Something like the Linux bonding driver over the two virtual interfaces the VPN or whatever creates.
  • Setup C1 & C2 so R1 is the default gateway
  • Setup R1 so it routes traffic from C1 & C2 to the R2 via the bonded connection.
  • Setup R2 so it routes traffic from C1/C2/R1 to the Internet.

Now that I've written all this, I have less confidence it will actually work, but it might get you on the right track.

kbyrd
  • 3,604
  • 2
  • 23
  • 34
  • This is overly complex a simple split routing is possible. http://lartc.org/howto/lartc.rpdb.multiple-links.html – Zoredache Apr 06 '10 at 05:04
  • @Zoredache: split routing will likely run the traffic for one IP over the same link over and over again. The original question states he wants to balance different elements from a single web page over the two lines. If you have an answer, post it. – kbyrd Apr 06 '10 at 12:13
  • @kbyrd: looks good. but would not be able to do all these configurations. – user12096 Apr 06 '10 at 20:18
  • in what way would a simple split routing use the same route for different resources of the same page? wouldn't it be possible to configure? – user12096 Apr 06 '10 at 20:21
  • I do not see how this answer deserves the downvoting. It is a different viewpoint and if it works it would be a solution of my question (although I do not have the skills to set this up) – user12096 Apr 06 '10 at 20:22
  • @matnagel: Yea, I don't think I deserve downvotes either, but I'm biased ;-) @matnagle (other question): At the link Zoredache posted I found the following text: "Note that balancing will not be perfect, as it is route based, and routes are cached. This means that routes to often-used sites will always be over the same provider." I read that as, "connections to the same IP (same webserver) will always go over the same provider" – kbyrd Apr 06 '10 at 22:10
  • @kbyrd, RE: caching of routes, it takes both the **source** and destination address into account. So if two computers from his network visit serverfault.com then possibly they could be served by different links. A single system accessing a single external web site would used a single path though. Depending on the bonding mode selected, your solution with bonding will have the same behavior. – Zoredache Apr 07 '10 at 03:01
  • I wonder if the split on the same source/destination is really an issue though. It is rare for a single web page to be served by a single web server. A view of serverfault.com usually hits at least 10 different addresses (eg ads.stackoverflow.com, ajax.googleapis.com, edge.quantserve.com, l.collective-media.net, pixel.quantserve.com, serverfault.com, sstatic.net, www.google-analytics.com, www.gravatar.com). A single page view would be using both links in practice, it just wouldn't always be balanced. – Zoredache Apr 07 '10 at 03:05
  • this is a valid solution, especially since i have implemented multipath routing and it is pretty buggy, so im considering implementing the very same thing myself. – Aleksandar Ivanisevic Apr 13 '10 at 10:18