lvs realserver转发 源IP不是VIP的问题

vip:192.168.1.242

rip:192.168.1.24

[root@localhost ~]# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
UDP 192.168.1.242:9660 wlc persistent 10
-> 192.168.1.24:9660 Route 1 0 0

[root@localhost ~]# ipvsadm -lcn
IPVS connection entries
pro expire state source virtual destination
UDP 00:00 UDP 192.168.2.103:0 192.168.1.242:9660 192.168.1.24:9660
UDP 04:50 UDP 192.168.2.103:5656 192.168.1.242:9660 192.168.1.24:9660

在rip上抓包:
16:55:15.292853 IP 192.168.2.103.5656 > 192.168.1.242.9660: UDP, length 88
0x0000: 4500 0074 0000 4000 4011 b4cf c0a8 0267 E..t..@.@......g
0x0010: c0a8 01f2 1618 25bc 0060 12ab ab00 0100 ......%..`......
0x0020: 3800 0004 dd00 0000 01fa 9d00 0000 1011 8...............
0x0030: 0022 0100 0000 6400 0003 e700 0000 0100 ."....d.........
0x0040: 0000 0200 0000 0300 0000 0400 0000 0500 ................
0x0050: 0000 0600 3943 4445 3943 3046 3234 3442 ....9CDE9C0F244B
0x0060: 3839 3730 3236 3737 3042 3243 3635 3244 897026770B2C652D
0x0070: 3438 3437 4847
16:55:15.301755 IP 192.168.1.24.9660 > 192.168.2.103.5656: UDP, length 55
0x0000: 4500 0053 0000 4000 4011 b5ca c0a8 0118 E..S..@.@.......
0x0010: c0a8 0267 25bc 1618 003f 8520 ab00 0100 ...g%....?......
0x0020: 1700 0004 dd00 0000 01fa 9d00 0000 1012 ................
0x0030: 0001 0080 4430 4336 4135 3833 3738 4237 ....D0C6A58378B7
0x0040: 4641 4130 3143 3844 3131 3638 3736 3633 FAA01C8D11687663
0x0050: 4131 32 A12

从抓包中可以看出,realserver给客户端的响应的IP是自己的一块物理网卡的 真实IP,而不是VIP,造成客户端无法正常接收处理此数据包,看了LVS DR原理里说REALSERVER响应给客户端的源IP应该是vip的
realserver 启动脚本如下:
#!/bin/bash
#description : Start Real Server
VIP=192.168.1.242
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo " Start LVS of Real Server"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
#/sbin/route add -host $VIP dev lo:0
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
sysctl -p >/dev/null 2>&1
;;
stop)
/sbin/ifconfig lo:0 down
echo "close LVS Director server"
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

各网口状态:
[root@ciwong ~]# ip addr ls
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet 192.168.1.242/32 brd 192.168.1.242 scope global lo:0
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc noop qlen 1000
link/ether d4:ae:52:96:2c:9c brd ff:ff:ff:ff:ff:ff
3: eth1: mtu 1500 qdisc mq qlen 1000
link/ether d4:ae:52:96:2c:9e brd ff:ff:ff:ff:ff:ff
4: eth2: mtu 1500 qdisc mq qlen 1000
link/ether d4:ae:52:96:2c:a0 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.24/24 brd 192.168.1.255 scope global eth2
inet6 fe80::d6ae:52ff:fe96:2ca0/64 scope link
valid_lft forever preferred_lft forever
5: eth3: mtu 1500 qdisc mq qlen 1000
link/ether d4:ae:52:96:2c:a2 brd ff:ff:ff:ff:ff:ff

这里我想问为什么我的lvs里的realserver转发给客户端的是realip而不是vip呢(vip:192.168.1.242 rip:192.168.1.24),该如何配置?

Forums:

Call me wind because I am abellutsoy blown away.

You mean I don't have to pay for expert advice like this an?romey!

I relaly needed to find this info, thank God!

Thninikg like that shows an expert at work

Never would have thunk I would find this so innsdpeisable.

The ablitiy to think like that is always a joy to behold

gjdusj payday loans RHtgh payday loans bZojWI payday loans EgzRwy payday loans %-[[[ payday loans AeFwtJ payday loans 8293

It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. HI FROM TASHKENT