首页 > 代码库 > lvs_realserver
lvs_realserver
realserver端脚本就可以完成:
[root@RSV2 ~]# cat lvs_rs.sh
#!/bin/bash
# Date: 2015.10.1
# Description: lvs之realserver 配置
# Version: 0.0.1
# By the way : echo 1 > /proc/sys/net/ipv4/ip_forward
VIP=192.168.1.103 #client use to request
NETMASK=255.255.255.255 #hidden in the network
IFACE=lo
case $1 in
start)
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce
#不向外广播,外面来找也不能让找到
ifconfig "$IFACE":0 "$VIP" netmask $NETMASK broadcast $VIP up
route add -host $VIP dev lo:0
;;
stop)
ifconfig "$IFACE":0 down
echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 0 > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce
echo 0 > /proc/sys/net/ipv4/conf/lo/arp_announce
;;
*)
echo "usage `basename` $0 start|stop"
exit 1
;;
esac
本文出自 “Linux” 博客,请务必保留此出处http://ridingonhorse.blog.51cto.com/11265295/1872466
lvs_realserver