linux: how to run aria2 or wget only through eth0

3

1

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 =(

www.yegorov-p.ru

Posted 2010-03-05T06:24:04.357

Reputation:

Answers

3

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}

vpram86

Posted 2010-03-05T06:24:04.357

Reputation: 1 978

0

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!

lexu

Posted 2010-03-05T06:24:04.357

Reputation: 1 822