#####
#/Bin/bash
# Set director for Dr
VIP = 192.168.115.200
Dip = 192.168.115.10
Rip1 = 192.168.115.20
Rip2 = 192.168.115.30
./Etc/init. d/functions
Case "$1" in
Start)
Echo "1">/proc/sys/NET/IPv4/ip_forward
/Sbin/ifconfig eth0: 0 192.168.115.200 broadcast 192.168.115.200 netmask 255.255.255.0 up
/Sbin/route-host 192.168.115.200 Dev eth0: 0
/Sbin/iptables-F
/Sbin/ipvsadm-C
/Sbin/ipvsadm-a-t 192.168.115.200-s rr
/Sbin/ipvsadm-a-t 192.168.115.200-r 192.168.115.20-G
/Sbin/ipvsadm-a-t 192.168.115.200-r 192.168.115.30-G
Touch/var/lock/subsys/ipvsadm. Lock
Echo "s is running OK"
;;
Stop)
Echo "0">/proc/sys/NET/IPv4/ip_forward
/Sbin/ipvsadm-C
/Sbin/ifconfig eth0: 0 down
Rm-fr/var/lock/subsys/ipvsadm. Lock
Echo "s is stopping OK"
;;
Status)
If [-E/var/lock/subsys/ipvsadm. Lock]; then
Echo "s is running"
Else
Echo "s is stopped"
Fi
;;
*)
Echo "sage: $0 {START | stop }"
Esac
This article is from the "frequently used documentation" blog, please be sure to keep this source http://yujianglei.blog.51cto.com/7215578/1561586
LVS Server Load balancer configuration script