lvs in the DR mode, explained

CIP is the IP address of the client |
- |
DIR for the scheduler |
VIP virtual IP address |
RIP for the real server IP address |

The CIP is assumed mac A1, ip is B1; DIR is only one physical card mac A2, IP is B2; RIP is the mac A3, IP is B3.

All VIP as follows: 100

  1. Will be sent before the client requests arp broadcast request mac address of the VIP address corresponding to it because all the real servers need to configure the VIP, the DIR also need to configure the VIP (must be configured) , but in order to make a request sent to the dir, we to set up the response arp request (to suppress arp query and response real server) does not allow for VIP real server.
  2. dir response to client requests received

Data Frame:

src mac mac src ip src port ip port
A1 A2 B1 10023 100 80
  1. DIR select a real server based on the load balancing algorithm, the RIP as a target of mac mac address

Data Frame:

src mac mac src ip src port ip port
A2 A3 B1 10023 100 80

In this first package, source IP address, source port have not changed, the destination IP address is always VIP, but the mac address into a real server mac address

  1. RIP receives the packet on the LAN, IP and view the target after unpacking the machine matches, matching the processing of this message and respond by routing
src mac mac src ip src port ip port
A3 A1 100 80 B1 10023

important point:

- dir仅处理入站请求,回复数据包是由真实服务器直接通过路由发往客户端
- 真实服务器的网关不能只想dir,我们有时可能想,dir就是起一个nat的作用,但是那只是,接收请求连接的时候,我们回复请求连接的时候是由真实服务器直接回复客户端的。网关指向网络环境使用的网关即可
- 真实服务器配置VIP,要配置在loopback回环口上,因为具体配置时要针对该接口进行arp抑制,如果配置到真实接口上,会影响其它的网络正常通信

Reference article

LVS | LVS load balancing work explaining the principle of (DR mode)

Guess you like

Origin www.cnblogs.com/joinbestgo/p/10936377.html