Two modes of operation of FTP protocol

Source: Internet
Author: User
Tags ack ftp ftp connection ftp client file transfer protocol ftp protocol firewall

Two modes of operation of FTP protocol: Active mode active and passive mode passive

FTP is a data transfer Protocol (File Transfer Protocol) that has two types of connection modes: Active mode (active) and passive mode (passive).

The following explains how the FTP connection was established:

In active mode (General preset mode):

FTP client opens a randomly selected TCP port to the Port 21 request for FTP server to establish a connection. When the Three-way handshake is completed, the connection is established successfully, but this is only the establishment of the command channel.

When the data is transmitted at both ends, the client tells the server through the command channel with a port command, and the client can use another TCP port as the data channel.

The server then establishes a data connection with Port 20 and the TCP port that the client has just told. Note: The connection direction is from server to client, and there will be a SYN flag in the TCP packet.

The client then returns a confirmation packet with an ACK flag and completes another three-way handshake process. At this point, the data connection can be successfully established. Start data transfer.

In passive mode:

FTP client opens a randomly selected TCP port to the Port 21 request for FTP server to establish a connection, completing the command channel establishment.

When the data is needed at both ends, the client sends a PASV command to the server via the command-line, requesting access to the passive transmission mode.

The server then selects a TCP port and tells the client in the command channel, as in the 2nd step of the above normal mode.

The client then uses another TCP port to call the TCP port that the server told just now to establish the data channel. In this case, a SYN flag is present in the group.

The server confirms that an ACK group is echoed back. and completes all handshake process, the successful establishment data channel.

Start data transfer. In practice, active mode is used to log in some FTP servers that have no firewall installed on the host, or to install FTP server! on the client side. Passive mode (PASV) is used to log on to some of the FTP installed on the firewall and is open on the host server!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.