Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have one dedicaced server with its own IP and another IP (failover) who refer to the first.

I will wish to change the gateway of a Proxmox virtual machine (openvz) who runs on this dedicaced server to go through the failover IP rather than the ip of host main server.

Once connected to a virtual machine, when I do a traceroute

VE# traceroute

traceroute to (, 30 hops max, 60 byte packets
 1 ( FIRST_IP_MAIN_SERVER)  0.021 ms  0.010 ms  0.009 ms

The first line tells me the ip of host main server. I would like that the traceroute display the second IP failover.

VE# route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface       *      UH    0      0        0 venet0
default         UG    0      0        0 venet0

With iptables

HOST# iptables -t nat -L

target     prot opt source               destination         
MASQUERADE  all  --  anywhere             anywhere            
MASQUERADE  all  --  anywhere             anywhere            
SNAT       tcp  --  anywhere            tcp dpt:www state NEW,RELATED,ESTABLISHED,UNTRACKED to:SECOND_IP_FAILOVER
SNAT       all  --          anywhere            to:SECOND_IP_FAILOVER is the virtual machine IP (interface venet0)

Any ideas ?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I'm not quite sure if I understand you correctly, but maybe source based routing is what you want?

Basically you do the following:

ip rule add from table 42
ip route add dev eth0 table 42
ip route add default dev eth0 via $gateway table 42

Instead of the table identifier 42 you can pick any number (or symbolic name, if you map them via /etc/iproute2/rt_tables), but some are reserved.

Your configuration is probably a bit different, I don't know your gateway for example and guessed the netmask.

share|improve this answer
you have fully understood my request – Kevin Campion May 17 '10 at 11:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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