浏览 5158 次
锁定老帖子 主题:lvs配置(centos5 测试通过)
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-12-25
vi /etc/init.d/lvsDR #!/bin/sh #create in 20060812 by ghb # description: start LVS of Directorserver VIP=192.168.1.88 RIP1=192.168.1.188 RIP2=192.168.1.99 #RIPn=192.168.0.128~254 GW=192.168.1.1 . /etc/rc.d/init.d/functions case $1 in start) echo "start LVS of DirectorServer" #Set the Virtual IP Address /sbin/ifconfig eth0:1 $VIP broadcast $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev eth0:1 #Clear IPVS Table /sbin/ipvsadm -C #Set Lvs /sbin/ipvsadm -A -t $VIP:80 -s rr /sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g /sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g #Run Lvs /sbin/ipvsadm ;; stop) echo "close LVS Directorserver" /sbin/ifconfig eth0:1 down /sbin/ipvsadm -C ;; *) echo "Usage: $0" {start|stop} exit 1 esac RealServer vi /etc/init.d/lvsDR #cription:start realserver #chkconfig 235 26 26 VIP=192.168.1.88 /etc/rc.d/init.d/functions case "$1" in start) echo " start LVS of REALServer" /sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev lo:0 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 lo:0 down echo "close LVS Directorserver" 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 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |