Content Table

How to differentiate between File Transfer Protocol active mode and passive mode?

FTP(File Transfer Protocol) is a common protocol in the file transfer process. Many companies build FTP servers to provide file download services. Here are two transfer modes for FTP. FTP differs from other services in that it uses two ports and one data port. And a command port (or called control port). Usually, port 21 is the command port and port 20 is the data port. When the concept of active/passive mode is mixed in, the data port may not be 20.

file transfer protocol

Active Mode

The working principle of the active mode: FTP client uses N (N>1023) port to connect to port 21 of the FTP server, sends a user name and password to log in, and after successful login to list or read data, the client opens the N+1 port. Send the PORT command to the FTP server, tell the server-client to adopt the active mode and open the port; After receiving the PORT active mode command and port number, the FTP server connects through the server's 20 port and the client's open port to send data.

Passive Mode

The working principle of the passive mode: the FTP client uses N (N>1023) to connect to port 21 of the FTP server, and sends a user name and password to log in. After successful login, if you want to list or read data, send a PASV command to the FTP server. Open a port locally (above 1024), and then tell the client the open port. The client then connects to the open port of the server through the N+1 port for data transmission.

Active Mode VS Passive Mode

The difference between the two is that when establishing a data movement connection, the main mode connection initiator is server-side, and the port 20 connects to the client's N+1 port to establish the data connection; the passive mode connection initiator is the client, and the client uses Port number +1 to connect to a high-order part of the server.

Differences IN Network Settings

Scenario: The FTP client and server are on different networks, and a firewall is required between the two networks. The client's FTP software sets the port segment opened in active mode, and the corresponding port segment can be opened on the client's firewall. There is a common problem: only port 21 is opened on the server-side, and no port is opened on the client machine. The passive mode adopted by the FTP client connection results in that the client can log in successfully, but cannot list and read data. It is because the server does not open the random port in passive mode.

In passive mode, the open ports on the server-side are random, but the firewall must not be fully open. The solution is to open some random high-level ports in the passive mode of the FTP server configuration (range in the FTP server software settings, you can set any 1024 on Port segment), and then set the rules in the firewall, open the corresponding port number on the server-side.

Enterprise High Speed Large File Transfer Solutions

You might also like

About the File Transfer Protocol, How Much Do You Know?

Industry news

August 19, 2020

FTPS(FTP over SSL/TLS) is a secure file transfer protocol, which allows you to securely transfer files with your trading partners and customers.

Read more
Is Unlimited File Sharing Possible? Here Is The Answer

Industry news

June 26, 2024

Say no more as we will be discovering if all of it is possible and which options will best suit the needs for unlimited file sharing!

Read more
Raysync - Something You Need to Know about Massive Small Files Transfer

Industry news

July 24, 2020

After the comparative test, we found that the advantages of Raysync are evenly distributed, and there are almost no shortcomings from product performance to operation experience.

Read more

By continuing to use this site, you agree to the use of cookies.