Linux2.6.9-22.EL LVS/DR 问题

Directorserver配置脚本如下:
#!/bin/sh

#Start LVS of Directorserver, John Yang
VIP=192.168.0.100 (virtual ip)

RIP1=192.168.0.197 (realserver)
RIP2=192.168.0.190

GW=192.168.0.1
. /etc/rc.d/init.d/functions
case "$1" in
start)

echo " start LVS of DirectorServer "
echo "0" > /proc/sys/net/ipv4/ip_forward

echo "1" > /proc/sys/net/ipv4/conf/all/send_redirects
echo "1" > /proc/sys/net/ipv4/conf/default/send_redirects
echo "1" > /proc/sys/net/ipv4/conf/eth0/send_redirects

# Set the Virtual IP Address
/sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev eth0:0

# Clear IPVS table
/sbin/ipvsadm -C

#set LVS
/sbin/ipvsadm -A -t $VIP:5222 -s rr
/sbin/ipvsadm -a -t $VIP:5222 -r $RIP1:5222 -g
/sbin/ipvsadm -a -t $VIP:5222 -r $RIP2:5222 -g

#Run LVS
/sbin/ipvsadm

;;
stop)
echo "close LVS Directorserver"
/sbin/ipvsadm -C

;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

realserver配置脚本如下:
#!/bin/bash
#description : start realserver
#create in 20060812 by John Yang

VIP=192.168.0.100

echo "0" > /proc/sys/net/ipv4/ip_forward
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0

/sbin/ifconfig lo:0

/bin/netstat -rn

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 "0" > /proc/sys/net/ipv4/conf/lo/rp_filter

/sbin/sysctl -p

现在的问题是,我用的Linux2.6.9-22.EL的内核,realserver已经做了arp_ignore,arp_announce,rp_filter, director server也设置了send_redirects,当客户端用tcp连接虚拟IP的时候,用/sbin/ipvsadmin -lnc 看到应经转到realserver上了,
可是realserver确实没收到tcp包,请问下,是不是还是realserver arp的问题,应该如何处理?谢谢!

Forums:

Note for VS-DR (and VS-Tun), the services on the real-servers are listening to the VIP. You can have the service listening to the RIP as well, but the LVS needs the service to be listening to the VIP. This is not an issue with services like telnet which listen to all local IPs (ie 0.0.0.0), but httpd is set up to listen to only the IPs that you tell it.

我也不知是不是要监听DR的原因

还有个不太明确的问题是:为什么在realserver上监听真实ip,(比如192.168.0.197:5222),realserver没收到数据包,而改成监听0.0.0.0:5222,问题就解决了呢?请帮忙解释下,谢谢!

你说realserver确实没收到tcp包,那么客户端有没有响应呢?

谢谢!根据你上边说的,我测试了,问题解决了,非常感谢。有关这些集群的资料,可以提供个完整的资料吗?链接也行,谢谢。

我做了好久没成功~~

randomness