[lvs-users] LVS with NAT - Help needed

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [lvs-users] LVS with NAT - Help needed
From: "Fernando Gomes" <fernando.gomes@xxxxxxxxx>
Date: Mon, 17 Sep 2007 12:25:23 +0100
I am using the following setup using NAT in the directors, and it is
working well (no performance tests made yet). In the final setup I
intend to have the loabalancers with dual NICs one for the
network and other to the network, for now the test was made
with 192.168.0.X as an alias on eth0. The internal VIP (IVIP) was
defined as the default gateway for the realservers, and also the
iptables on the LoadBalancer was used:


iptables -t nat -A POSTROUTING -j MASQUERADE -s



                  | Internet



              |Router |




       |  VIP:  |                        |

       |  IVIP: |                        |

       |                     |                        |

       |        |           |

       |        |           |

 ______|______        _______|_____                   |

|LoadBalancer1|      |LoadBalancer2|                  |

|_____________|      |_____________|                  |




            |                                |

            |dgw:              |dgw:

            |                   |

      ______|______                    ______|______

     |RealServer1  |                  |RealServer2  |

     |_____________|                  |_____________|


I have one problem that I don't know if it can be solved, so I'm asking
your opinion. I'm using also OpenVZ on all servers (including the
Loadbalancers), but LVS is installed on the Hardware Node, not using
OpenVZ at all. The problem I have is if I put a VE (virtual environment
~= virtual machine) on the standby loadbalancer and run on it a
realserver. When the director sends a client request to the realserver
running on the standby loadbalancer (for example with Loadbalancer1
active and realserver with IP running on a VE on
Loadbalancer2) the request fails. Using tcpdump I found that the
connection request arrives to the realserver (loadbalancer2 node in that
case), but it answers it directly to the router (using router MAC
address), so there is no translation done by the loadbalancer1 as it
should. The comparison made with tcpdump on realserver1 or realserver2,
all is equal except the destination MAC address - when the reply is from
realserver1 or 2, the destination IP is but the destination
MAC address is of the loadbalancer1 NIC, and when the reply is from the
realserver running on a VE on Loadbalancer2, the destination IP is also but the destination MAC address is the Router MAC address.

Is there any way to turn around this problem? I suppose Loadbalancer2
will always have the Router MAC address in the ARP table, since it is
pinging it periodically to test the network. I tried to remove the
default gateway entry on loadbalancer2 when it is in standby, replacing
it for the internal VIP (, but it also didn't do the


<Prev in Thread] Current Thread [Next in Thread>