Trivial File Transfer Protocol (tftp)

The Trivial File Transfer Protocol (TFTP) is a protocol layered on the User Datagram transport Protocol (UDP) used over the Internet Protocol (IPv4 or IPv6).

TFTP is a very simple file transfer protocol. It was first specified in 1980 and provides functions to copy files across a network (a very basic form of FTP). It is defined in [RFC2347]. Since it is so simple, it is easy to implement in a very small amount of memory, an important consideration at that time it was defined. TFTP is therefore sometimes useful for booting or loading the configuration of systems (such as routers, thin client, and wireless base stations) which do not have data storage devices. TFTP has no authentication or encryption mechanisms, and generally provides the same access to all files in the tftp directory. Due to this lack of security, use of tftp can be dangerous over the open Internet. Therefore, TFTP is generally only used on private local area networks for applications where ftp would be too expensive or difficult to implement (e.g. down-loading firmware, software and configuration data to network devices).

The encapsulation used by TFTP is shown in the figure below:

TFTP PDU encapsulation

Five different Operation (Op) Codes are defined:

  1. Read Request (RRQ)
  2. Write Request (WRQ)
  3. Data (512B ir final segment)
  4. ACK
  5. Error

The TFTP protocol

The service uses the well-known UDP port of 69. Since TFTP utilises UDP, it has to supply its own session support. Each file transferred via TFTP constitutes an independent exchange.

The initiating client host sends either an RRQ (read request) or WRQ (write request) packet, containing the filename and the transfer mode.

The server responds to a received DATA packet with an ACK (acknowledgement) packet if it receives a WRQ message and with a DATA packet if it received an RRQ message (this also indicates the ports in use to the client).

The sending host then sends numbered DATA packets to the destination host after receiving each ACK message. All but the last message contains a full-sized block of data. The destination host replies with numbered ACK packets for each received DATA packet. This forms a simple ARQ protocol, providing retransmission when a packet is lost.

The final DATA packet must contain less than a full-sized block of data (including possibly zero bytes) to indicate that it is the last block of the transfer.

This data transfer is performed in lockstep. Only one packet (either a block of data, or an 'acknowledgement') is ever in flight on the network at any time. Due to this lack of windowing, TFTP has a low throughput over high latency (delay) links.

Standards Documents:

Sollins, K., "The TFTP Protocol (Revision 2)", STD 33, RFC 1350, July 1992.

Malkin, G. and A. Harkin, "TFTP Option Extension", RFC 2347, May 1998.

Malkin, G. and A. Harkin, "TFTP Blocksize Option", RFC 2348, May 1998.

Malkin, G. and A. Harkin, "TFTP Timeout Interval and Transfer Size Options", RFC 2349, May 1998.

Postel, J., "Internet Protocol", STD 5, RFC 791, September 1981.

Deering, S. and R. Hinden, "Internet Protocol, Version 6 (IPv6) Specification", RFC 2460, December 1998.


Gorry Fairhurst - Date: 28/4/2011 EG3567