LVS DR 模式 王本文 汪春祥 孙培 郑海清

18网段为内网
19网段为外网

route 设置:

ifconfig eth0 192.168.18.254
ifconfig eth0:0 192.168.19.100

开启路由转发功能:
echo 1 > /proc/sys/net/ipv4/ip_forward


分发服务器:
挂载光盘,进入Cluster
rpm -ivh ipvsadm-1.24-10.i386.rpm

ifconfig eth0 192.168.18.2
ifconfig eth0:0 192.168.18.250 netmask 255.255.255.255 broadcast 192.168.18.250 up
route add -host 192.168.18.150 dev eth0:0
/etc/init.d/httpd stop
ipvsadm -A -t 192.168.18.250:80 -s rr
ipvsadm -a -t 192.168.18.250:80 -r 192.168.18.101 -g
ipvsadm -a -t 192.168.18.250:80 -r 192.168.18.102 -g
ipvsadm -ln 查看一下是否成功


apache机器上:
ifconfig eth0 192.168.18.101
ifconfig lo:0 192.168.18.250 netmask 255.255.255.255 broadcast 192.168.18.250 up
route add -host 192.168.18.250 dev lo:0
rooute add default gw 192.168.18.254
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce
重启服务
/etc/init.d/httpd restart

第二台apache机器:
ifconfig eth0 192.168.18.101
ifconfig lo:0 192.168.18.250 netmask 255.255.255.255 broadcast 192.168.18.250 up
route add -host 192.168.18.250 dev lo:0
rooute add default gw 192.168.18.254
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce
重启服务
/etc/init.d/httpd restart


测试:elinks http://192.168.19.250 --dump
101
elinks http://192.168.19.250 --dump
102

你可能感兴趣的:(LVS,DR)