Linux_LVS负载均衡_Lvs_dr配置

 internet -----------------  LVS  -------------------------------------------------------  RS1---------------------------------------------RS2
200.168.10.4             eth0:200.168.10.1                             eth0:200.168.10.2                         eth0:200.168.10.3
255.255.255.0             不要网关                                             不要网关                                   不要网关 route del default gw 
不要网关                     vmnet 1                                               vmnet 1                                      vmnet 1
vip = 200.168.10.10                                           开启apache服务                                 开启apache服务

Lvs Server:
ifconfig eth0:0 200.168.10.10 netmask 255.255.255.255  up
route add -host 200.168.10.10 dev eth0:0

ipvs:
ipvsadm -At  200.168.10.10:80 -s rr
ipvsadm -at 200.168.10.10:80  -r 200.168.10.2 -g
ipvsadm -at 200.168.10.10:80  -r 200.168.10.3  -g
ipvsadm

RS1,RS2 客户端配置:
ifconfig lo:0 200.168.10.10 netmask 255.255.255.255  up
route add -host 200.168.10.10 dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce

客户端访问:
200.168.10.10

 

你可能感兴趣的:(internet,default)