
In this article, we are going to teach you How to Install TFTP Server on Ubuntu 20.04. TFTP is an absolutely essential communication device when exchanging data between two computer systems on a network. One of the simplest protocols developed specifically for this purpose is the Trivial File Transfer Protocol or TFTP, which has played an important role in the development of the Internet. To install and operate tftp server, you can visit the Linux VPS plans offered in NeuronVM.
What is TFTP?
TFTP is a Trivial File Transfer Protocol on a computer network and is a simplified version of the file transfer protocol or FTP that does not use the TCP protocol but uses UDP over IP port 69. It is a bit slower because the TFTP protocol does not support framing. As a result, if the latency in the network is high, its efficiency will decrease. This is why it is commonly used in local area networks.
TFTP is used where it is unnecessary to authenticate the user and view the directory. The original TFTP specification was released in June 1981 on RFC 783. The current standard was published in 1992 in RFC 1350. TFTP cannot list directories or permissions via chmod.
How to Install TFTP Server on Ubuntu 20.04
First of all, you should update the APT package repository cache by entering the following command:
sudo apt update
Then you can install the tftpd-hpa package by using the following command:
sudo apt install tftpd-hpa
Now, you can check the status of tftpd-hpa service with the following command:
sudo systemctl status tftpd-hpa
How to Configure TFTP Server on Ubuntu 20.04
The default configuration tftpd-hpa file is /etc/default/tftpd-hpa. First, you need to open your desired text editor and modify the configuration file by entering the following command:
sudo nano /etc/default/tftpd-hpa
Remember to restart the tftpd-hpa service.
Then the configuration file is opened for editing, which is the default configuration of the TFTP server.
TFTP_USERNAME is set to tftp to run the TFTP server as the user tftp.
TFTP_DIRECTORY is set to /var/lib/tftpboot so that you can access it via TFTP.
TFTP_ADDRESS is set to :69 which means TFTP will run on port 69.
TFTP_OPTIONS is set to –secure which sets the TFTP options. The –secure option is a security feature that means changing the TFTP directory to something set on the TFTP_DIRECTORY variable when automatically connecting to the TFTP server.
You should add the –create option to TFTP_OPTIONS to change TFTP_DIRECTORY to /tftp. You can create or upload new files to the TFTP server by adding –create to TFTP_OPTIONS.
Now you should press Ctrl+X, y, and Enter to save the changes.
In the next step, you need to create a new /tftp directory by entering the following command:
sudo mkdir /tftp
Then you should change the owner and group of the /tftp directory to tftp. To do this, just run the following command:
sudo chown tftp:tftp /tftp
Now you need to restart the tftpd-hpa:
sudo systemctl restart tftpd-hpa
Finally, you can check if the service is running with the following command:
sudo systemctl status tftpd-hpa
How to Test TFTP Server on Ubuntu 20.04
A TFTP client program is required to access the TFTP server. There are many TFTP client programs. Devices that use the TFTP server already have the client program installed on them.
First, you should install the tftp-hpa TFTP client. To do this, run the following command:
sudo apt update sudo apt install tftp-hpa
Now you should find the IP address of the TFTP server by executing the following command:
ip a
You can connect to the TFTP server from your other computer with the following command:
tftp 'IP-address'
Note: Remember to replace your IP address with the IP-address in the command.
In this step, you need to enable verbose mode by executing the following command:
tftp> verbose
Next, you should upload a file from the current working directory. To do this enter the following command:
tftp> put rancheros.iso
Now the file should be uploaded to the TFTP server.
You can download the file rancheros.iso by executing the following command:
tftp> get rancheros.iso
Finally, you can exit out of the tftp shell by running the following command:
tftp> quit
Conclusion
TFTP protocol is commonly used to automatically transfer boot files and configure devices such as routers and switches on local networks. This article introduced you to the TFTP server and taught you how to install the TFTP server on Ubuntu 20.04. I hope this tutorial was useful for you.
No Comments