- 论坛徽章:
- 0
|
参数:
DIP:172.10.10.64
VIP:172.10.10.68
RIP1:172.10.10.65
RIP2:172.10.10.66
我在director上使用以下脚本
#!/bin/bash
VIP=172.10.10.68
RIP1=172.10.10.65
RIP2=172.10.10.66
GW=172.10.10.64
# set iptables function
#(1?±?ip_forward)
echo "0" > /proc/sys/net/ipv4/ip_forward
#(?a??ICMP Redirects)
echo "1" > /proc/sys/net/ipv4/conf/all/send_redirects
#(?a??ICMP Redirects)
echo "1" > /proc/sys/net/ipv4/conf/default/send_redirects
#(?a??ICMP 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 gw $GW dev eth0:0
#Clear IPVS table
/sbin/ipvsadm -C
#set LVS
/sbin/ipvsadm -A -t $VIP:80
ping -c 1 $RIP1
ping -c 1 $RIP2
/sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g -w 1
/sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g -w 1
#Run LVS
/sbin/ipvsadm
#end
在realserver上使用以下脚本:
#!/bin/bash
VIP=172.10.10.68
/sbin/ifconfig lo:1 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:1
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
#end
在director上检查:
ipvsadm
IP Virtual Server version 1.2.0 (size=4096)
Prot LocalAddress ort Scheduler Flags
-> RemoteAddress ort Forward Weight ActiveConn InActConn
TCP 172.10.10.68:http rr
-> 172.10.10.66:http Route 1 0 0
-> 172.10.10.65:http Route 1 0 0
当从客户机172.10.10.47上telnet 172.10.10.68 80,在director上执行tcpdump结果如下:
tcpdump port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
17:56:35.120922 IP 172.10.10.47.1662 > 172.10.10.68.http: S 872078540:872078540(0) win 8192 <mss 1460,nop,wscale 0,nop,nop,timestamp 0 0,nop,nop,sackOK>
17:56:38.387845 IP 172.10.10.47.1662 > 172.10.10.68.http: S 872078540:872078540(0) win 8192 <mss 1460,nop,wscale 0,nop,nop,timestamp 0 0,nop,nop,sackOK>
17:56:44.949508 IP 172.10.10.47.1662 > 172.10.10.68.http: S 872078540:872078540(0) win 8192 <mss 1460,nop,wscale 0,nop,nop,timestamp 0 0,nop,nop,sackOK>
在RIP1和RIP2上执行tcpdump port 80没有任何数据报到达,从上面的数据看好像是director上根本就没有将80到VIP上的数据报收到后没有转发出去,请问是什么原因
请各位老大一定要帮帮忙啊,小弟不慎感激 |
|