LVS-DR
- arp_ignore 定义接收到APP请求是的响应级别
- 0 (default) reply for any local target IP address,configured on any interface.对任意网卡上的任意IP地址都进行相应
- 1 reply only if the target IP address is local address configured on the incoming interface.只有当目标IP地址是在传入接口上配置的本地地址才相应
- 2 reply only if the target IP address is local address configured on the incoming interface and both with the sender's IP address are part from same subnet on this interface。只有当目标IP地址是在传入接口上配置的本地地址,以及发送者的IP地址都来自同一个子网的接口时,才可以回复
- 3 。。。
- arp_announce 定义将自己的地址向外通告时的通告级别
- 0 默认级别。使用本地的任何端口的地址向外通告。
- 1 try to avoid local addresses that are not in the target's subnet for this interface
- 2 Always user the ber local address for this target.只用本网卡的地址
- lvs-dr配置
#192.168.0.111 DR
#貌似 192.168.0.101 必须放到eth0:0 上 ,放到eth0上就废了,原因待详。可参考http://zhangxugg-163-com.iteye.com/blog/1669810
ifconfig eth0:0 192.168.0.101 netmask 255.255.255.0
#route add -host 192.168.0.101 dev eth0:0 这个有人说要加,感觉不加也没问题,原因待详
#echo 1 > /proc/sys/net/ipv4/ip_forward 用不着这个
ipvsadm -A -t 192.168.0.101:80 -s rr
ipvsadm -a -t 192.168.0.101:80 -r 192.168.0.102:80 -g -w 10
ipvsadm -a -t 192.168.0.101:80 -r 192.168.0.103:80 -g -w 10
#192.168.0.102/103
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
ifconfig lo:0 192.168.0.101 netmask 255.255.255.255
#route add -host 192.168.0.101 dev lo:0 为什么不加这个也一样可以
网友评论