Merging two internet connections from two network interfaces in order to obtain double speed

9,544

This is definitely feasible. Many of us were running mixed, load-balanced broadband configs for corporate years ago and they worked really well. Many probably still do!

You can do it in a number of ways, including using iptables rules and/or iproute2 (ip(8) command) to setup policy routing.

The load balancing is not done at the packet level, but at the connection level. That is, all packets of a connection go out of one interface. Which interface this is depends on the routing policy. Without the co-operation of your the first routers just beyond your own infrastructure, this is the only way you can do it. Remote computers have no way to tell that your two IP addresses actually belong to the same computer. In TCP, a connection is uniquely identified by a 4-tuple (Remote-IP, Remote-Port, Local-IP, Local-Port). If you send packets from different IPs, the remote server thinks they belong to two different connections and gets hopelessly confused.

Obviously, this sort of thing makes more sense in a corporate environment, or one with lots of users sharing a single connection. At work, we were combining a 256 kbps ADSL line with a 512 kbps cable line (yes, back then) and the whole thing worked remarkably well, with the added benefit of high availability.

For some actual practical help, here's one way of doing it with iproute2. It's meant for Debian, but it works on Ubuntu too, of course.

Share:
9,544

Related videos on Youtube

Ariyan
Author by

Ariyan

Updated on September 18, 2022

Comments

  • Ariyan
    Ariyan over 1 year

    I have two network interfaces (one wired & one wireless). I have two internet accounts too (each 256 kBps; one from a modem that I use as wired connection & the other from a wireless network).

    Is it possible to connect to both networks and merge them and get twice the speed (512 kBps)?
    How?
    I'm using Ubuntu 10.04 (Lucid Lynx).

    Thanks

  • Simon Gates
    Simon Gates over 12 years
    And, as @Nils said, if you're worried about bandwidth, you should definitely have an instance of Squid running somewhere in your infrastructure. It does depend on your use patterns, of course. If you visit the same sites a lot, a local cache is a great boon.