DIP | VIP | RIP | |
Client | 192.169.41.139 | ||
LVS | 192.168.41.134 | 192.169.41.10 | |
RS1 | 192.168.41.135 | ||
RS2 | 192.168.41.138 |
要求:
node4为客户端,node2为LVS,node3和node4为RS。
1.配置DNS解析(我这里使用本地解析)
192.168.41.134 www.ykkry.com
2.配置LVS虚拟IP(VIP)
ifconfig eth1:11 192.168.41.10 netmask 255.255.255.0 up
3.手工执行配置添加LVS服务并增加两台RS
ipvsadm -A -t 192.168.41.10:80 -s wrr
ipvsadm -a -t 192.168.41.10:80 -r 192.168.41.135:80 -g
ipvsadm -a -t 192.168.41.10:80 -r 192.168.41.138:80 -g
4.查看之前配置
ipvsadm -L -n
5.手工在RS端绑定VIP
ifconfig lo:11 192.168.41.10 netmask 255.255.255.255 up
添加本机访问VIP的路由
route add -host 192.168.41.10 dev lo
6.
手工在 RS 端抑制 ARP 响应
每台 real server 端执行
调整内核参数,关闭 arp 响应
[root@RS1 ~] # echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore[root@RS1 ~] # echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce[root@RS1 ~] # echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore[root@RS1 ~] # echo "2" > /proc/sys/net/ipv4/conf
7.最后测试