How to Set up a TFTP Server on a Ubuntu Linux Operating System

Beaglebone black board

In this article, we show how to set up a TFTP server on a ubuntu linux operating system host, so that files can be transferred from the host to a remote device using the TFTP protocol.

The host computer can be your laptop or a virtual operating system on your laptop and the remote device can be a microcomputer such as a beaglebone board.

TFTP stands for trivial file transfer protocol.

It is a simplified alternative to FTP that is not secure and provides no authentication.

Due to being very simplistic, the TFTP protocol can be implemented by a device with little RAM. It is used, therefore, as a protocol of choice for the initial stages of various network booting strategies when working with low resource single-board computers and system on a chip. Additionally, the protocol is also used to transfer firmware images and configuration files to network appliances like routers, firewalls, etc.

Lending to its simplistic, unintensive RAM demands, the TFTP protocol is one method that is used to boot single board computer devices such as beaglebone boards.

Third stage bootloaders such as U-boot support the TFTP protocol, so this protocol is used as a way to boot a board through network connection where an ethernet cable is the way of transfer data for the TFTP protocol.

The TFTP protocol follows the client-server model, where the host computer (the computer with the much greater resources such as your laptop) functions as the server and the remote computer (the computer with less resources such as a beaglebone board) functions as the client. The client will fetch the necessary files from the server in order to boot a linux kernel and run an operating system. It will do this via network connection and the files will be transferred via ethernet cables.

So how do we set up a TFTP server in a ubuntu linux environment?

The first thing we need to do is go to the terminal in the ubuntu linux operating system and enter in the following shown below.

This will download to your host computer.

The downloading of these modules is shown below.

Setting up a TFTP server- Installing xinetd, tftp, tftpd

The next thing we need to do is create/open the file, tftp, in the below directory.

This is done through the following line of code shown below.

This will open up the file, tftp, where we can now enter in the code needed to set up the TFTP server.

The contents that must be placed into this file is shown below.

service tftp
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /var/lib/tftpboot -s
disable = no

This is shown in the file also at the following link: tftp

Once this is done, it should resemble the content as shown below.

Setting up a TFTP server- Creating the tftp file

Once this is done, exit this file and go back to the terminal.

We need to now create a folder named tftpboot and set the necessary permissions of this folder.

Enter in the following commands in the terminal.

Once you have entered in these commands, then we need to restart the xinetd service.

We restart the xinetd service through the following command shown below.

Now the xinetd daemon is running.

When this is done successfully, you will get an output such as that shown below.

Setting up a TFTP server- Restarting the xinetd service

So now we have a TFTP server running on our ubuntu linux environment, which we can then use to do things such as boot a single board computer such as a beaglebone board through TFTP protocol.

Related Resources

HTML Comment Box is loading comments...