系统:centos 6.5 ipvs版本1.2.1
地址:dr:192.168.137.9 rs:192.168.137.12,192.168.137.13
dr配置
ifcofnig eth0:0 192.168.137.100 up 配置vip地址
route add -host 192.168.137.100 dev eth0:0 配置转发地址
echo 1 > /proc/sys/net/ipv4/ip_forward 转发接口
ipvsadm -A -t 192.168.137.100:80 -s rr 配置ipvs vip服务地址 轮循方便进行查看是否配置正确
ipvsadm -a -t 192.168.137.100:80 -r 192.168.137.12:80 增加集群地址
ipvsadm -a -t 192.168.137.100:80 -r 192.168.137.13:80
ipvsadm -Ln 查看地址
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.137.100:80 rr
-> 192.168.137.12:80 Route 1 0 0
-> 192.168.137.13:80 Route 1 0 0
rs 2 配置 配置1跟rs2相同
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore 哪个口进来从哪个口出去
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce 通告地址、查询那个地址告诉客户端那个地址
echo "1" >/proc/sys/net/ipv4/conf/eth0/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/eth0/arp_announce
ifconfig lo:0 192.168.137.100 netmask 255.255.255.255 broadcast 192.168.137.100
route add -host 192.168.137.100 dev lo:0 增加路由
echo ss2 > /var/www/html/index.html 写入一条网站页面以便进行测试
然后打开网页测试
本文出自 “xiong” 博客,请务必保留此出处http://xiong51.blog.51cto.com/5239058/1828170
原文地址:http://xiong51.blog.51cto.com/5239058/1828170