免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 8324 | 回复: 31
打印 上一主题 下一主题

ipvsadm 转发问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-15 09:04 |只看该作者 |倒序浏览
负载均衡器的双网卡,对内是10.0.0.1 对外是192.168.0.24

NAT模式具体配置和状况如下:

1$echo 1 > /proc/sys/net/ipv4/ip_forward
2.ipvsadm -C
ipvsadm -A -t 192.168.0.24:21 -s rr
ipvsadm -a -t 192.168.0.24:21 -r 10.0.0.11:21 -m
ipvsadm -a -t 192.168.0.24:21 -r 10.0.0.12:21 -m
ipvsadm -a -t 192.168.0.24:21 -r 10.0.0.13:21 -m


3.配置real server ip 地址,指定网关为10.0.0.1
全部设置vsftpd服务器

客户端是windows
通过ftp链接192.168.0.24,在lvs服务器上看到有分发,但是全部都没有连接上。
请高手指点WHY

[root@localhost ~]# ipvsadm -Ln
IP Virtual Server version 1.2.21 (size=4096)
Prot LocalAddressort Scheduler Flags
-> RemoteAddressort Forward Weight ActiveConn InActConn
TCP 192.168.0.24:21 rr
-> 192.168.0.24:21 Masq 1 0 1
-> 192.168.0.24:21 Masq 1 0 1
-> 192.168.0.24:21 Masq 1 0 1

[ 本帖最后由 skywh_2001 于 2007-5-15 09:16 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-05-15 09:19 |只看该作者
ipvsadm -Lcn
看看有没有连接?

1.关闭vs和rs上的iptables
2.insmod ip_vs_ftp

论坛徽章:
0
3 [报告]
发表于 2007-05-15 10:31 |只看该作者
ipvsadm -Lcn
出现了一次
IPVS connection entires
pro   expire    state          source                         virtual                   destination
Tcp   00:58     SYN_RECV    192.168.0.188:1060   192.168.0.24:21   10.0.0.11:21
Tcp   00:59     SYN_RECV    192.168.0.188:1062   192.168.0.24:21   10.0.0.12:21
Tcp   00:56     SYN_RECV    192.168.0.188:1061   192.168.0.24:21   10.0.0.13:21

而后ipvsadm -Lcn
没有任何信息

客户端:ftp:connect:未知错误

insmod ip_vs_ftp在哪台机器?VS?RS? 此模块在哪儿?

[ 本帖最后由 skywh_2001 于 2007-5-15 10:33 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2007-05-15 10:37 |只看该作者
你的rs正常吗?收到数据包并做出响应了吗?
1.在rs上tcpdump -i eth0 -nnn
2.nestat -an查看连接状态

ip_vs_ftp在vs上insmod

论坛徽章:
0
5 [报告]
发表于 2007-05-15 11:01 |只看该作者
tcpdump -i eth0 -nnn的结果

15:01:26.970037 IP 192.168.0.188.138 > 192.168.0.255.138: NBT UDP PACKET(13
15:02:32.296146 IP 192.168.0.188.138 > 192.168.0.255.138: NBT UDP PACKET(13
15:04:52.884608 arp who-has 192.168.0.24 tell 192.168.0.188
15:04:52.888309 arp who-has 10.0.0.13 tell 10.0.0.1
15:05:37.777385 arp who-has 10.0.0.12 tell 10.0.0.1
15:05:37.777410 arp reply 10.0.0.12 is-at 00:19:5b:69:d0:6f
15:05:37.777472 IP 192.168.0.188.1040 > 10.0.0.12.21: S 419494914:419494914(0) win 65535 <mss 1460,nop,nop,sackOK>
15:05:37.777567 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:40.789996 IP 192.168.0.188.1040 > 10.0.0.12.21: S 419494914:419494914(0) win 65535 <mss 1460,nop,nop,sackOK>
15:05:40.790046 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:40.977576 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:42.777647 arp who-has 10.0.0.1 tell 10.0.0.12
15:05:42.777746 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a
15:05:46.805448 IP 192.168.0.188.1040 > 10.0.0.12.21: S 419494914:419494914(0) win 65535 <mss 1460,nop,nop,sackOK>
15:05:46.805498 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:46.977817 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:48.921648 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:49.921678 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:50.921704 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:51.949716 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:52.949750 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:53.949765 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:57.965867 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:58.965894 arp who-has 10.0.0.11 tell 10.0.0.1
15:05:58.978325 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:05:59.965921 arp who-has 10.0.0.11 tell 10.0.0.1
15:06:23.179307 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:06:26.960923 IP 192.168.0.188.138 > 192.168.0.255.138: NBT UDP PACKET(13
15:06:28.179474 arp who-has 10.0.0.1 tell 10.0.0.12
15:06:28.179565 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a
15:07:11.381243 IP 10.0.0.12.21 > 192.168.0.188.1040: S 3744967018:3744967018(0) ack 419494915 win 5840 <mss 1460,nop,nop,sackOK>
15:07:16.381412 arp who-has 10.0.0.1 tell 10.0.0.12
15:07:16.381500 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a


[root@localhost ~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:111                    0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:21                      0.0.0.0:*                   LISTEN      
tcp        0      0 10.0.0.12:21                 192.168.0.188:1045          SYN_RECV   
tcp        0      0 127.0.0.1:25                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:636                    0.0.0.0:*                   LISTEN      
tcp        0      0 :::22                               :::*                        LISTEN      
tcp        0      0 ::1:631                              :::*                        LISTEN      
udp        0      0 0.0.0.0:32768               0.0.0.0:*                              
udp        0      0 0.0.0.0:5353                0.0.0.0:*                              
udp        0      0 0.0.0.0:111                 0.0.0.0:*                              
udp        0      0 0.0.0.0:630                 0.0.0.0:*                              
udp        0      0 0.0.0.0:631                 0.0.0.0:*                              
udp        0      0 0.0.0.0:633                 0.0.0.0:*                              
udp        0      0 :::32769                    :::*                                    
udp        0      0 :::5353                     :::*

[ 本帖最后由 skywh_2001 于 2007-5-15 15:34 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2007-05-15 16:45 |只看该作者
echo 1 > /proc/sys/net/ipv4/ip_forward
cat /proc/sys/net/ipv4/ip_forward

论坛徽章:
0
7 [报告]
发表于 2007-05-15 17:36 |只看该作者
在vs上已经改过了

[root@localhost ~]# tcpdump -i eth0 -nnn
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
17:16:35.424636 arp who-has 192.168.0.24 tell 192.168.0.188
17:16:35.430472 arp who-has 10.0.0.1 tell 10.0.0.12
17:16:39.186547 arp who-has 10.0.0.1 tell 10.0.0.11
17:16:43.314420 IP 192.168.0.188.1078 > 10.0.0.13.21: S 3412756079:3412756079(0) win 65535 <mss 1460,nop,nop,sackOK>
17:16:43.316029 arp who-has 10.0.0.1 tell 10.0.0.13
17:16:43.316097 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a
17:16:43.316103 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:16:46.182356 IP 192.168.0.188.1078 > 10.0.0.13.21: S 3412756079:3412756079(0) win 65535 <mss 1460,nop,nop,sackOK>
17:16:46.182407 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:16:47.112361 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:16:51.180172 arp who-has 10.0.0.13 tell 10.0.0.1
17:16:51.180193 arp reply 10.0.0.13 is-at 00:19:5b:82:7a:97
17:16:52.203125 IP 192.168.0.188.1078 > 10.0.0.13.21: S 3412756079:3412756079(0) win 65535 <mss 1460,nop,nop,sackOK>
17:16:52.203175 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:16:53.312859 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:17:05.313823 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:17:10.314194 arp who-has 10.0.0.1 tell 10.0.0.13
17:17:10.314282 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a
17:17:29.315747 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:18:17.519616 IP 10.0.0.13.21 > 192.168.0.188.1078: S 3134671584:3134671584(0) ack 3412756080 win 5840 <mss 1460,nop,nop,sackOK>
17:18:22.519988 arp who-has 10.0.0.1 tell 10.0.0.13
17:18:22.520077 arp reply 10.0.0.1 is-at 00:0d:88:47:66:2a

客户端windows状况依旧,仍无连接
ftp:connect:未知错误号

[ 本帖最后由 skywh_2001 于 2007-5-15 17:39 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2007-05-15 17:40 |只看该作者
你的ftp服务已经收到连接请求,并做出应答,但是客户端收不到,因此有重发现象。

在rs->vs->client中某个地方有问题

1.你的默认路由是经过vs吗?
2.你能ping vs吗?

论坛徽章:
0
9 [报告]
发表于 2007-05-15 20:40 |只看该作者
VS双网卡,对内是10.0.0.1 对外是192.168.0.24
配置real server ip 地址,指定网关为10.0.0.1

rs能ping通vs

论坛徽章:
0
10 [报告]
发表于 2007-05-16 08:38 |只看该作者
1.关闭vs上iptables
service iptables stop

2.在vs内网网卡上

tcpdump -i eth1 -nnn 'tcp and port 21'
看看输出
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP