NAT模型需要RealServer gateway设定为,DR模式需要执行 RealServer.sh。需要先安装network-tools.
#!/bin/bash#description : start realserver VIP=192.168.8.188host=‘/bin/hostname‘case "$1" in start) echo " start LVS of REALServer" /sbin/ifconfig lo down /sbin/ifconfig lo up 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 /sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev lo:0 ;; stop) /sbin/ifconfig lo:0 down ;; status) islothere=‘/sbin/ifconfig lo:0 | grep $VIP‘ isrothere=‘netstat -rn | grep "lo" | grep $VIP‘ if[! "$islothere" -o ! "$isrothere"];then echo "LVS-DR real server stoped" else echo "LVS-DR Running" fi ;; *) echo "$0: Usage: $0 {start|status|stop}" exit 1 ;;esac
时间: 2024-11-05 04:04:25