lvs-dr

lvs server  ip  192.168.1.10
rserver1   192.168.1.11
rserver2   192.168.1.12

lvs-conf
VIP=192.168.1.200
RIP1=192.168.1.11
RIP2=192.168.1.12
GW=192.168.1.1
/sbin/ifconfig eth0:1  $VIP broadcast  $VIP  netmask  255.255.255.255 up
/sbin/route add -host $VIP dev eth0:1
/sbin/ipvsadm -C
/sbin/ipvsadm -A -t $VIP:80 -s rr
/sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g
/sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g
/sbin/ipvsadm
/etc/init.d/iptables stop


rserver1-conf

VIP=192.168.1.200
/sbin/ifconfig lo:0 $VIP  broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
/etc/init.d/iptables stop
/etc/init.d/httpd start




访问 ip   192.168.1.200



你可能感兴趣的:(lvs-dr)