I have a server with multiple interface alias running debian. lets say eth0 eth0:0 and eth0:1

I'm looking for a simple solution, when connecting to host (or host range, would be better) that I could enforce using ip address of eth0:1 (and not eth0 as it does by default) to access some external services that are open to only that ip on eth0:1 (eth0:1 is a ovh 'failover ip', it can be moved to a different server during maintenance tasks).

  • 1
    Aah, yes, per the answer... ifconfig and its subinterfaces are pretty much obsolete now, in favour of iproute2. – Falcon Momot Nov 18 '14 at 8:58

Let's say your host has IP addresses and and your default gateway is Now if you want to use different local IP addresses to communicate with remote addresses and, you could do like this:

ip route add via src
ip route add via src
| improve this answer | |
  • As simple as that! I had not realised the power of the ip command. Thanks – Antony Gibbs Nov 18 '14 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.