FTP active vs passive 1. The FTP protocol uses two TCP connections. One is the command link used to transmit commands between the FTP client and the server, and the other is the data link used to upload or download data. 2. The FTP protocol works in two ways: Active Mode and passive mode. 3. FTP protocol
Data Transmission There are two modes: Active Mode and passive mode. (port, PASV) 4. Select active mode or passive mode to log on to the FTP server,
Choose
FTP
Client Instead of on the FTP server.
mode |
active mode |
passive mode |
command |
FTP Server: tcp 21 <------ client: dynamicftp server: TCP 20 ------> client: Dynamic |
FTP Server: tcp 21 <---- client: dynamicftp server: TCP dynamic <---- client: Dynamic |
Connection Process |
The client sends a connection request to the FTP port (21 by default) of the server. 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 opened port XXXX and you came to connect to me ". The server sends a connection request from Port 20 to port XXXX of the client and establishes a data link to transmit data. |
The client sends a connection request to the FTP port (21 by default) of the server. The server accepts the connection and establishes a command link. When data needs to be transmitted, the server uses the PASV command on the command link to tell the client: "I opened port XXXX, and you came to connect to me ". Therefore, the client sends a connection request to port XXXX of the server and establishes a data link to transmit data. |