LVS TUN 不能实现,问题出在哪里?

VIP:192.168.5.79
RS1:192.168.5.77
RS2:192.168.5.78
RS3:192.168.200.2

lvs# ifconfig eth1:0 192.168.5.79 netmask 255.255.255.255 192.168.5.79 up
lvs# echo 1 > /proc/sys/net/ipv4/ip_forward
lvs# /sbin/ipvsadm -C
lvs# vi /etc/ipvsadm.rules
/sbin/ipvsadm -A -t 192.168.5.79:80 -s rr
/sbin/ipvsadm -a -t 192.168.5.79:80 -r 192.168.5.77:80 -i
/sbin/ipvsadm -a -t 192.168.5.79:80 -r 192.168.5.78:80 -i
/sbin/ipvsadm -a -t 192.168.5.79:80 -r 192.168.200.2:80 -i

LVS上tun配置:
(172.16.0.0/24 为tun内封装的内网,LVS:172.16.0.1,RS1:172.16.0.2,RS2:172.16.0.3,172.16.0.4):

lvs# ip tunnel add tun0 mode ipip remote 192.168.5.77 local 192.168.5.79 dev eth1
lvs# ifconfig tun0 172.16.0.1 netmask 255.255.255.0 pointopoint 172.16.0.2

lvs# ip tunnel add tun1 mode ipip remote 192.168.5.78 local 192.168.5.79 dev eth1
lvs# ifconfig tun1 172.16.0.1 netmask 255.255.255.0 pointopoint 172.16.0.3

lvs# ip tunnel add tun2 mode ipip remote 192.168.200.2 local 192.168.5.79 dev eth1
lvs# ifconfig tun2 172.16.0.1 netmask 255.255.255.0 pointopoint 172.16.0.4

realserver-1 tun配置:
lvs# ip tunnel add tun0 mode ipip remote 192.168.5.79 local 192.168.5.77 dev eth0
lvs# ifconfig tun0 172.16.0.2 netmask 255.255.255.0 pointopoint 172.16.0.1

lvs# ifconfig tunl1 192.168.5.79 netmask 255.255.255.255 broadcast 192.168.5.79 up
lvs# route add -host 192.168.5.79 dev tunl1

lvs# echo 1 >/proc/sys/net/ipv4/conf/tunl1/arp_ignore
lvs# echo 2 >/proc/sys/net/ipv4/conf/tunl1/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/ip_forward
lvs# sysctl -p

realserver-2 tun配置:
lvs# ip tunnel add tun0 mode ipip remote 192.168.5.79 local 192.168.5.78 dev eth0
lvs# ifconfig tun0 172.16.0.3 netmask 255.255.255.0 pointopoint 172.16.0.1

lvs# ifconfig tunl1 192.168.5.79 netmask 255.255.255.255 broadcast 192.168.5.79 up
lvs# route add -host 192.168.5.79 dev tunl1

lvs# echo 1 >/proc/sys/net/ipv4/conf/tunl1/arp_ignore
lvs# echo 2 >/proc/sys/net/ipv4/conf/tunl1/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/ip_forward
lvs# ysctl -p

realserver-3 tun配置:
lvs# ip tunnel add tun0 mode ipip remote 192.168.5.79 local 192.168.200.2 dev eth0
lvs# ifconfig tun0 172.16.0.4 netmask 255.255.255.0 pointopoint 172.16.0.1

lvs# ifconfig tunl1 192.168.5.79 netmask 255.255.255.255 broadcast 192.168.5.79 up
lvs# route add -host 192.168.5.79 dev tunl1

lvs# echo 1 >/proc/sys/net/ipv4/conf/tunl1/arp_ignore
lvs# echo 2 >/proc/sys/net/ipv4/conf/tunl1/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
lvs# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
lvs# echo 1 > /proc/sys/net/ipv4/ip_forward
lvs# sysctl -p

RS1、RS2、RS3上的apache都起来了。

但还是不能通过http://192.168.5.79/正常访问

lvs# ipvsadm -l -c
IPVS connection entries
pro expire state source virtual destination
TCP 00:52 SYN_RECV 192.168.5.33:3086 192.168.5.79:http 192.168.200.2:http

lvs# ipvsadm
IP Virtual Server version 1.2.0 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.5.79:http sed
-> 192.168.200.2:http Tunnel 1 0 1
-> 192.168.5.78:http Tunnel 1 0 0
-> 192.168.5.77:http Tunnel 1 0 0

请问问题出在哪里啊?谢谢!

Forums:

randomness