Description of FTP active mode and passive mode (Compact)

First, active and passive

initiative:

A client from any port greater than 1024 to 1234 is now assumed that the port 21 (non-privileged port) is connected to the server (the command port), whereupon the client listening port (N + 1) is the port 1235 (which is understood to be client identification data port), and sends the FTP command "port 1235" to an FTP server (the server understood to be told, I'll give you an open data port which connects you to transfer data when the port can). Then when the need to transmit data, the server will from its own data port 20 is connected to the client's specified data port 1235

passive:

When clients open an FTP connection, the client opens two unprivileged ports assume any port 21 command 1234 and 1235,1234 port connection to the server, and the active mode is different is that the client is not committed to a port command allows the server to connect itself open data port; but pasv submit command to submit the results of the command server is open to any assumed to be a non-privileged port 1224, and sends the command "port 1224" to the client.
The client then just open the data port from 1224 to 1235 to establish a data server connection for data transmission.

to sum up:

Active mode is the client open port to connect to the server's command port 21 to establish the connection; and notify the local server and open data ports, establish a data connection port 20 open data initiative and the local port by the server.
Passive mode client is open two ports, and the first server to establish a connection command; submit pasv command to the server, the server sends a command to tell the client's own open data port; then take the initiative to open the client data port from its own port and server data establish a data connection

SUPPLEMENTARY

Active mode necessary precondition
for the FTP server in front of the firewall, it must allow the following communication to support active mode FTP:

  1. Any ports greater than 1024 port 21 to the FTP server. (Client initiates connection)
  2. 21 is greater than 1024 port to port FTP server. (Server client responsive to the control port)
  3. Port to port 20 greater than 1024 FTP server. (Server initiates the data connection to the client's data port)
  4. Port 20 is greater than 1024 port to the FTP server (ACK response sent to the client server data port)

Passive mode required prerequisite

  1. From any (Client initiates connection) port is greater than 1024 port 21 to the server
  2. A server port 21 to any port is greater than 1024 (a response server connected to the control port of the client)
  3. Any port from greater than 1024 to 1024 greater than the server's port (connection client server initialization data to any specified port)
  4. Port (ACK response and the server sends data to the client data port) is larger than the server 1024 to the remote port is greater than 1024

This article reference

Guess you like

Origin www.cnblogs.com/joinbestgo/p/10966864.html