Linux multiple IP's on virtual interfaces

Discussion in 'Installation/Configuration' started by blocker, Dec 2, 2011.

  1. blocker

    blocker Member


    here is the scenario: I have a box with 3 IP adresses, configured as virtual interfaces eth0 eth0:0 eth0:1

    i have also apache with ip based vhosts:

    this one is bound to the IP which is configured on eth0:0

    the problem is that when a connection FROM the vhost is made to external host, the connection goes trough eth0 and not trough eth0:0, as i wish to...

    whit SNAT i achieved to rewrite the default outgoing IP of the server but that is still not enough, since also in this case i have only one default outgoing IP

    iptables -t nat -A POSTROUTING -o eth0 -s -j SNAT --to

    this way all the traffic goes trough eth0:0, and the server remains reachable on all 3 IP's

    what i want to achieve is, every apache IP based vhost to go out trough its specific IP

    any thoughts and help are much appreciated!

Share This Page