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 1.2.3.4 (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).
Let's say your host has IP addresses 10.0.0.2 and 10.0.0.3 and your default gateway is 10.0.0.1. Now if you want to use different local IP addresses to communicate with remote addresses 10.2.2.2 and 10.3.3.3, you could do like this: