Combine two connections (Wifi or ethernet) for a single torrent download. Listen to streaming audio and download side by side. Routing through multiple uplinks.

Hi, So my friend was out on weekend, and I had two spare/live connections (256kbps) at my disposal. My objective was to download a single file(using torrents) at 512kbps.

Here’s what I finally achieved.

Updated – Azureus supports multiple interfaces. Check out the end of post.

1. Both cards @ 256Kbps

Two Interfaces showing speeds ...

and Azureus dowloading at 512Kbps

Azureus Speed

Convinced ??

OK, so one of my connections is through ethernet(wired) and other one is through wifi.

All of below is tested on Ubuntu but theoretically should be doable on Windows as well.

Separate Connections using VirtualBox – Host on wireless, virtual machine on wired network

Its no big deal using those two connections on same PC achievable through virtualization. I use VirtualBox to virtualize Windows XP on Ubuntu. You will have to use “host networking” to achieve this. Let me give a brief summary of how I do this.

Install bridge-tools, sudo apt-get install bridge-utils uml-utilities

Here’s how I create a virtual bridge and add eth0 in promiscuous mode to it.

sudo tunctl -t tap0 -u kx
sudo chmod 666 /dev/net/tun
sudo ifconfig eth0 promisc
sudo ifconfig tap0 promisc
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 tap0
sudo dhclient br0

Now create a new network adapter, attached to host interface and chose interface name tap0. If you have DHCP running on router both host machine and virtual machine will get DHCP address from router or you can configure static IPs.

Restore network as:

sudo ifconfig tap0 -promisc
sudo ifconfig br0 down
sudo brctl delif br0 eth0
sudo brctl delif br0 tap0
sudo brctl delbr br0
sudo tunctl -d tap0
sudo ifconfig eth0 -promisc
sudo dhclient eth0
sudo ifconfig eth0 down
sudo ifconfig eth0 up

Its OK, we can download one file in Virtual Machine and another on host machine @ 256Kbps each. But this is not what we want. We want to download *that single movie* in half the time at 512K

Combining connections on Single Host

Make sure you have removed any bridges or virtual devices from previous section. Just reboot to be sure.

Start configuration: Just make sure both interfaces are up and have IPs. I use WICD to manage my networks on Ubuntu. So quicky “ifconfig” and see if you have 2 IPs. If not, up that interface, “ifconfig eth0 up” and probably get an ip, “sudo dhclient eth0”. I’ll leave this to you guys assuming you’ll be able to do it.

Ok now, Print your initial routing table, “route -e”

Destination Gateway Genmask Flags MSS Window irtt Iface * U 0 0 0 eth1 * U 0 0 0 eth0
default UG 0 0 0 eth1
default UG 0 0 0 eth0

Now I don’t want 2 default routes so I delete one.

sudo route del default gw eth1

Now all of my traffic goest through which is my wired network. So, grab a torrent client and load that movie. Set max connections per torrent to a figure like 300. Let it download for a few minutes. When it has connected to lets say 50 peers. Browse to peers tab. And just note the relative categories of IPs of peers.

For e.g. In my case almost half were from range 50.X.X.X to 100.X.X.X and rest were from other space. Now all of these connections are going through default gateway from our routing table. All we want to do is add some alternate route for this address space.

Okie Dokie. Stop the download. Here’s the script file I created for the same purpose.

