|
发表于 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. |
|