This article is first published in the dark world.
Why should I learn how to install and configure the TFTP server? It is mainly used to prepare for unattended installation of Linux systems.
TFTP simple File Transfer Protocol, using UDP port 69. It mainly provides file upload and download. TFTP is generally applicable to remote diskless device startup, PXE startup, and router and switch IOS backup, recovery, and upgrade.
Compared with FTP, TFTP cannot list contents of directories, does not support authentication and encryption, and only supports UDP protocol.
The above are related to the characteristics of TFTP. Next we will start to install the TFTP service.
Note: in future blogs, I will try my best to operate on Ubuntu, and try not to use tools related to remote Linux connection on Windows.
Log on to the Ubuntu system and enter the following command in the terminal. Connect to the remote centos system as follows:
SSH [email protected]
650) This. width = 650; "Title =" clip_image002 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image002 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200782SMGc.jpg "width =" 727 "Height =" 255 "/>
The TFTP software package includes the TFTP client and the TFTP-server. Install the TFTP client as follows:
Yum-y install TFTP
650) This. width = 650; "Title =" clip_image004 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image004 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200782qXhQ.jpg "width =" 716 "Height =" 233 "/>
650) This. width = 650; "Title =" clip_image006 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image006 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200783Qgdl.jpg "width =" 725 "Height =" 365 "/>
Install TFTP-server as follows:
Yum-y install TFTP-Server
650) This. width = 650; "Title =" clip_image008 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image008 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200783B6i0.jpg "width =" 697 "Height =" 269 "/>
650) This. width = 650; "Title =" clip_image010 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image010 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200784ZQgQ.jpg "width =" 741 "Height =" 250 "/>
We can also see that xinetd is also installed when TFTP-server is installed. Based on the provided information, we can also see that the normal operation of the TFTP service depends on the xinetd service.
According to the query results, the TFTP service does not have a separate service process as the FTP service. It depends on the xinetd service to start. That is to say, we need to check whether the TFTP service is running normally. Just check the xinetd service.
View the related files after TFTP and TFTP-server are installed as follows:
Rpm-QL TFTP
Rpm-ql tftp-Server
650) This. width = 650; "Title =" clip_image012 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image012 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200785x0RY.jpg "width =" 523 "Height =" 400 "/>
We can see that the TFTP running file is located at/usr/bin/TFTP, And the configuration file is located at/etc/xinetd. d/TFTP.
Modify the TFTP configuration file as follows:
VI/etc/xinetd. d/TFTP
650) This. width = 650; "Title =" clip_image014 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image014 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_14092007852b3z.jpg "width =" 593 "Height =" 361 "/>
650) This. width = 650; "Title =" clip_image016 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image016 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200786nA7b.jpg "width =" 760 "Height =" 358 "/>
We can see that the TFTP configuration file is very simple. In this configuration file, we only need to modify one disable = yes. Change this parameter to No.
Server_args indicates the TFTP Directory, which is in the/var/lib/tftpboot directory by default. You can customize the directory or use the default directory.
The modified content is as follows:
650) This. width = 650; "Title =" clip_image018 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image018 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200786t1lF.jpg "width =" 728 "Height =" 449 "/>
After the configuration file is modified, we will start the TFTP service now. Because the TFTP service depends on the xinetd service, we can directly start the xinetd service. At the same time, we can also check whether the TFTP port is running properly by checking port 69, as shown below:
/Etc/init. d/xinetd start
Netstat-tunlp | grep 69
650) This. width = 650; "Title =" clip_image020 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image020 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200787Lnwp.jpg "width =" 691 "Height =" 175 "/>
Signature, as follows:
650) This. width = 650; "Title =" clip_image022 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image022 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_14092007878Prc.jpg "width =" 571 "Height =" 157 "/>
650) This. width = 650; "Title =" clip_image024 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image024 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_14092007877bqk.jpg "width =" 450 "Height =" 131 "/>
Now, we start to use the client to connect to the TFTP. in the previous article, we have introduced TFTP, including the client and server. We first install the TFTP client on the client, where our client uses the Ubuntu system. Install the TFTP client in Ubuntu as follows:
Sudo apt-get-y install TFTP
650) This. width = 650; "Title =" clip_image026 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image026 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200788cqok.jpg "width =" 730 "Height =" 363 "/>
After the client is installed, We will connect the tftpserver and download the new file test_tftp.txt. Run the following command:
TFTP 192.168.1.213
Get test_tftp.txt
650) This. width = 650; "Title =" clip_image028 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image028 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200789GInX.jpg "width =" 661 "Height =" 229 "/>
We can see that we have successfully downloaded the file test_tftp.txt from the tftpserver.
Now we are uploading a file for testing. To test the TFTP upload function, we need to modify the configuration file of TFTP and the folder permission of the TFTP directory.
Modify the TFTP configuration file as follows:
Vim/etc/xinetd. d/TFTP
650) This. width = 650; "Title =" clip_image030 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image030 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200789FmOC.jpg "width =" 727 "Height =" 475 "/>
Note that adding-C to the server_args parameter indicates that files can be created.
After the TFTP configuration file is modified, modify the folder permissions of the TFTP directory. As follows:
650) This. width = 650; "Title =" clip_image032 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image032 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200790ZC14.jpg "width =" 575 "Height =" 120 "/>
Now we can see that the folder permission of the TFTP directory is 755.We have already introduced that TFTP does not support authentication and encryption. To have the upload permission, we need to set the permission for this directory to 777 and grant the upload and download permissions to all users., As follows:
Chmod 777./tftpboot/
650) This. width = 650; "Title =" clip_image034 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image034 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200790qJQW.jpg "width =" 652 "Height =" 156 "/>
After all the preceding modifications are complete, restart the xinetd service as follows:
/Etc/init. d/xinetd restart
650) This. width = 650; "Title =" clip_image036 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image036 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200790Gm1Y.jpg "width =" 733 "Height =" 154 "/>
Now let's test the upload permission. Run the PUT command as follows:
650) This. width = 650; "Title =" clip_image038 [4] "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image038 [4] "src =" http://img1.51cto.com/attachment/201408/28/526870_1409200791AVqL.jpg "width =" 954 "Height =" 182 "/>
For the tftp command, you can view the following connection: http://linux.die.net/man/8/tftpd
So far, the installation and configuration of the TFTP server are complete.
This article from the "muddy world" blog, please be sure to keep this source http://ilanni.blog.51cto.com/526870/1546103
Mud: centos installation and configuration of TFTP Server