Created
January 20, 2014 02:54
-
-
Save kevinbin/8514132 to your computer and use it in GitHub Desktop.
LVS real server start/stop script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#description : start realserver | |
VIP=172.16.6.8 | |
/etc/init.d/functions | |
case "$1" in | |
start) | |
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up | |
/sbin/route add -host $SNS_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 | |
echo "RealServer Start OK" | |
;; | |
stop) | |
/sbin/ifconfig lo:0 down | |
route del $SNS_VIP >/dev/null 2>&1 | |
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 "RealServer Stoped" | |
;; | |
*) | |
echo "Usage: $0 {start|stop}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be:
/sbin/route add -host $VIP dev lo:0
in your case.B.T.W. kevin, do you know what the meaning of SNS in
$SNS_VIP
stands for?