Active FTP:
Command connection: client >; 1024 port → server21port
Data connection: client >; 1024 port/server 20 port
Passive FTP:
Command connection: client >; 1024 port → server21port
Data connection: client >; 1024 port/server > port 1024
The process of port (active) connection is that the client sends a connection request to the FTP port of the server (2 1 by default), and the server accepts the connection and establishes a command link. When data needs to be transmitted, the client uses the PORT command on the command link to tell the server: "I have opened the ***X port, come and connect me". So the server sends a connection request from port 20 to port ***X of the client, and establishes a data link to transmit data.
PASV (passive) connection process is: the client sends a connection request to the FTP port of the server (2 1 by default), and the server accepts the connection and establishes a command link. When data needs to be transmitted, the server tells the client with the PASV command on the command link: "I have opened the ***X port, come and connect me". So the client sends a connection request to the ***X port of the server, and establishes a data link to transmit data.
Because my local FTP server is in the intranet and only maps two ports (20,21) from the extranet, I can't use PASV mode. The solution to this problem is also very simple. Close the client's PASV mode, force it to access the server in port mode, and use the passive command to close the client's PASV mode after logging in to the FTP server, as follows:
Ftp> negative
Passive mode off.
Ftp> Passive (Run the command again to open it)
Passive mode on.