How does FTP work? Print

  • 0

FTP is a client-server protocol and it relies on two communication channels between the client and the server.

  1. Control Connection: The FTP client, for example, FileZilla or FileZilla Pro sends a connection request usually to server port number 21. This is the control connection. It is used for sending and receiving commands and responses. Typically a user needs to log on to the FTP server for establishing the connection but there are some servers that make all their content available without login. These servers are known as anonymous FTP.
  2. Data Connection: For transferring the files and folder we use a separate connection called data connection.
FTP Control Connection and Data Connection

This connection can be established in two ways:

  • Active Mode: In this mode, the user connects from a random port(random port 1) on the FTP client to the port 21 of the server. It sends the PORT command which tells the server that what port of the client it should connect to i.e.(random port 2). The server connects from the port 20 to the port which the client has designated i.e. Random Port 2. Once the connection is established the data transfer takes place through these client and server port.
FTP Active Mode
  • Passive Mode: In the situation, where the client can not accept connection like when blocked by a firewall, the passive mode has to be used. This is the most common mode because nowadays the client is behind the firewall(e.g. built-in Windows Firewall). In this mode, the user connects from a random port(random port 1) on the FTP client to the port 21 of the server. It sends the PASV command which tells the client that what port of the server it should connect to i.e.(random port 3) for establishing the connection. The client connects from the Random port 2 to the port which the server has designated i.e. Random Port 3. Once the connection is established the data transfers take place through these client and server port.
FTP Passive Mode

Was this answer helpful?

« Back

Powered by WHMCompleteSolution