What is the TFTP Protocol - an Overview
One of the most important functions of a server or client in a network is transferring files to be able to read, write, modify content on the remote device, or create a backup. During operation and for complex operations, the File Transfer Protocol (FTP) is used, which is excellent for various tasks - from exchanging data to backing up important files to accessing a hierarchical file system. In contrast, the Trivial File Transfer Protocol (TFTP) is less complex and very easy to implement, and it has its own advantages and disadvantages compared to FTP.
Key Differences Between FTP and TFTP
As a tool for administration, FTP has numerous commands, many of which require user authentication. In contrast, TFTP's command set is limited to just eleven commands, some of which are also found in FTP but do not include advanced operations like changing access rights. Its main purpose is fast, simple, and reliable file transfer, without considerations for aspects such as increased security or complex functions like backing up directories.
This is evident, for example, in the fact that TFTP, unlike FTP, does not require user authentication. It does not support secure login via passwords and limits access solely based on the file's read and write permissions in the operating system. In practice, this means that TFTP operates only in directories and with files that have been shared with all users and can be globally read and written to. Due to its lack of security, TFTP, unlike FTP, should only be used in local and isolated networks.
Another difference from FTP with TFTP is that it solely relies on the connectionless UDP protocol and does not allow a permanent connection via TCP/IP. This apparent disadvantage compared to FTP allows for the use of very small, efficient, and reliable clients in practice, which may be integrated into the boot environment and ensure accessibility even after a server failure without a functioning operating system or local backup.
One similarity between TFTP and FTP, however, is that the port used serves exclusively as a command port, and file transfer occurs on another randomly selected port between 1024 and 65535.
This approach enables a continuous connection between the server and client during the transfer, preventing a server failure in case of errors.
Establishing a Connection via TFTP
For file transfer via TFTP, the client searches for an active server and sends a request for a specific file, such as a backup. This initial contact is made using prescribed parameters, including port 69 and the UDP protocol. The process of communication for reading a file differs from FTP and looks, for example, as follows:
- Client selects a random port for the connection.
- Client sends a request for file name.typ from this port to port 69 via the UDP protocol.
- Server receives the request and either grants or denies access.
- If permission is granted, the server also selects a random port.
- Server sends the first data packet to the client port from its port.
- Client acknowledges receipt by sending an ACK to the server port.
- Server sends additional numbered packets to the client once the receipt of the previous one is confirmed.
- In case of packet loss, the server sends a backup until it receives an ACK.
- If errors occur, the client sends an error message and the transfer is aborted.
- A data packet smaller than the standard size signals the end of the transmission.
Using TFTP for Booting or Server Monitoring
Unlike FTP, the primary use of TFTP is not for user file transfers but for booting over the network. When enabled as a fixed instance in the BIOS, a computer can automatically load a minimal operating system and start the rescue system even in the event of a server failure or system drive failure. This allows for damage analysis and server monitoring without local access. For example, if booting via TFTP is directly behind the primary boot medium, the computer will automatically request a rescue image from a running server after a server failure due to a drive failure on its subsequent restart.
Although TFTP does not provide its own server monitoring or backup capabilities, this can be achieved by setting up a special system via a TFTP server. This task is not possible with FTP, as the FTP client used for this purpose would be too memory-intensive and complex to embed in a computer's BIOS. Almost every modern computer today supports booting via the Preboot Execution Environment (PXE), which uses TFTP to load the operating system.
Another use of PXE and TFTP is the installation of operating systems on numerous, often identical computers or servers - for example, in a data centre. With appropriate configuration, a single backup secured via FTP can be deployed as the source on all connected servers. By assigning individual file names, a backup can also be uniquely associated, so that after a server failure, a computer or the server monitoring automatically retrieves the operating system and reinstalls itself.
In the past, TFTP was also used to operate terminals and workstations without their own storage media. In this case, the computer loads the backup of its operating system from a central server during startup and sets up direct access to its storage resources. This usage has almost lost its significance today due to the decreased prices of drives and only plays a role in special environments such as a server cluster with central storage management and server monitoring of individual instances.
Photo: dlohner pixabay.com
Write a comment
- FTP
Tags for this article
More web hosts
More interesting articles
Upload website to the webspace via FTP
To upload the data of your own online presence to the webspace, the File Transfer Protocol FTP is used.
What is SFTP?
We show you what the difference between SFTP and regular FTP is and what you should use.
What is FTP? The protocol & important commands
We explain what the FTP protocol is and show you important programs.
The 5 Best FTP Programs Overview
We show you the 5 best FTP programs overview. Everything about transferring your content to your server.