如果客户端的IP位于防火墙(宽出严进)之后,服务端有可能主动连不上客户端,这时就要采用被动模式,客户端主动联接服务端.
所以ftp服务端防火墙最好开启21,由ftp服务器软件指定范围数据连接端口,以解决客户端采用被动模式出错的情况
可以不在服务端防火墙上打开20端口,因为这个仅在port模式下才有用,并且是出. 而不是进
以上摘抄:
=========================
> entry from faq
> 2. Have your FTP clients use passive mode. Passive mode data connections
> originate from the client,and thus do not experience this "port 20" problem.
There are many types of firewalls and some of them
do their work by disallowing connections from IP addresses outside their
network. FTP protocol has been designed a long time ago and it did not count
with this kind of restriction. That is why server, not client, originates
connection during FTP session. Simply, I can explain it like this: client
tells server "I am waiting on my port XXXX for your data", and server
connects (opens/originates connection) to the port specified by client and
sends the data there. That means that if the client is behind firewall which
does not allow connections from outside IP addresses, it also does not allow
connection attempt from this FTP server. So, after a few years it became
clear it is necessary to modify FTP protocol so that it is able to work also
with client which it can't connect to. And at that time PASV command was
added. It works very simple: Client sends PASV command to server which
answers something like this "The data is waiting for you on my port YYYY"
and now client only connects to the specified port on the server to transfer
the data. So, connection now originates client and there is no problem with
firewall.