标签:linux lvs
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请求响应及通告级别
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及添加特殊路由
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规则
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
标签:linux lvs
原文地址:http://wangyongbin.blog.51cto.com/8964308/1691675