Christmas Offer - Every Learner Must Check Out - Flat 88% OFF on All Access Pass
00
days
:
00
hours
:
00
minutes
:
00
seconds
PyNet Labs- Network Automation Specialists

What is TFTP Protocol?

Author : PyNet Labs
Last Modified: March 8, 2024 
A blog featured image with text - What is TFTP Protocol and an image showing TFTP Protocol working

Introduction

FTP or file transfer protocol is a standard protocol for exchanging files between two devices inside a network. However, FTP also has some drawbacks, such as requiring a lot of resources and having some compatibility issues with different operating systems. That’s why a more straightforward and lighter alternative to FTP is needed. That’s where TFTP protocol or trivial file transfer protocol comes into action. It is lightweight and simple and allows the transfer of files over a network.

In this blog, we will be explaining what is TFTP, its purpose, how it works, and its advantages and disadvantages.

Let’s first understand what TFTP is.

What is TFTP in Computer Networks?

TFTP stands for trivial file transfer protocol that belongs to the application layer of the TCP/IP model. It uses UDP (User Datagram Protocol) as its transport layer protocol. This means it does not guarantee reliable delivery of packets or error detection and correction. TFTP operates on port 69 by default and uses a simple request-response mechanism to transfer files between the client and the server.

Now that we have a basic understanding of TFTP, let’s discuss its purpose.

Purpose of TFTP Protocol

The primary purpose of the TFTP protocol is to transfer files over a network simply and efficiently. It is mainly for devices that have limited memory or processing power. Apart from that, TFTP does not require any authentication or encryption. This is the reason it is faster and easier to implement when compared to FTP. TFTP does not authenticate and encrypt, making it less secure and vulnerable to attacks such as spoofing, interception, modification, or deletion of files. Therefore, TFTP can only be used in trusted networks or for non-sensitive data.

Let’s move on to the functioning of TFTP.

How Does Trivial File Transfer Protocol Work?

TFTP operates by utilizing a method of communication, i.e., request and response between a client and a server to transfer files. Below, we have explained the step-by-step guide on how TFTP functions.

An image showing how the TFTP Protocol works. Two box containing Client and Server interacts with each other.
  • Imagine a situation where the client intends to download a file called “config.txt” from the server while using octet mode. The client initiates the process by sending an RRQ (Read Request) message to the server through port 69, including both the file name and the desired transfer mode.
  • Upon receiving this request, the server performs two checks: it verifies if the requested file exists and ensures that the client can access it. If both conditions are met, an ACK (Acknowledgment) message with block number 0 is sent back to acknowledge the request. However, if either condition fails, an ERROR message containing an error code and accompanying message is sent instead.
  • Once the client receives confirmation in the form of an ACK message, it proceeds by sending another RRQ message but with block number 1, this time specifically requesting the data packet.
  • Responding to this request from the client, the server sends over the data packet, which carries 512 bytes of information along with block number 1.
  • The client acknowledges receipt of this data packet by sending another ACK message confirming its reception and specifically referencing block number 1.
  • The process continues as such; The server transmits data packets containing chunks of information in blocks numbered accordingly (e.g., block number 2). Each time these data packets are received, they are acknowledged via corresponding ACK messages referencing their block numbers.
  • This back-and-forth exchange between client and server continues until all requested data has been transferred successfully or until any unforeseen issues arise during transmission.
  • The process continues until the server sends the last data packet, which is smaller than 512 bytes and indicates the EOF.
  • After that, the client receives the EOF packet, and in response to that, the client sends an ACK message with the block number as the EOF packet to acknowledge it.
  • The file transfer is complete.

Note: The process is similar to uploading a file from a client to a server, except that the client sends WRQ messages instead of RRQ messages, and the server sends data packets instead of ACK messages.

TFTP Message Formats

Below are four types of TFTP message formats:

Read request

It is also called Type 1, and the client uses it to get a duplicate of the file from the server. The read request format is given below.

Read Request (1)

(2 Octets)
File Name

(variable)
0

(1 Octet)
Mode

(Variable)
0

(1 Octet)

Write request

It is also called Type 2 and is used by the client to write a file to the server. The write request format is given below.

Write Request (2)

(2 Octets)
File Name

(variable)
0

(1 Octet)
Mode

(variable)
0

(1 Octet)

Data

It is also called Type 3 and consists of a part of the file that is being duplicated. The data block is of fixed size, i.e. 512 octets. The data format is given below.

Data (3)

(2 Octets)
Sequence Number

(2 Octets)
Data

(Upto 512 octets)

Acknowledgment

It is also called Type 4, and the data shown at the end of the message consists of an end-of-file (EOF) where the size is less than 512 octets. Both the client and the servicer use acknowledgment to acknowledge the received data.

Ack (4)

(2 Octets)
Sequence Number

(2 Octets)

These are the various TFTP Protocol Message Types.

Different Modes of TFTP Protocol

The different modes of TFTP are:

  • Read: The first step is the client requests (RRQ) a packet or file from the server.
  • Write: The client sends a file to the server, i.e., WRQ.
  • Data carry: This is the process in which the server sends data packets to the client or vice versa. TFTP data message contains only the part of the intended file, i.e., block. The total size of the block must be less than 512 bytes.
  • Acknowledge: The client or server confirms the receipt of a data packet.
  • Error: The client or server reports an error during the transfer.

TFTP Protocol Applications

Here are some applications of TFTP Protocol –

  • It is used to share files within clients and services connected to the network.
  • It is used to share configuration files within the network.
  • It is used in applications where there is no need for authentication.
  • It is used to update the firmware on network-connected devices.

How to use TFTP Protocol?

The first command used for TFTP service is tftp, and many subcommands are used in this command, which gives additional options. The usage of the utftp command is similar, but it does not overwrite the files while uploading. GET and PUT are important subcommands of tftp and utftp. The put command is used to upload a file to a remote location, and the Get command is used to retrieve a file from a remote location.

Copying files from a source location requires the client to have read permissions on that directory and file. To upload files to the destination repository location, the client must have write permission. For example, to retrieve a file named config.file from a remote server named server01, type the command below:

tftp server01 get config.file

The Status and Verbose subcommands are used to confirm TFTP services and to check the documentation or man pages for other options. TFTP is more limited than FTP, and the client does not list, rename, or delete files on the remote system through it, as TFTP is primarily used to transfer files quickly in an automated or scripted manner.

TFTP vs FTP

  • Early versions of TFTP allowed sharing of files up to 32MB in size, and some of the latest TFTP servers reduce this limit or may limit the file to 4GB in size.
  • Unlike FTP, TFTP does not include a login feature, so there is no prompt for a username and password. Audit access to files or delicate files cannot be secured without the use of TFTP to transfer delicate files.
  • On TFTP, there is no need to list, rename, and delete files.
  • To make a network connection, TFTP uses UDP port 69, while FTP uses TCP ports 20 and 21.
  • Because TFTP is executed via UDP, it generally only works on LANs (Local Area Networks).

Let’s now move on to the advantages and disadvantages associated with TFTP in computer networks.

Advantages of TFTP Protocol in Networking

Some of the advantages of using TFTP Protocol are:

  • The implementation and usage of TFTP are straightforward and user-friendly.
  • No authentication or encryption is required, resulting in reduced faster file transfer speeds.
  • TFTP utilizes UDP, making it capable of handling network latency and packet loss.
  • It can effortlessly transfer files of any type or size.

Disadvantages of TFTP Protocol in Networking

Besides all the advantages we have discussed, TFTP has some disadvantages. These are:

  • In terms of security, attackers can easily intercept or modify the data or packet.
  • It does not provide any error checking or recovery mechanism. This can further lead to corrupted and incomplete files.
  • It does not support features like directory listing, file renaming, file appending, or file locking.
  • TFTP can easily cause network congestion because it uses UDP, and in the case of UDP, multiple packets are sent without waiting for acknowledgments.

These are the advantages and disadvantages of TFTP – Trivial File Transfer Protocol.

Frequently Asked Questions

Q1. What is the TFTP protocol used for?

TFTP protocol is used for transferring files from one device to another in a network.

Q2. Does TFTP use TCP or UDP?

TFTP uses UDP (User datagram protocol) as UDP is faster and simpler as compared to TCP and also less secure.

Q3. What port protocol is TFTP?

TFTP is a simple protocol that is mainly used for transferring files which is implemented over UDP/IP protocols at port number 69.

Q4. What is the protocol number for TFTP?

The default protocol number for TFTP is 69.

Conclusion

TFTP Protocol is a simple and lighter alternative to FTP that allows the transfer of files between two devices in a network. In this blog, we have discussed what is TFTP in computer networks, its purpose, functioning, and advantages and disadvantages.

If you have any suggestions or queries, feel free to comment below. Learn CCNA to understand FTP or TFTP Protocols. If you are looking to advance your career, you should go for CCNP ENCOR.

Recent Blog Post

Leave a Reply

Your email address will not be published. Required fields are marked *

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram