redhatAS4.2 安装集群LVS
2008-11-26 11:00:32 来源:WEB开发网3、配置realserver
[root@localhost ~]# more /etc/init.d/tunl
#!/bin/sh
# ghb in 20060812
# description: Config realserver tunl port and apply arp patch
VIP=192.168.0.100
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo "Tunl port starting"
ifconfig tunl0 $VIP netmask 255.255.255.255 broadcast $VIP up
/sbin/route add -host $VIP dev tunl0
echo "1" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/tunl0/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p
;;
stop)
echo "Tunl port closing"
ifconfig tunl0 down
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
如果有多个Virutal IP,可以使用tunl0:0,tunl0:1...。
此脚本分别在realserver上执行,目的使realserver忽略arp响应,并设定vip.
测式同样按照上面的方法测试
三、配置基于高可用Lvs+heartbeat
1、确定LVS使用DR或/tun模式,请对照上面的配置。
本例使用tun模式
更多精彩
赞助商链接