Four working modes of LVS and comparison of their advantages and disadvantages

Source: Internet
Author: User

1, Vs/nat (address translation Implementation of the virtual server)
After the scheduler receives the request from the client, according to the scheduling algorithm, the client's request is sent to the server, the server finishes processing the request, looks at the default route (the server's default gateway needs to be set to the scheduler in NAT mode), and LB receives the response packet, modifies the source IP, The response data is then sent to the client.

Principle Details:
<1> the client requests data and sends the data to LB;
&LT;2&GT;LB accepts the client's request, according to the dispatch algorithm, the client's request packet's source IP and the port, modifies the server, then saves this connection information in the hash table;
<3> packets are processed by the server, the default gateway for the server is lb, and then the response data is sent to LB;
<4> after receiving the response package from the server, change the source IP to lb itself according to the connection information in the hash table and send the data to the client.
2, Vs/tun (using IP tunneling technology to implement virtual server)
Compared with NAT technology, because the request and the response need to rewrite the address through LB, then when the client requests more and more, the processing ability of LB will become a bottleneck. In order to solve this problem, lb through the IP tunnel, the client's request through the IP tunnel, sent to the real server, the server after processing the request, the response request to the IP to the LB IP, and then sent the response message to the client.

Principle Details:
<1> customer request packet, the target address VIP (the IP address of LB) is sent to LB;
&LT;2&GT;LB receives the customer request package, carries on the IP tunnel encapsulation, in the original Baotou plus the IP tunnel header, then sends to the server;
<3> server According to the IP Tunnel header information (at this time, another logical stealth tunnel, only the LB and the server understand) received the request package, and then unlock the IP tunnel header information, get the customer's request package and response processing;
<4> response after processing, the server uses its own public network line, the response data packages to the client, the source IP address or VIP address.
3, VS/DR (using direct routing technology to implement virtual server)
The DR mode is to send the request to the real server by overwriting the destination MAC address of the request message and the server sends the response message directly to the client.

Principle Details:
<1> forwarding by modifying the destination MAC address of the packet on dispatcher lb, note that the source address is still CIP and the destination address is still a VIP address;
<2> the requested message passes through the scheduler, and the server responds to the processed message without having to go through the scheduler lb, so it is efficient to use high concurrent traffic (and NAT mode ratio)
<3> because Dr Mode is forwarded through the MAC address rewriting mechanism, all RS nodes and scheduler lb can only be in one LAN
The <4> server host needs to bind the VIP address on the LO interface and need to configure ARP suppression.
The default gateway for the <5> server node does not need to be configured as LB, but is directly configured as a gateway for superior routing, allowing the server to be directly out of the network.
<6> because the dispatcher of Dr Mode only makes a rewrite of the MAC address, the scheduler lb cannot overwrite the target port, then the server will have to use the same port as the VIP to provide services.
4, Vs/fullnat
Compared to Nat LAN, Fullnat is not so limited, it is limited in the intranet. It is more convenient for operation and maintenance.
5, the advantages and disadvantages of Vs/nat
<1> Advantages:
No requirements for the backend operating system;
Only one IP address configuration is required on the dispatcher, and the server group can use a private IP address;
Support port mapping;
<2> Disadvantages:
Request and response need to pass lb, scalability is limited (generally can connect 10 sets of servers)
Server and LB are required in the same LAN;
The default gateway for the server needs to be set to lb;
6, the advantages and disadvantages of Vs/tun
<1> Advantages:
No need to dispatch response message, strong load capacity;
The server and scheduler may not be in the same VLAN;
Support wide area load balancing;
<2> Disadvantages:
All servers must support "IP Tunneling" protocol, install kernel module, install complex;
The cost of establishing the IP tunnel is large;
The server needs Unicom extranet, the risk is larger;
Port mappings are not supported;
7, the advantages and disadvantages of VS/DR
<1> Advantages:
Compared with Tun, there is no cost of IP tunneling, and the performance is higher.
<2> Disadvantages:
Requires that the LB and server have a network card connected to the same physical network segment;
Port mappings are not supported;
8, the use of the scene
Vs/nat: Small concurrent experimental application, MySQL cluster;
Vs/tun: WAN load;
VS/DR: Public Way;
Vs/fullnat: less money than people;

Reference: http://www.it165.net/admin/html/201401/2248.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.