Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does ftp active mode and passive mode mean?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you what ftp active mode and passive mode mean. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Ftp is different from the general service, this service needs to open two ports at the same time, one port is the command channel, and the other port is the data transmission channel. According to the different establishment of data transmission channel, it is divided into active mode and passive mode. Here, a detailed description of the active mode of the workflow, and how to solve problems.

Active mode process

The establishment of command channel. The client randomly selects a port greater than 1024 to establish a connection with port 21 of the server. When the connection is established, the client can execute commands on the ftp service through the connection, such as querying file names, uploading files, downloading files and other commands are executed through this channel.

Notify the server to use active mode. Port 21 is only used for the execution of commands, and another port is needed for transfers that really need files. The client will randomly open another port for file transfer, and then inform the ftp server through port 21 of the two information, the client user file transfer port, using active mode for file transfer.

The ftp server proactively establishes a connection to the client. When the ftp server knows two pieces of information, it will actively establish a connection with the client through port 20. Once the connection is established, the file can be transferred over the connection.

Problems that may be encountered in active mode

The ftp server cannot be connected in active mode, and there may be the following situations:

The service port is not started

Server firewall

The local area network where the client is located has nat conversion.

In active mode, the ports generally open are 21 (command channel) and 20 (file transfer channel). One of the two ports is indispensable. In addition, the firewall also needs to release these two ports. For client hosts, you can test whether these two ports are open through telnet.

The problem of port and firewall is relatively easy to solve, but the problem of NAT conversion is very difficult to solve. Let's take a look at how the nat transformation causes the problem. For the establishment of the command channel, because it is initiated by the client, the channel can be established successfully. However, when the server actively establishes the data channel to the client, because the server knows the IP of NAT, not the IP of the client. Therefore, the server sends a request for an active connection over port 20 to one of the ports of the NAT, such as port 1042. However, NAT did not open that port, so the active connection establishment failed. So, how to solve this problem? Just use passive mode.

Passive mode process

The establishment of command channel. This stage is the same as the active mode.

The client issues a link request for PASV. The client sends the request in PASV passive mode to the server through the command channel and waits for the response from the server.

The server starts the data port and informs the client. When the server receives a PASV request from the client, it starts a port for data transmission. This port can be random (1024065535) or can be specified. The client is then informed through the command channel.

The client starts the data port and establishes a connection with the server. When the client receives the information from the server and knows the port used by the server for data transmission, the client will randomly open a port greater than 1024, and then establish a connection with the server through this port.

Thank you for reading! So much for sharing what ftp active mode and passive mode mean. I hope the above content can help you to some extent, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report