The File Transfer Protocol (FTP), a file transfer standard on the Internet, runs at the application layer in the TCP/IP protocol suite. FTP is used to transfer files between local and remote hosts, typically for version upgrades, log downloads, file transfers, and configuration savings. FTP is implemented based on the file system.
FTP uses the client/server architecture, as shown in Figure 1.
The NetEngine 8000 F provides the following FTP functions:
FTP server: A router functions as an FTP server and provides access and operation services for remote clients. You can run the FTP client program to log in to and access files on the router.
FTP client: A router functions as an FTP client and provides file access to the remote FTP server. After you run a terminal emulation program or Telnet program on a PC to set up a connection to the router, you can use FTP commands to set up a connection to the remote FTP server and access files on it.
In addition to file transfer, FTP supports interactive access, format specifications, and authentication control.
FTP provides common file operation commands to help you manage the file system, including file transfer between hosts. You can use an FTP client program outside a router to upload or download files and access directories on the router. You can also run an FTP client program on a router to transfer files to other devices or to the FTP server on the router.
A control connection is set up between the FTP client and FTP server.
The control connection always waits for communication between the client and server. Commands are sent from the client to the server over this connection. The server responds to the client after receiving the commands.
The server uses port 20 to provide a data connection. The server can either set up or terminate a data connection. When the client sends files in streams to the server, only the client can terminate the data connection.
FTP supports file transfer in stream mode. The end of each file is indicated by end of file (EOF). Therefore, new data connections must be set up for each file transfer or directory list. When a file is transferred between the client and server, a data connection is set up.
Figure 2 shows the process of FTP file transfer.
The process of setting up an FTP data connection is as follows:
The server passively enables port 21 to wait to set up a control connection to the client.
The client actively enables a temporary port to send a request for setting up a connection to the server.
After the server receives the request, a control connection is set up between the temporary port on the client and port 21 on the server.
The client sends a command for setting up a data connection to the server.
The client chooses a temporary port for the data connection and uses the port command to send the port number to the server over the control connection.
The server actively enables port 20 to send a request for setting up a data connection.
After the client receives the request, a data connection is set up between the temporary port on the client and port 20 on the server.
Figure 3 shows the FTP connection establishment process. In this example, the FTP client uses temporary port 2345 to establish a control connection and temporary port 2346 to establish a data connection. The two ports are connected to ports 21 and 20 of the FTP server, respectively.