Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

2 Answers 2

I think you can use --bind-address=ADDRESS in wget. As of 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.