Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My PC has 2 wired cards. Both gigalan. It also has 2 wireless cards. One broadcom with proprietary drivers and ralink with open software (which works much better than broadcom). My cellphone can share its connection wirelessly to my PC. But I also have a wired connection. So I have multiple connections that I can use to have internet. How can I merge 2 or more connections together and balance them to enjoy one unified internet experience that it is the sum of all internet connections connected to it.

For example if I have a modem with an internet connection of 1024KB/Sec and another one that offers 512KB/Sec and one small one that offers 128KB/Sec, after load balancing and merging all connections (Bonding or Teaming), I could download at a speed of 1664KB/Sec using all 3 internet connections as one for example.

This question has always intrigued me.

Just to add some links:

Project for Teaming

Teaming Added to Kernel 3.3

Many Enhancements for Teaming in Kernel 3.5

Enhancements to Teaming in Kernel 3.6

Support for Bonding on IPv6 in Kernel 3.7

Bonding Network Interface (Planned)

UPDATE - I has been more than a year after I wrote this question. There has been several changes to the way networking works on Linux and how it shows on Ubuntu. For example, on Ubuntu 13.04 we can now see something like this:

enter image description here

As we can see, we now have the option for Bonding or for Bridging. I have not been able to test this out because I am not in any place with 2 or more connections, but a small guide that shows results will be very helpful.

share|improve this question
3  
Seems rather beyond the scope of Ask Ubuntu :) This is pretty complex networking stuff. IMO it's rarely worth it, by the time you take into account lost packets due to a link being down (even temporarily), reordering packets due to some links being slower than others, and such things. I don't know of a "black box" solution that'll do this, could be an interesting project. –  Caesium Nov 27 '11 at 17:43
5  
Well the question is about if this can be done in ubuntu and if yes how. –  Luis Alvarado Nov 27 '11 at 17:47
    
I created an answer in the 2 internet connections on a single PC post. Linking documents for bounding in Ubuntu. –  Lucio Feb 25 '13 at 19:58
    
@Lucio I could mark the question as duplicate or you can move your answer here and I can mark it as accepted. You would also need to be ready for when 13.04 comes out since it will include in Network Manager the bonding options (Only wired bonding slaves right now). –  Luis Alvarado Feb 25 '13 at 20:50
add comment

3 Answers

I do something like that at work using Ubuntu 11.04. We run the Shorewall firewall configuration tool, which besides being excellent at its job, provides some rudimentary multiple ISP routing tools which might fit your needs. You can find some docs about it here: http://www.shorewall.net/MultiISP.html .

What it comes down to though, is you cant use multiple ISPs for a single connection... things are that simple. The best you can do is try to direct new connections evenly between the different providers.

It is a complex problem. You will probably end up beating your head against the wall (I certainly did) before you are done debugging every problem. So, as other posters have suggested, you might be wise to carefully consider how strong your desire is.

share|improve this answer
    
Nice link. Very nice tutorial. –  Luis Alvarado Feb 8 '12 at 5:08
    
Let see also this: debuntu.org/2006/02/23/… –  Postadelmaga Aug 31 '12 at 15:29
add comment

You could do it by using the package ifenslave that attaches and detaches slave network interfaces to a bonding device.

  1. Install:

    sudo apt-get install ifenslave
    
  2. Load bonding kernel module

    sudo modprobe bondingle
    
  3. Configure your interfaces:

    sudo vi /etc/network/interfaces
    

    Example config, to combine eth0 and eth1 as slaves to your bonding interface:

    #eth0 is manually configured, and slave to the "bond0" bonded NIC
    auto eth0
    iface eth0 inet manual
    bond-master bond0
    
    #eth1 ditto, thus creating a 2-link bond.
    auto eth1
    iface eth1 inet manual
    bond-master bond0
    
    # bond0 is the bonded NIC and can be used like any other normal NIC.
    # bond0 is configured using static network information.
    auto bond0
    iface bond0 inet static
    address 192.168.1.10
    gateway 192.168.1.1
    netmask 255.255.255.0
    # bond0 uses standard IEEE 802.3ad LACP bonding protocol 
    bond-mode 802.3ad
    bond-miimon 100
    bond-lacp-rate 1
    bond-slaves none
    
  4. Restart Network:

    sudo restart networking
    
  5. Bringing up/down bounded interface:

    ifup bond0
    ifdown bond0
    

    There are several bonding modes as an example we use:

    bond-mode active-backup
    

    Description of active-backup bonding mode:

    Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

    Source and more info at the Ubuntu community help wiki.

