How to set which IP to use for a HTTP request?

Posted by GetFree on Server Fault See other posts from Server Fault or by GetFree
Published on 2013-04-06T03:29:39Z Indexed on 2013/07/02 11:07 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

This is probably a silly question.
I'm doing some http requests using wget from the command line, and I want those connections to be made through one specific IP of the 4 IPs my server has.
Those http requests go to one specific range of IPs so I only want those to be routed differently.
The 4 interfaces in my server are eth0, eth0:0, eth0:1, eth0:2.

I tried with the following command:
route add -net 192.164.10.0/24 dev eth0:0

But when I see the routing table it says:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.164.10.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0

The interface is set to eth0 not eth0:0 as my command says.

What am I doing wrong?

© Server Fault or respective owner

Related posts about linux

Related posts about networking