二、load balance上面执行下面的脚本
[root@Load_Balancer ~]# cat lvs02.sh
#!/bin/bash
#set ip_forward OFF for lvs-dr director (1 on, 0 off)
#(there is no forwarding in the conventional sense for LVS-DR)
cat /proc/sys/net/ipv4/ip_forward
echo "0" >/proc/sys/net/ipv4/ip_forward
#director is not gw for realservers: leave icmp redirects on
echo 'setting icmp redirects (1 on, 0 off) '
echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects
cat /proc/sys/net/ipv4/conf/all/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects
cat /proc/sys/net/ipv4/conf/default/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects
cat /proc/sys/net/ipv4/conf/eth0/send_redirects
#add ethernet device and routing for VIP 192.168.0.100
/sbin/ifconfig eth0:0 192.168.0.100
#listing routing info for VIP 192.168.0.100
/bin/netstat -rn
#clear ipvsadm table
/sbin/ipvsadm -C
#installing LVS services with ipvsadm
#add telnet to VIP with round robin scheduling
/sbin/ipvsadm -A -t 192.168.0.100:80 -s rr
#forward telnet to realserver using direct routing with weight 1
/sbin/ipvsadm -a -t 192.168.0.100:80 -r 192.168.0.10:80 -g -w 1
#forward telnet to realserver using direct routing with weight 1
#/sbin/ipvsadm -a -t 192.168.0.100:80 -r 192.168.0.36:80 -g -w 1