Bonding, means combining several network interfaces (NICs) to a single link, providing either high-availability, load-balancing, maximum throughput, or a combination of these. Source

share|improve this answer
    
+1 because is one of the reasons for my question. Will still wait for a way to create a virtual network master connection that is the sum of all slave (real) connections. Something like bonding that comes in the latest kernel version. –  Luis Alvarado Nov 26 '12 at 13:08
    
-1 - bonding works in LANs as it's operating at Layer 2. The question is about load balancing two independent WANs. –  gertvdijk Dec 29 '12 at 12:33
    
@gertvdijk I don't agree check my update answer to find out that bonding does also load balancing. –  pl1nk Dec 31 '12 at 14:33
    
@pl1nk This is Layer 2 load balancing for two NICs in the same L2 network. This is not the same as multi-ISP load balancing! –  gertvdijk Dec 31 '12 at 14:50
    
@gertvdijk - I don't think that this question has to do with multi-ISP load balancing. –  pl1nk Dec 31 '12 at 15:07
show 2 more comments

It's a little bit old question, but if you still want to know..

There are 2 typical scenarios, what gertvdijk and pl1nk were arguing in one of the answers:

You have a computer with 2 public IPs (2 different ISPs) and you connect to another host (e.g. a server in a datacenter with a fat pipe that's bigger than the aggregate bandwidth of both ISP connections of your computer). So you establish a bonding connection to the host via your 2 connections and then the host (server) serves your traffic via its own internet connection. In this scenario, you can get almost 100% of the combined bandwidth in both directions for a single connection.

This is a particular case of bonding/teaming/ling aggregation where multiple layer 2 (same network) interfaces are joined together. It could be archived by establishing vpn layer 2 (tap) connections on each ISP interface from the computer to the host and bonding them together (round-robin mode) to have a single interface. The limiting factor in this scenario is how different are the delays (ping) on each ISP connection to the host. The more similar and stable they are, the better. We use it in one of our installations, it works well. If you would like to know the details about how to implement it just let me know.

Then another scenario would be without an intermediate host, i.e. a direct connection from you ISP interfaces to the webservers around the world. In this case the best you can get is to evenly distribute outgoing connections between the interfaces – i.e. one TCP session goes entirely via one ISP, a second session via another and so on. It is so because when you establish a TCP connection, it has an origin and a destination IPs for each packet and when a server receives a packet from another IP for which a TCP handshake was not performed, it considers the packet as erroneous and drops it. As each ISP connection has its own public IP, for the same TCP session you can't send one packet via one connection from one IP and another via another connection with another IP.

You won't get here as high aggregate bandwidth utilization for a single computer as with the first scenario, but for a small office it could be a good solution. What you can do to extend it a little bit is to implement custom solutions for specific protocols. For example you could have some sort of a proxy on the gateway (which could be the same computer) for http downloads and ask for different parts of a huge file establishing different TCP sessions via different ISP interfaces. In this case the resulting download rate would be near 100% of the combined bandwidth. It's like offloading to the gateway what ReGet, GetRight and similar downloaders do. Google for HTTP 206 Partial Content. I don’t know any out-of-the-box open-source solutions for this scenario, but there are hardware appliances that do exactly this: google for mushroom networks.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.