1.測試環境
操做系統:CentOS6.5
director:
eth0,DIP:192.168.220.131
eth0:0,VIP:192.168.220.132
realserver1:
eth0,RIP1:192.168.220.111
lo:0,VIP:192.168.220.132
realserve2:
eth0,RIP2:192.168.220.112
lo:0,VIP:192.168.220.132
2.realserver配置
1).設置arp請求響應及通告級別
bash
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
2).配置VIP及添加特殊路由
ide
ifconfig lo:0 192.168.220.132 netmask 255.255.255.255 broadcast 192.168.220.132 up route add -host 192.168.220.132 dev lo:0
3.director配置
1).安裝ipvsadm
測試
yum install ipvsadm -y
2).配置VIP
操作系統
ifconfig eth0:0 192.168.220.132 netmask 255.255.255.255 broadcast 192.168.220.132 up
3).添加ipvs規則
server
ipvsadm -A -t 192.168.220.132:80 -s wrr #添加集羣服務 ipvsadm -a -t 192.168.220.132:80 -r 192.168.220.111 -g -w 2 #添加realserver ipvsadm -a -t 192.168.220.132:80 -r 192.168.220.112 -g -w 3