#
# description: start LVS of Director Server
# created in 2009-04-29 by Dika.Ye
VIP=10.0.10.60
VIP2=10.0.10.61
RIP1=10.0.10.207
RIP2=10.0.10.208
RIP3=10.0.10.210
RIP4=10.0.10.240
#RIP3=10.0.10.x
GW=10.0.10.254
SER_PORT=80
SMTP_PORT=25
HTTP_CON_INTERFACE=eth0:6721
SMTP_CON_INTERFACE=eth0:6725
ATTEM=wrr
# Source function library.
. /etc/rc.d/init.d/functions
case $1 in
start)
echo -n "Starting LVS of Director Server "
#Set the Virtual IP Address
/sbin/ifconfig $HTTP_CON_INTERFACE $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/ifconfig $SMTP_CON_INTERFACE $VIP2 broadcast $VIP2 netmask 255.255.255.255 up
/sbin/route add -host $VIP dev $HTTP_CON_INTERFACE
/sbin/route add -host $VIP2 dev $SMTP_CON_INTERFACE
#Clear IPVS Table
/sbin/ipvsadm -C
#Set Lvs for http
/sbin/ipvsadm -A -t $VIP:$SER_PORT -s $ATTEM
/sbin/ipvsadm -a -t $VIP:$SER_PORT -r $RIP1:$SER_PORT -g
#Set LVS for smtp
/sbin/ipvsadm -A -t $VIP2:$SMTP_PORT -s $ATTEM
/sbin/ipvsadm -a -t $VIP2:$SMTP_PORT -r $RIP3:$SMTP_PORT -g
/sbin/ipvsadm -a -t $VIP2:$SMTP_PORT -r $RIP4:$SMTP_PORT -g
#Run Lvs
/sbin/ipvsadm
echo "."
;;
stop)
echo -n "Close LVS Director Server "
/sbin/ifconfig $HTTP_CON_INTERFACE down
/sbin/ifconfig $SMTP_CON_INTERFACE down
/sbin/ipvsadm -C
echo "."
;;
status)
echo "IPVSADM list"
ipvsadm -Ln
;;
*)
echo "Usage: $0" {start|stop}
exit 1
esac
# decription:start realserver
# chkconfig 235 26 26
VIP=10.0.10.60
VIP2=10.0.10.61
RIP1=10.0.10.207
RIP2=10.0.10.208
RIP3=10.0.10.210
RIP4=10.0.10.240
#RIP3=10.0.10.x
GW=10.0.10.254
SER_PORT=80
SMTP_PORT=25
HTTP_CON_INTERFACE=lo:6721
SMTP_CON_INTERFACE=lo:6725
ATTEM=wrr
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig $HTTP_CON_INTERFACE $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev $HTTP_CON_INTERFACE
echo "0" > /proc/sys/net/ipv4/ip_forward
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
;;
stop)
/sbin/ifconfig $HTTP_CON_INTERFACE down
echo " stop LVS service"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
# decription:start realserver
# chkconfig 235 26 26
VIP=10.0.10.60
VIP2=10.0.10.61
RIP1=10.0.10.207
RIP2=10.0.10.208
RIP3=10.0.10.210
RIP4=10.0.10.240
#RIP3=10.0.10.x
GW=10.0.10.254
SER_PORT=80
SMTP_PORT=25
HTTP_CON_INTERFACE=lo:6721
SMTP_CON_INTERFACE=lo:6725
ATTEM=wrr
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig $SMTP_CON_INTERFACE $VIP2 broadcast $VIP2 netmask 255.255.255.255 up
/sbin/route add -host $VIP2 dev $SMTP_CON_INTERFACE
echo "0" > /proc/sys/net/ipv4/ip_forward
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
;;
stop)
/sbin/ifconfig $SMTP_CON_INTERFACE down
echo " stop LVS service"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac