IP规划:
Director eth0 DIP: 192.168.2.230
eth0:0 VIP: 192.168.2.231
RS1:eth0:192.168.2.229
lo:0:vip:192.168.2.231
RS2:eth0:192.168.2.228
lo:0:vip:192.168.2.231
1.[root@localhost /]# cd /proc/sys/net/ipv4/conf/
[root@localhost conf]# pwd
/proc/sys/net/ipv4/conf
2.[root@localhost conf]# sysctl -w net.ipv4.conf.eth0.arp_announce=2
net.ipv4.conf.eth0.arp_announce = 2
[root@localhost conf]# sysctl -w net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.all.arp_announce = 2
3.[root@localhost conf]# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
[root@localhost conf]# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
4.配置vip:
[root@localhost conf]# ifconfig lo:0 192.168.2.231 broadcast 192.168.2.231 netmask 255.255.255.255 up
5.添加路由:[root@localhost conf]# route add -host 192.168.2.231 dev lo:0
[root@localhost conf]# route add -host 192.168.2.231 dev eth0:0
6.yum install ipvsadm -y
ipvsadm -C
[root@localhost conf]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.2.231:80 wlc
-> 192.168.2.228:80 Route 1 0 0
-> 192.168.2.229:80 Route 2 0 0
[root@localhost conf]#
7.关闭所有防火墙和selinux,开始测试负载效果
本文出自 “山猫” 博客,谢绝转载!
原文地址:http://cqtangbo.blog.51cto.com/2978612/1752654