Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Like in curL, we have a bind address option, we can download using a certain interface..

For ex, to download from eth0:0 we use $curl --interface eth0:0

This way, my aim is to download files but since curL doesnt support segmented downloading, i dont want to use it. We have a speed restriction on every IP. To overcome this restriction, I can start many interfaces like this, and download some part of the file from each interface.

How do i make any other download manager like AXEL to bind to a particular address? I am asking for some idea like changing variables in BASH shell, so that the whole shell binds to a particular interface, lets say eth0:1...

share|improve this question
up vote 3 down vote accepted

It sounds like what you really want is an application that can download a file in parts from different interfaces and join them together at the end. Eg, if you knew your file was 100MB, and you wanted to grab chunks of roughly 10MB, you'd want to do:

1. start a download of bytes 0..10000000 on eth0, saving to filename.part1
2. start a download of bytes 10000001..20000000 on eth0:0, saving to `filename.part2
3. start a download of bytes 20000001..30000000 on eth0:1, saving to filename.part3
N-1. wait for all downloads to complete
N. join all filename.part* together to get filename.complete

I know wget can resume a partially-downloaded file. I'm pretty sure that works by reading to the end of the existing file and then requesting the file, starting from the next byte, from the server.

It looks like curl supports partial downloads like this using the --range <byterange> option. So you could script the above steps like so:

1. curl --interface eth0 --range 0,10000000 -o bigfile.part1
2. curl --interface eth0:0 --range 10000001,20000000 -o bigfile.part2
N. cat bigfile.part* > bigfile

Caveats: this doesn't always work; if the HTTP/1.1 server doesn't have the partial-download feature enabled, you'll get the whole file on each call. See man curl for details on the --range option.

Edit: fixed byte ranges in examples

share|improve this answer

Here is a blog post about splitting a download with curl. I tried in Windows, but couldn't get it to work, but you might have success with Linux.

share|improve this answer

Make eth0:0 the default route instead of eth0. The command:

netstat -rn

will show you what your current default interface is. If it is not eth0:0, delete it with

route delete

then add it with something like

route add default eth0:0
share|improve this answer
I want to use all the interfaces simultaneously. Like in one terminal, i use eth0:0 and in the other i use eth0:1 .. Now, are u getting it what i actually intend to do. – Abhijeet Rastogi Sep 17 '09 at 12:52
You have different terminals but only one kernel. The kernel uses one set of rules for routing, no matter what application the traffic comes from. If you set up static routes to different subnets or individiual hosts, the kernel can route the traffic through different ports to get there. Or you can set up Xen which will give you a whole new IP, port range, and routing table. – kmarsh Sep 18 '09 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .