Overview

TFTP is a simple file transfer protocol. It is often used to transfer configuration files of routers and other network devices. This section explains how TFTP works and how to use a Cisco router as a TFTP server/client.

What is TFTP?

TFTP (Trivial File Transfer Protocol) is a simple file transfer protocol. When transferring files using TFTP, no user authentication is performed. It also uses UDP (well-known port 69) at the transport layer, which allows efficient file transfers without the overhead of establishing a TCP connection. Compared to FTP and HTTP, which use TCP at the transport layer, file transfers are not as reliable. TFTP is used to easily transfer files that are not very large in size, such as router configuration files.

Figure: TFTP protocol layer
Figure: TFTP protocol layer

The TFTP specification is defined in RFC 1350.

How TFTP works

When transferring files with TFTP, TFTP server application and TFTP client application are required. The flow of operation between the TFTP server application and the client application is as follows

  1. Send request command
  2. File data transfer and acknowledgement

Send request command

Sends a request command from TFTP client application to TFTP server application.In this case, the destination port number is 69. The source port number is random.

Figure: How the TFTP works part1
Figure: How the TFTP works part1

File data transfer and acknowledgement

Transfers file data in response to a request command. The TFTP server determines a random port number for file data transfer. The port number of the TFTP client side is the port number when the request command is sent. File data transfer by TFTP is 512 bytes per transfer. Files that are large in size are divided by TFTP into blocks of 512 bytes each.

When transferring files with TFTP, TFTP acknowledgment (ACK) is performed. If even one of the fragmented blocks is not received, the file cannot be re-assembled, so an acknowledgment is made at the level of TFTP.

The exchange of 512-byte blocks of segmented file data and corresponding acknowledgements is repeated as often as necessary. When the transfer of blocks of less than 512 bytes is finally completed, the TFTP file transfer is complete.

Figure: How the TFTP works part2
Figure: How the TFTP works part2

If there is a router or firewall performing packet filtering between the TFTP server and the client, the packet filter conditions should be noted. Please configure the packet filter conditions taking into account that the TFTP server uses not only UDP69 but also random ports.

Using Cisco routers as TFTP server and TFTP client

Cisco routers can be used as TFTP server and TFTP client.

TFTP Server Configuration

Cisco routers can act as TFTP servers. Then the TFTP client can download files on the router’s flash or NVRAM. To do so, enter the following command from global configuration mode.

TFTP Server Configuration

(config)#tftp-server <file-path>

<file-path> : File path to be downloaded using TFTP

Figure: Cisco router TFTP server
Figure: Cisco router TFTP server

TFTP Client

You can use Cisco routers as TFTP clients to transfer files to and from TFTP servers; to download a file on a TFTP server to the router’s flash memory, etc., in privileged EXEC mode, enter the following.

TFTP Client download

#copy tftp <copy-destination>

<copy-destination> : destination file

If you do not specify the IP address of the TFTP server or the name of the file to download when you enter the command, you will be prompted for the necessary information as shown below.

TFTP Client download Sample

R1#copy tftp nvram
Address or name of remote host []? 192.168.12.1
Source filename []? r1-config
Destination filename [nvram]? startup-config

“Address or name of remote host” is the IP address of the TFTP server. “Source filename” is the name of the file to download on the TFTP server. “Destination filename” is the name of the file to be saved locally on the router.

Figure: Cisco router TFTP client download
Figure: Cisco router TFTP client download

Also, when uploading a file on the router’s flash memory or other storage to the TFTP server, enter the following in privileged EXEC mode

TFTP Client upload

#copy <copy-source> tftp

<copy-source> : Source file

Again, if the required information is not specified when entering the command, you will be asked to enter the required information.

TFTP Client upload sample

R1#copy nvram: tftp
Source filename []? startup-config
Address or name of remote host []? 192.168.12.1
Destination filename [r1-confg]?

“Address or name of remote host” is the IP address of the TFTP server. “Source filename” is the name of the file to be uploaded locally on the router. “Destination filename” is the name of the file to be stored on the TFTP server.

Figure: Cisco router TFTP client upload
Figure: Cisco router TFTP client upload

Summary

Points

  • TFTP is a simple file transfer protocol. It is often used to transfer small files such as configuration files of routers and other network devices.
  • UDP is used at the transport layer and the well-known port number is 69. However, a random port is also used on the server side.
  • Cisco routers can be used as TFTP servers and TFTP clients.