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.[[email protected] /]# cd /proc/sys/net/ipv4/conf/
[[email protected] conf]# pwd
/proc/sys/net/ipv4/conf
2.[[email protected] conf]# sysctl -w net.ipv4.conf.eth0.arp_announce=2
net.ipv4.conf.eth0.arp_announce = 2
[[email protected] conf]# sysctl -w net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.all.arp_announce = 2
3.[[email protected] conf]# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
[[email protected] conf]# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
4.配置vip:
[[email protected] conf]# ifconfig lo:0 192.168.2.231 broadcast 192.168.2.231 netmask 255.255.255.255 up
5.添加路由:[[email protected] conf]# route add -host 192.168.2.231 dev lo:0
[[email protected] conf]# route add -host 192.168.2.231 dev eth0:0
6.yum install ipvsadm -y
ipvsadm -C
[[email protected] 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
[[email protected] conf]#
7.关闭所有防火墙和selinux,开始测试负载效果