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

I have a computer under Linux with several network cards, for example: eth0, eth1, eth2, eth3. Is there some way to run any downloader, like aria2 or wget only through one interface, for example eth0?

Main problem: for some reason I can't use iptables =(

share|improve this question

migrated from stackoverflow.com Mar 5 '10 at 7:24

This question came from our site for professional and enthusiast programmers.

I think you can use --bind-address=ADDRESS in wget. As for getting the ADDRESS, you could play with ifconfig <interface_name> and extract IP alone.

Thanks to Tim in this post, IP can be extracted using

ifconfig <interface_name> | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'

You should get something like this;

wget --bind-address=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}') {URL}
share|improve this answer

you need to define a route that tells the OS to send packets from the local machine through the network interface needed.

This will force all traffic through that interface. I don't think it can be done on an app by app basis, but then I'm not an expert .. those hang out at serverfault.com!

share|improve this answer

You must log in to answer this question.