Dr mode configuration script in lvs

  
        

1 dr mode introduction

1.1 lvs installation

1.2 lvs mode

lvs has three modes dr, nat, tun. Here we introduce the dr mode.

1.3 dr features
1) Load Balancer and all Real Servers are on the same LAN segment. 2) After the Real Server processes the request, it returns directly to the user, and does not need to be returned through the scheduler.

1.4 Processing Procedures
Request Process: Customer => vip => RealServer. Response process: RealServer => customer.

2 Configuration Environment

2.1 LoadBalancer
DIP: 192.168.142.133(eth0). VIP: 192.168.142.211 (eth0:1).

2.2 RealServer1
DIP: 192.168.142.130 (eth0).

2.3 RealServer2
DIP: 192.168.142.131(eth0).

3 Configuration Script

3.1 Configuring LoadBalancer
# mkdir -p /usr/local/lvs# cd /usr/local/lvs# vi lvs-dr.sh


< Pre>#!/bin/sh# lvs-dr.sh## lvs dr mode LVS server script## # vip and rip must be on the same network segment. VS/DR sends the requested packet to the realserver by rewriting the MAC address of the request packet, # does not change the source and destination IP addresses of the packet, and then the realserver directly replies to the client, no longer passes through the LVS scheduler, thus greatly Reduce the burden of LVS. # set the vip and portVIP=192.168.142.211VPORT1=80# set the rip and port# webRIP1=192.168.142.130RIP2=192.168.142.131# portRPORT1=80Usage (){ echo "Usage:`basename $0` (start

Copyright © Windows knowledge All Rights Reserved