tftp server configuration and description

1. The meaning of tftp

Baidu Encyclopedia's explanation is: TFTP (Trivial File Transfer Protocol, simple file transfer protocol) is a protocol in the TCP/IP protocol family for simple file transfer between the client and the server , providing uncomplicated and low-cost file transfer service. The port number is 69.

Therefore, we can know that tftp is a protocol used for file transfer. Generally, it cannot transfer particularly large files. It is often used to transfer some small files, such as compiled firmware.

2. Configure tftp on the ubuntu virtual machine

Let's configure tftp on the virtual machine. First, you need to prepare a folder to store the files to be transferred, and set this folder to be readable and writable by other programs, so that it will not be caused by permission issues later. Transfer failed.

insert image description here
The location of the created folder is as follows:
insert image description here
Install some tftp below, just use apt to install it directly:

sudo apt-get install tftp-hpa tftpd-hpa
sudo apt-get install xinetd

The effect of the installation is as follows:
insert image description here
Then check whether the relevant files exist, use the command: (if it is the same as the figure below, there is no problem)
insert image description here
modify the configuration of tftp, the command used is as follows:

sudo vim /etc/default/tftpd-hpa

Replace the original content with:

# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"

The effect is as
insert image description here
follows Create a new file and copy the following content into it

sudo vi /etc/xinetd.d/tftp

What needs to be copied is:

service tftp
{
    
    
socket_type = dgram
wait = yes
disable = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
#log_on_success += PID HOST DURATION
#log_on_failure += HOST
per_source = 11
cps =100 2
flags =IPv4
}

The effect after copying is as follows:
insert image description here
Next, you need to restart the service

sudo service tftpd-hpa restart
sudo /etc/init.d/xinetd reload
sudo /etc/init.d/xinetd restart

Seeing OK indicates that the restart has been completed.
insert image description here
Next, you can perform a simple test. Create a new file under the original tftp folder, then use tftp to obtain it in another path, transfer the specified file, and you can see the file transfer success!
insert image description here

3. Configure tftp on the win platform

The win platform requires us to prepare a tool in advance, and use this tool to realize tftp transmission. The tool is tftpd64, which can be found by direct Baidu search. It should be relatively classic, so it is easy to find. The page is as follows: Select the client page,
insert image description here
try Try to transfer the file just now.
insert image description here
Click get to see that the file exists. Click OK to start the file transfer. The
insert image description here
transferred file is placed in the folder at the beginning, as shown
insert image description here
below. Let’s test the PC side as The use of the client is as follows:
insert image description here
here is still the line to select the path, you can view the files under the path, as shown below:
insert image description here
Therefore, the original method is still used for transmission, as shown below: (remember to run as an administrator here, Otherwise, the permission will not work)
insert image description here
The transmission is successful, as shown below
insert image description here

4. Some minor issues that need attention

What needs to be noted here is what needs to be paid attention to when the virtual machine is connected to the external device:
insert image description here
this is implemented using NAT mode, so the external device cannot find this device, so if you need the external device and the virtual machine It cannot be realized by tftp connection between them, and it still needs to be realized through windows, so this tool can come in handy.

Guess you like

Origin blog.csdn.net/m0_51220742/article/details/126861282
Recommended