Brief configuration of LVS three (Lvs-dr,lvs-nat,lvs-tun) modes
What LVS is:
Http://www.linuxvirtualserver.org/VS-NAT.html
Http://www.linuxvirtualserver.org/VS-IPTunneling.html
Http://www.linuxvirtualserver.org/VS-DRouting.html
The first is to install the IPVSADM management program
Download: http://www.linuxvirtualserver.org/software/
Note the kernel version that corresponds to itself
Ipvsadm-1.24.tar.gz
Tar zxvf ipvsadm-1.24.tar.gz
CD ipvsadm-1.24
Make
Make install
One, NAT mode (Vs-nat)
Principle: It is the destination address of the IP header of the packet sent by the client, in the load balancer replaced by one of the RS IP address, and the RS to deal with, the RS processing after the completion of the data to the load balancer, load balancer and then the original IP address of the packet to its own IP, To change the destination address to the client IP address, both incoming and outgoing traffic must go through the load balancer (that is, the destination IP and MAC addresses that are modified to come and go)
Advantage: The physical servers in the cluster can use any TCP/IP-enabled operating system, only the load balancer requires a legitimate IP address.
Cons: Limited scalability. When the server node (normal PC server) data grows to 20 or more, the load balancer becomes the bottleneck for the entire system, because all the request packets and reply packets need to be regenerated by the load balancer. If the average TCP packet length is 536 bytes, the average packet regeneration delay time is approximately 60US (calculated on the Pentium processor, with a faster processor will make this delay time shorter), the maximum allowable capacity of the load balancer is 8.93m/s, Assuming that the platform allowable capacity of each physical server is 400k/s, the equalizer can be calculated for 22 physical servers.
Second, direct routing mode (VS-DR)
Principle: Both the Load balancer and the RS use the same IP service but only the Dr responds to the ARP request, and all RS is silent on its own ARP request for this IP. That is, the gateway directs all requests for this service IP to the DR, and the Dr receives the packet and finds the corresponding RS according to the scheduling algorithm. , change the destination MAC address to Rs mac (because IP is consistent) and distribute the request to this RS then RS receives this packet, after processing completes, because the IP is consistent, can return the data directly to the customer, is equal to receive this packet directly from the client is identical, Returned directly to the client after processing because the load balancer is changing the two-layer header, the load balancer and RS must be in a broadcast domain or simply understood to be on the same switch
Pros: Like Tun (tunnel mode), the load balancer is just a distribution request, and the reply packet is returned to the client through a separate routing method. Compared to Vs-tun, this implementation of VS-DR does not require a tunneling structure, so most operating systems can be used as physical servers.
Disadvantage: (Can not say the shortcomings, can only be said to be insufficient) requires the network card of the load balancer with the physical network card on a physical segment.
Third, IP tunnel mode (Vs-tun)
Principle: The first thing to know is that the request packet for most Internet services on the Internet is very short, and the response packet is usually very large. Then the tunnel mode is, the packet sent to the client, encapsulating a new IP header tag (destination IP only) sent to Rs,rs, first to unpack the packet, restore the packet, processed, directly back to the client, do not need to go through the load balancer attention, Since RS needs to restore the packets sent by the load balancer, it must support the Iptunnel protocol so, in the kernel of RS, the option to support Iptunnel must be compiled
Advantage: The load balancer is only responsible for distributing the request packet to the backend node server, and RS sends the reply packet directly to the user. So, by reducing the load balancer's massive data flow, the load balancer is no longer a system bottleneck and can handle a huge amount of requests, a load balancer that can be distributed to many Rs. and running on the public network can be distributed in different regions.
Cons: The tunnel mode RS node requires a legitimate IP, which requires all servers to support the "IP Tunneling" (IP Encapsulation) protocol, and the server may only be limited to some Linux systems.
Reference: http://blog.sina.com.cn/s/blog_3f4791a60101gbwi.html
Http://www.uml.org.cn/zjjs/201211124.asp
http://blog.csdn.net/huaishu/article/details/17071469
This article from "Yun Weibang" blog, declined reprint!
LVS Three modes of difference