if [ $# -lt 4 ]
echo "Error - Range and interface missing $#"
echo "Syntax : $0 start_range stop_range gateway_address interface"
echo "E.g. ./add_range 50 55 eth1"
exit 1

for (( i = $1 ; i <= $2; i++ ))
sudo route add -net $i.0.0.0 netmask gw $3 $4

Copy the above code and save it in a .sh file. For e.g. I run it as

./add_range 50 100 eth1

That’s it. Run start the torrent again. Al peers in IP range 50.X.X.X to 100.X.X.X would go through wireless interface and all others through default gateway i.e. wired interface.

Just make sure that the default gateway corresponds to interface. For e.g. in my case -> eth1 and -> eth0

Similarly you can delete some ip ranges.

if [ $# -lt 4 ]
echo "Error - Range and interface missing $#"
echo "Syntax : $0 start_range stop_range gateway_address interface"
echo "E.g. ./delete_range 50 55 eth1"
exit 1

for (( i = $1 ; i <= $2; i++ ))
sudo route del -net $i.0.0.0 netmask gw $3 $4

You can keep on dynamically adding routes to balance no of connections over two interfaces. You are in control

Streaming music and Downloads

For e.g. while listening to lastFM, normally I find my music streamed from 87.X.X.X, So I added this dedicatedly to wired interface and make my wireless interface, the default gateway. So now I can browse, download stuff without breaking my music.

It shouldn’t be too hard to dynamically add these routes based on total number of connections across each interface. All that script would do is add entire ip range (lets say 50.X.X.X to 190.X.X.X) to gateways alternately based on total number of connections across each interface.

Here is a nice article which lets you manage multiple links in a more standard way and lets you do load balancing as well.

Azureus supports multiple links. 

As commented by surgio in comments, azureus does support dynamic routing across multiple interfaces as indicated in his screenshots. Please have a look at his screenshots in the comments section for the same. Here’s the setting if someone is interested.

Azureus supports multiple interfaces

Have a nice time downloading.

Again, in case any doubts ask questions.

45 Responses to “Combine two connections (Wifi or ethernet) for a single torrent download. Listen to streaming audio and download side by side. Routing through multiple uplinks.”

  1. Derrek Says:

    Thanks, I will try this. Was looking for something like this.

  2. Toshiba laptops Says:

    i have tried it earlier , but really it doesnot works .

  3. kx Says:

    It works if you can carefully chose your gateways. Works for me fine, 🙂

  4. Kx Says:

    An optimal IP range for *most* torrents for was 50 – 85

  5. OH Says:

    In our university there is a 30KB/s limit download for each IP. So I assigned 5 IPs on my laptop, eth0, eth0:1, eth0:2 and more. So I can download with 150KB/s on my laptop, from different connections with the second solution, setting IP routing table manually. But I can not use your first solution. I did not understand your first solution. Is it possible for me to make bridge for my eth0, eth0:1, ….
    Then it will automatically balance my connections. What is a bridge, and how can I combine my connections with it? Could you explain more?

  6. Kx Says:

    Firstlly, you’l need a specialized router(hardware) to achieve automatic balancing accross 5 cards on a single OS. We are only trying to discuss a software solution here.

    Since it is difficult to use all 5 connections at once on same host (needs dynamic routing) , so the first solution revolves around creating multiple VMs. So you end up running 5 virtual machines on a single OS all connected to individual network cards. So, you will need to create 5 VMs which can in turn talk to five network cards.

    To do this. You will probably need to create 5 bridges brX, add a network card to each bridge in promiscous mode, create a virtual device tapX and connect to corresponding VMs.

    As I told, dynamic routing using all network cards on a single network layer is not as easy as it sounds. The second solution discusses one such make shift solution which can work on intelligent IP range guessing.

    Lets see if you can really get 150KBps for a single download. Would love to see that.

  7. Kx Says:

    >>Hi, there
    >>Thank you very much for your answer. But I have another >>question. How can I set up the the IP of the bridges? If I set >>up an IP for a bridge then what will happen for the devices >>in it. And I have not understood what exactly a bridge do.

    If you, follow commands mentioned at the post

    “sudo tunctl -t tap0 -u kx
    sudo chmod 666 /dev/net/tun
    sudo ifconfig eth0 promisc
    sudo ifconfig tap0 promisc
    sudo brctl addbr br0
    sudo brctl addif br0 eth0
    sudo brctl addif br0 tap0
    sudo dhclient br0”
    Now lets say you have DHCP enabled on eth0. So the last command “sudo dhclient br0” assigns first available DHCP addess to the bridge. Now when you specify tap0 as device for the VM, its also gets a dhcp address from eth0.
    For e.g. in my case br0 gets and tap0(the virtual device) ,hence the network card in VM gets from DHCP pool.

    A bridge as name suggests is a *software based connection* between two or more network interfaces. You can compare bridge to a switch sometimes, the only difference being that bridge works at MAC addresses whereas switch can work on IP addresses.

    However all you really want to care is that if you add 5 devices to a bridge, it knows where to send data and knows where from the data came

  8. Rock Says:

    Bro Can U Post It For Windows!!!

    Pls Explain It!!!

    Pls Bro!!

  9. sam Says:

    though i donn hav 2 connections …this looks fantastic..hehe

  10. Benjamin Schweizer Says:

    as long as you have multiple tcp streams (thias is what you have with torrents), you can use round robin routing. imho, linux supports this using iproute2

  11. Kx Says:

    Oh! Thanks.. It would try it as soon as my friend goes for a vacation.

  12. surgio Says:

    I have a 3g cellular data connection that is accessable on my laptop thru bluetooth PAN. The laptop also has a wifi connection that goes to my DSL router. Any way to combine those two, i’m running windows XP…there doesn’t seem to be a way. How about just a torrent client that will use multiple connections? Windows wont even use the spare connection at all…there has to be a way around this. Please respond!

  13. m3lis Says:


    Could you please explain how to combine two connection (a wired one and a wifi) for Windows? I would be really grateful.

    Thanks in advance

  14. surgio Says:

    okay, i got it…! only for torrents though!
    the latest version of azureus for windows (vuze) has the ability to in itself do load balancing and primitive round robin routing via as many connections as you want on your windows box. it took me awhile to figure it out but i got it.

    here are the screen shots:

    check the settings screen shot and it will show you how to set this up in azureus.

    the bluetooth connection is coming from the internet sharing on my cell phone 3g from at&t (3g from cell -> bluetooth link -> laptop)..which is about 60-80 k / sec…the wifi is coming from my dsl…which is about the same

    azureus combines them and does load balancing so i can also browse at the same time. it basically does the same thing that all those iptables / linux commands do, but ONLY for the program itself…not for the entire operating system. which is dissapointing but reality.

    NOW what I really want is software that will do this FOR EVERYTHING, not just torrents. For windows, right now, there exists no solution to this problem.

  15. Kx Says:

    That’s a great discovery surgio. I can’t seem to stop loving azureus. I dont have a windows box right now, but I am sure you can manipulate your routing table there too.

    As you would have noticed even your bluetooth network finally gets registered as an ethernet adapter on windows box.

    Have a look here, to have a basic idea on how to build routing tables on windows.

  16. m3lis Says:

    surgio can you explain the Bind to local IP option a bit pls? What do I write in exactly? My wired connection gives me an ip and my wifi

    Please help me to combine them using azureus. Thanks

  17. Kx Says:

    You could try,;

    Either of these should work.

  18. m3lis Says:

    Excellent, thanks Kx!!

    Now is there a way to increase the speed even more by connecting to more than one networks at the same time? I’ve come across a program called VirtualWifi ( that seems to do that, but havent managed it. check it out

  19. Kx Says:

    That definitely looks very interesting m3lis. Do reply back if you get any success with the same.

    @ Surgio, I added the azureus information to the post.

  20. m3lis Says:

    The only problem with VirtualWifi is that I’m not sure if it allows for faster speed or it justs splits the bandwith between networks

  21. m3lis Says:

    Ok, with VirtualWifi I managed to get three different wireless networks (with a singe wifi adapter) to appear as there different (wired) connections in the “My Connections” folder.

    However, I tried many different things in the azureus setting, sometimes it only downloaded from the last wifi connection OR sometimes the whole pc froze completely. No combined speeds despite the three networks.

    I’m at a dead end it seems, any help will be appreciated

  22. Kx Says:

    Problem with me is I don’t have access to multiple wireless networks here..

    I think we also need to understand how azureus does its load balancing here … May be then we can understand what’s happening. May be you did manage to get three fine live connections..

    I will try this as soon as I have another wireless router. Thanks m3lis for sharing your experiences…

  23. m3lis Says:

    No problem. By the way, do you think your very first method will work with the virtual connections? Although I will need a windows version of it to try.

  24. m3lis Says:

    Anyone tried the uTorrent net.bind_ip parameter with any success?

  25. Kx Says:

    So, Did that work in some way ? I guess, Its just to bind uTorrent to use a single interface to download ..

  26. m3lis Says:

    Yeah that’s how far I got. I’m even having trouble now with azureus when using private trackers that check the IP

  27. Kx Says:

    Private trackers like –? I have downloaded private torrents from different IPs many a times. Never faced any problem..

  28. m3lis Says:

    Different IPs at the same time though?

  29. Kx Says:

    Ya, I meant, same torrent through 2 ips, through above mentioned setup. I usually divide my ip range routes accross the two ips(hit and trial) to get balanced speeds. And yea, many a times private torrents.

    So what error you get ? And which tracker ?

  30. m3lis Says:

    Just sorted it out, it just needed to visit the website again and redownload the torrent with the second connection.

    However, I have another problem on my VISTA machine. Using the same wifi adapter on it, one of the IPs in azureus is not listed as eth but as net. And I cant combine the speed. Have a look:

  31. Snidd111 Says:

    i’m trying to do the multiple connections in azureus as well and it seems to work at first…for a minute maybe i’ll get speeds around 300kB/s which is what i theoretically should get with all three of my connections, but then it dies back down to the speed of only one.

    Here’s a screenshot of what i did. any help would be awesome.

    and if it helps i’m running on a quad core machine with windows xp 32 bit. one connection is a PCIe card, one is a LAN, and another is a USB adapter

  32. Rowanimo Says:

    i’ve been reading this and i have a bit different situation. i have a dsl connection and the router i have has one ethernet port and one USB port. can i combine those to get the same thing? i’m using windows xp btw. thanks and great article.

  33. Snidd111 Says:

    from what i understand Rowanimo is that you still only have one actual internet connection even if you connect to the router in multiple ways you just split up your bandwidth provided to you by verizon. this guide is more to combine multiple internet connections, like if someone was paying for more than one from their isp or wanted to combine it with a neighbors.

  34. Rowanimo Says:

    thanks for that one snidd. kinda makes sense right. hehe thanks again.

  35. Kris Says:

    I’m actually interested in doing something similar to what Rowanimo was talking about. If you’ve got a fast ISP connection (such as at a uni), then the 54Mbps max thru put from an 802.11g router is going to be the limiting factor. I’ve got several wireless USB adapters, is there some way to connect with all of them and get the combined through put? (So instead of witnessing only about 22Mbps with one wireless nic, I’d see 3X22Mbps using 3 nics? ) Any ideas on this one? Thanks.

  36. Surge Says:

    If I understand WIFI correctly, the maximum bandwidth of the ENTIRE router is adding clients wouldn’t help, you’d have to add another router AND client 😛

    IF you really need that kind of bandwidth with wireless, the best way would just be to get a draft N wifi router..They advertise at like 300 mbit, but wikipedia says to expect about 100 mbit actual usable bandwidth…I’ve never gotten anything higher than around 25 mbit with my G router, so that sounds about right.

    What would be really cool (and I’m not advocating wep cracking) would be to build a big ass antenna, and have like 3-5 wifi adapters all going to different wifirouters around your neighborhood, and then combining them all into one big pipe 😛 That would be fun to try, even just for testing purposes…with permission of the owners, of course.

    If i remember correctly, there is a program that lets you do’s called VirtualTunnel or something like that I believe..I’m about to check out Virtual WiFi right now.

  37. t304 Says:

    I have two connections on my laptop: WiFi and Wired
    WiFi connects to a 1Mbps WiMax connection while wired gets me into the local corporate lan.
    when i connect to both, all the request redirect to wired connection and i can’t access internet. To get to internet i need to disconnect from corporate lan.
    But we have some application to run on local network, so can’t abandon either of them.
    Any solution?!!!

  38. enmaku Says:

    I could be wrong, but isn’t this kind of thing what ifenslave is for?

  39. sukhi Says:

    i think there is an option in windows vista of merging two connections together i don know how it works (coz i hav just one net connection but done wid lan and net connection ) just move to network and sharing center then click customize of any connection then click on merge or delete…rest is simple .
    hav fun


  40. jonnib Says:

    hi everyone,
    Me and a friend of mine did an experiment in combining “two connections in one” under windows xp with Wingate. We used one Dsl line (1) 11 Mbit/s over Ethernet adapter and another one Dsl line (2) 17 Mbit/s over wireless adapter.
    The actual bandwith of the second dsl line (2) was about 6-8 Mbit/s cause of wireless signal limitation. We set up the Wingate to use the gateway of the second Dsl line (2) under proxy. Using this trick and Flashget (supports single gateway directly from your own router but supports proxies that you can use for each thread it produces ( for example if you have more than one or two gateways, you can setup Wingate to us them as proxies and each proxy you can add it in Flashget as a segment).So we were able to download from Rapidshare (premium account) with these two connections up to 1.5 Mbytes/s to 2.0 Mbytes/s . Our was the wireless connection with the bad signal as a result variable bitrate over the standard 1.1 Mbyte/s from the local dsl Line (1).
    Finally this experiment is not global and it’s not actually Network interfaces combination , but i think it’s usefull and easy when we have more than a basic connection and the other is standby.
    I would like to see your comments about this and if you have something to add.


  41. Bshkot Says:

    Hello jonnib

    i have 2 internet connections coming to my pc through shared pc on local lan network ,

    can you please tell me how to configure WIngate to use both connection , and flashget

    thanks in advance and excuse me for my English

  42. Bshkot Says:

    never mind my comment i found a guide and it worked perfectly

    the link in case needed ..

  43. Using Two or more Internet Connections at same time Says:

    […] told you have to manually configure your routing tables. Just in case you want to have a look, its here. If you want to achieve this you would like to go the Wingate way. I have not tried this, but this […]

  44. anon Says:

    OK, got it. One client, but with static routes for half the internet through another interface. Cunning.

    I have been trying to aggregate connections to speed up poorly seeded torrents. I have come up with this so far:

    Multiple torrent clients downloading to different locations, but all on the same computer (or some in a VM on said computer).

    Clients configured differently, one using a socks proxy (with a reverse SSH tunnel for incoming connections) and no uTP. One with no proxy straight out the gateway, TCP and uTP. One in a VM using a VPN service, using uTP and TCP over the VPN.

    A tracker on the LAN, and torrent clients using the local tracker (as well as coppersurfer etc.). Storm Tracker is a simple one-file php tracker, and whilst discontinued is still out there – I found it on in the end.

    This gives up to three clients with their three different peer IDs, off three internet IPs connecting to the same swarm. The clients can find each other on the LAN using the local tracker, and have unfettered speed connections between them.

    Ultimately with this arrangement I am putting all the traffic over one internet connection, but it helps with downloads from poorly seeded swarms. If there is one seed and a several leeches, I can have many clients in the queue for the seed’s bandwidth/upload slots. My clients all share the data and and do not need to ask for data redundantly from the internet. A local tracker and high-speed between LAN clients means the clients coordinate themselves without the torrent clients having to be modified to cooperate.

    I end up with multiple copies of a download, but I just delete all but one. It might be possible to make all clients but one move finished downloads to /dev/null, to just automate the final step.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: