找回密码
 立即注册
搜索
查看: 254|回复: 23

哪位高手帮我看看这个FTP?出了什么问题?

[复制链接]

119

主题

633

回帖

614

积分

高级会员

积分
614
发表于 2002-12-7 21:37:36 | 显示全部楼层 |阅读模式
状态:>          Socket 已连接。正在等候欢迎消息...
                220 Serv-U FTP Server v4.0 for WinSock ready...
状态:>          已连接。正在验证...
命令:>          USER abc
                331 User name okay, need password.
命令:>          PASS *****
                230 User logged in, proceed.
状态:>          登录成功。
命令:>          PWD
                257 "/" is current directory.
状态:>          Home directory: /
命令:>          FEAT
                211-Extension supported
                 AUTH TLS
                 PBSZ
                 PROT
                 MDTM
                 MDTM YYYYMMDDHHMMSS[+-TZ] filename
                 SIZE
                 SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
                 REST STREAM
                211 End
状态:>          该站点支持 features。
状态:>          该站点支持 SIZE。
状态:>          该站点可以续传中断的下载。
命令:>          TYPE A
                200 Type set to A.
命令:>          REST 0
                350 Restarting at 0. Send STORE or RETRIEVE.
命令:>          PASV
                227 Entering Passive Mode (10,106,72,250,16,45)
命令:>          LIST
状态:>          正在连接 ftp 数据 socket 10.165.72.251:4141...
错误:>           无法连接到远程服务器。Socket 错误 = #10060。
错误:>           建立数据 socket 失败。


在学校的服务器上调试FTP怎么不行,Socket 错误 = #10060。是指什么错误?

327

主题

3264

回帖

3641

积分

荣誉版主

积分
3641
发表于 2002-12-7 23:12:53 | 显示全部楼层
是不是和Passive有关? 多试试
回复

使用道具 举报

15

主题

238

回帖

503

积分

荣誉版主

积分
503
发表于 2002-12-8 01:53:54 | 显示全部楼层
对方的FTP(服务器端)不支持PASV模式, 这个FTP可能是在内网里用NAT建的。 你用PORT模式连接, 或者让对方在设置NAT的路由器上再开放几个PASV端口。
回复

使用道具 举报

131

主题

1405

回帖

2152

积分

论坛元老

积分
2152
发表于 2002-12-9 00:48:20 | 显示全部楼层
不对吧,你截下来的信息有问题。10060是请求连接超时,可你前面的信息表示已经连接成功,是不是服务器在这中间down掉了?
回复

使用道具 举报

15

主题

238

回帖

503

积分

荣誉版主

积分
503
发表于 2002-12-9 01:27:48 | 显示全部楼层
最初由 dedededede 发布
[B]不对吧,你截下来的信息有问题。10060是请求连接超时,可你前面的信息表示已经连接成功,是不是服务器在这中间down掉了? [/B]


前面连接成功是说IP Socket连接成功, 只要你的机器和对方机器之间的网络没问题, 你都会看到这个信息的。 但是接下来的10060是说packet到了对方机器之后无法与FTP服务器端建立有效的FTP连接。 换句话说就是Physical Layer(物理层)的连接已经建立了, 但是应用层的没法建立。 照着我前面说的做就行了。
回复

使用道具 举报

131

主题

1405

回帖

2152

积分

论坛元老

积分
2152
发表于 2002-12-9 01:36:25 | 显示全部楼层
不对,何丘你再想想,最好做个实验。
回复

使用道具 举报

2

主题

36

回帖

49

积分

注册会员

积分
49
发表于 2002-12-9 14:18:03 | 显示全部楼层
这样的情况是server 的passive mode出了问题.
一个FTP的传送需要两个connection. 一个作ftp指令用的, 一个作传data用的.
ftp指令用的connection一定是passive的(passive的定义是由客户端向server发出连线请求, 反之则为active). 用port 21.
ftp data connection active的话是port 20, passive的话就由server 告诉client.


w^!@#$!%@%^#$%^ 刚才打了一大段, 不小心按了一下 ESC 就给我全摸了.  $%^@$%@#$%@#$%
不打中文了, 用英文再打一次.

Let's look at the sample above:
-----------------------
220 Serv-U FTP Server v4.0 for WinSock ready...
命令:> USER abc
331 User name okay, need password.
命令:> PASS *****
230 User logged in, proceed.
命令:> PWD
257 "/" is current directory.
命令:> FEAT
211-Extension supported
AUTH TLS
PBSZ
PROT
MDTM
MDTM YYYYMMDDHHMMSS[+-TZ] filename
SIZE
SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
REST STREAM
211 End
命令:> TYPE A
200 Type set to A.
命令:> REST 0
350 Restarting at 0. Send STORE or RETRIEVE.
命令:> PASV
227 Entering Passive Mode (10,106,72,250,16,45)
命令:> LIST
------------------------------------
The above is the so called active connection, it doesn't involve data transfer, only commands and return codes are there.
Look at the last 3 lines, the command PASV is sent to the server by client telling : I wish to go to passive mode.
And the server returns(2nd last line): OK, please connect to my port 4141(16*256+45) using IP 10.106.72.250.
Then the client asks: Please give me your file listing.
And the client then tries to connect to server's port 4141(client's port number is chosen by random, it's not important).
If everthing goes right, when server recognize the connection on port 4141, it will send the file list through that port right away.
Here comes the problem, the client cannot find the server on IP10.106.72.250 port 4141, and it waits and waits util timeout.
This problem is due to 3 possibe misconfigurations:
  1, the ftp server is behind an NAT and port 21 is forwarded to the actual ftp host on the gateway, but the ports for passive modes aren't probably forwarded to the actual ftp host.
  2, the firewall is blocking the ports.
  3, the FTP server program is sending the WRONG ip address to client. Check your FTP program and your gateway's ip match or not.(*)
That's it. BTW, the ftp client program is only displaying application layers message, TCP layer's message are hidden from users, so you don't see the connection errors.


(*) so dumb me. After typing so much I just recognized that IP mistake. The IP address above, 10.106.72.250 is a Class A private IP address. That means, the FTP server IS in NAT and it's telling the ftp client its internal address. The client in no way can find such address on the Internet. So this is the problem #3 defined above.
回复

使用道具 举报

2

主题

36

回帖

49

积分

注册会员

积分
49
发表于 2002-12-9 14:21:14 | 显示全部楼层
天啊, 上面的 ": >"都给我変成什么了.
回复

使用道具 举报

16

主题

859

回帖

1173

积分

金牌会员

积分
1173
发表于 2002-12-9 22:30:12 | 显示全部楼层
说的太好了,can't be better.涨知识。
能不能问一下,那如果ftp client选了port方式,会怎样?
和pasv有什么区别?
是不是data从指定的port传?
这个port又是怎样分配的?
回复

使用道具 举报

15

主题

238

回帖

503

积分

荣誉版主

积分
503
发表于 2002-12-10 00:28:17 | 显示全部楼层
最初由 dedededede 发布
[B]不对,何丘你再想想,最好做个实验。 [/B]


:-) 为什么不对?
这其实是个很简单的问题。 原因我上面已经简单的说了, 另外上面的那位网友解释的更详细, 只不过没有针对serv-u。 其实真正的原因就是他说的1和3。和2没有关系, 如果是2的话, 你根本就看不到一开始“连接已建立”的信息。

我一步一步的说怎么设置: 注意, 这里假设你的公网IP地址为132.1.2.3(也就是你的路由器的对外地址), 你的路由器的对内地址是192.168.1.1, 你的FTP服务器的地址为192.168.1.2.

1。 在Serv-U里, 在“Local Server”下面点“Settings”, 然后点“Advanced”, 你会看到有一项是“PASV Port Range”, 在里面填3001到3008。
2。 在“Domains”下面点你的域名, 比如“ftp.domain.com",  然后点”Settings”, 在上面的一排菜单里最后一个是“Advanced”, 你会看见一项“Allow passive mode data transfers, use IP”, 选上这一项, 然后在后面的空格里填上你的公网IP地址132.1.2.3.
3。在你的路由器上, 设置将21端口和3001-3008端口的所有TCP和UDP数据包转发到192.168.1.2。

然后你再去试着连接。

dedededede, 你现在知道NAT里PASV模式是怎么工作的了吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|海浩社区

GMT+8, 2025-9-21 00:19 , Processed in 0.096935 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表