拓扑图
1. ARP广播会产生的问题(以上图为例)
当客户端发起访问VIP 对应的域名的请求时,根据网络通信原理会产生ARP 广播,因为负载均衡器和真实的服务器在同一网络并且VIP设置在集群中的每个节点上,此时集群内的真实服务器会尝试回答来自客户端计算机的查找VIP的ARP广播,这就会产生问题,大家都说我是"VIP"。
2. 为了达到负载均衡的目的,必须想法办让真实服务器忽略来自客户端计算机的ARP广播请求
方法一:在真实服务器上设置lo 忽略ARP 广播
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
如果VIP 是设置在真实服务器的非lo接口,那么做如下设置
net.ipv4.conf.ethN.arp_ignore = 1
net.ipv4.conf.ethN.arp_announce = 2 (N 为网卡接口)
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
方法二: 隐藏真实服务器上VIP 的网络接口
#to activate the hidden feature
echo 1 > /proc/sys/net/ipv4/conf/all/hidden
#to make lo:0 not arp, put lo here
echo 1 > /proc/sys/net/ipv4/conf//hidden
二.LVS arp how-to
值得注意的一句话:
On the realservers the VIP will still be on lo (as for the hidden method). If the reply packets to the client are routed through eth0, then the arp announcements/requests are made through eth0 and you will apply the arp_ignore/arp_announce sysctls to eth0, not to lo (you cannot use arp_ignore/arp_announce on lo).
官方的没有看完全明白!!!
阅读(7895) | 评论(0) | 转发(0) |