Ever wanted to combine two WAN connections for faster* internet? I do, for torrenting. And I scripted it.
On the Web, you’ll easily find “tutorials” that just give you some bash script you have to painstakingly modify for it to run. This is as simple as it gets! But see for yourself!(code at the end of this post)
Since I get a dynamic (external) IP right into my PC, that would mean, I’d have to modify that every time. So I made this small script, that only depends on iproute2, which you’ll need anyways, and awkand grep, that should already be on your system.
Just run the script as root and give the network interfaces you want to balance as parameters.
~$ sudo ./load-balance.sh eth0 eth1 wlan0
In a future version, I’d like to add support for dynamically setting the weight (currently, all interfaces get the same priority).
My setup looks like this:
eth0goes to my Uni’s Interweb (they are my ISP)
eth1is connected via a USB-Ethernet-adapter to a router with a UMTS-modem
wlan0is my Android phone in tethering mode
As you can see, it is of course necessary, that you have multiple entry points into the Internet. If you connect your PC with multiple connections to the same WAN, you won’t get any speed increase.
* Load balancing won’t work in all use cases. If you for example just stream a single video (or download a single file), only one of the balanced interfaces will be in use, and no speed increase is visible. But when you download multiple things, like the chunks of a torrent, half of the files/chunks are downloaded over the first IF, and half over the other.
See on GitHub Gist
# Load balance multiple internet connections. Requires iproute2, awk and grep.