首页 > 代码库 > lvs dr
lvs dr
CIP:192.168.56.1
DIP:192.168.56.101
VIP:192.168.56.110
RIP:192.168.56.102 192.168.56.103
设置Director
1:配置VIP,ifconfig eth0:0 192.168.56.110 netmask 255.255.255.255 broadcast 192.168.56.110
2 : 同样要关闭防火墙 servcie iptables stop
3 : 配置IPVS
ipvsadm -A -t 192.168.56.110:80 -s rr
ipvsadm -a -t 192.168.56.110:80 -r 192.168.56.102 -g
ipvsadm -a -t 192.168.56.110:80 -r 192.168.56.103 -g
设置 Real Server
1:配置VIP与路由 ifconfig lo:0 192.168.56.110 netmask 255.255.255.255 broadcast 192.168.56.110
route add -host 192.168.56.110 dev lo:0
2:关闭ARP 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
关键点
1:Director 上需要配置DIP、VIP
2:Real Server 需要关闭ARP协议 同时 要配置VIP 以及相应的LOOKBACK路由
lvs dr