Three Modes and their advantages and disadvantages of LVS, and three modes of lvs
LVS Classification
LVS-DR: Direct routing, which is the most common method. All ctor and RealServer are in the same physical network (switch) and have only one Nic.
LVS-NAT: address translation, packet back and forth through NAT translation, so Director Server (that is, LVS Server) will become a system bottleneck. In NAT mode, two IP addresses of different CIDR blocks are required. One IP address is used to receive external request services, which is generally an Internet ip address. This IP address is called a VIP address. One IP address is the same as the other IP address segment of the realserver, communication is called DIP. The gateway address of the backend realserver must point to DIP. At the same time, you must enable the packet forwarding function of the Linux kernel.
LVS-TUN: Tunnel, similar to LVS/TUN and LVS/DR. Only an IP address is added to the packet. The entire process is one more packet encapsulation/unblocking process than the LVS/DR mode. LVS/DR only supports local networks, while LVS/TUN supports cross-data centers.
LVS has the following advantages: it has a strong load carrying capability. It works on Layer 4 of the network and has no traffic. This feature determines that it has the strongest performance in the load balancing software, low memory cpu consumption. Its configuration is very simple and generally does not need to be configured, which reduces the chance of configuration errors. It has no traffic, that is, it only distributes requests, which ensures that io performance will not be affected by traffic. At the same time, it has a wide range of applications. It can load balance almost all services (http, database, etc ..)
LVS disadvantages: Static and Dynamic separation is not allowed. In addition, many websites now have such requirements, and all the advantages of Nginx/Haproxy + keeplived exist. If the website application is large, the implementation of LVS/DR + Keepalived is complicated. Nginx/HAProxy + Keepalived is much simpler.