[lvs-users] Natting Issue

Enno Gröper enno+lvs at groeper-berlin.de
Thu Mar 29 12:55:12 BST 2012


Am 29.03.2012 12:54, schrieb Reet Vyas:
> thanks for replying. my network is as follows:
> lvs has two nic etho and eth1 and my local is connect to eth1 and
> external to eth0
> eth0 : has external ip cause we are working for client and eth1 has 
> n/w.
> etho:122:166:133.xxx eth0:1 :122.166.133. xxx
> eth 1:192.168.3.xxx eth1:1 192.168.3.xxx
Okay. And how are you testing your setup? Which IP does the client have?

> As you said no iptable rule why so
Why do you think, you need an iptable rule?
LVS-NAT is explained in [1]:
> When a user accesses the service provided by the server cluster, the
> request packet destined for virtual IP address (the external IP
> address for the load balancer) arrives at the load balancer. The load
> balancer examines the packet's destination address and port number.
> If they are matched for a virtual server service according to the
> virtual server rule table, a real server is chosen from the cluster
> by a scheduling algorithm, and the connection is added into the hash
> table which record the established connection. Then, the destination
> address and the port of the packet are rewritten to those of the
> chosen server, and the packet is forwarded to the server. When the
> incoming packet belongs to this connection and the chosen server can
> be found in the hash table, the packet will be rewritten and
> forwarded to the chosen server. When the reply packets come back, the
> load balancer rewrites the source address and port of the packets to
> those of the virtual service. After the connection terminates or
> timeouts, the connection record will be removed in the hash table.
As you can see, all packet rewriting is done by LVS itself without the
need of iptables.
All you have to do is make sure the real servers are sending their
replies through the LVS node. That's why we make it their default gateway.
Of course I don't know if you have any iptables rules already in place,
that make your setup stop working.

> and why gateway as eth1 instead of eth1:1 .it is mentioned in
> documentation use VIP eth1:1 as gateway for real servers. pls m
> confused .Can u pls explain??
Which part of the documentation exactly? Do you have a link?
I see a definition problem here.
VIP could stand for
* the IP the LVS (Linux VIRTUAL Server) is presenting to the outside
world (the IP of the big virtual Server, that in reality consists of
your loadbalancer and some real nodes)
* an additional flexible IP on the LVS node (additional to the "real" IP
of the network interface (eth0 vs. eth0:1) )

I was talking about the latter. For LVS to work it doesn't matter which
IP of your LVS node you use (eth1 or eth1:1), as long as you configure
it in a consistent way.
If you only have a single LVS node (no failover cluster), virtual
(additional) IPs on your LVS node shouldn't be necessary.
You can use the IPs the LVS node already has on each interface.
But it shouldn't be a problem to use the VIPs.

[1] http://www.linuxvirtualserver.org/VS-NAT.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://lists.graemef.net/pipermail/lvs-users/attachments/20120329/e39b293b/attachment-0001.bin 

More information about the lvs-users mailing list