Article Title: Create TFTP for network startup and software and hardware upgrade. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories of TFTP (Trivial File Transfer Protocol, simple File Transfer Protocol) it is a protocol in the TCP/IP protocol family used to transmit simple files between the client and the server. It provides file transfer services that are not complex and costly. Although this rarely happens for network startup and software and hardware upgrades, it is important to master this technology when you need to set up and use a Trivial FTP (or TFTP) server. Unlike conventional FTP, TFTP has no authentication, no password, and many small features, so it is not FTP transmission. If TFTP is so difficult to use, why should it be used? Some drivers, especially routers and some high-end switches, use TFTP to upgrade hardware and software, and the advantages of TFTP in network startup will become particularly obvious. TFTP is still very useful when it is not as widely used as FTP. The ability to assign a TFTP server IP address through DHCP makes it very easy to use with over-simple features. It only points to the IP address of the TFTP server through the terminal device, makes software and hardware upgrades and network startup easy.
Most Linux distributions have a TFTP server to select available packages. Representative packages such as tftp-hpa are distributed in the kernel. If not, download and compile the installation package. There are few unconventional configurations that require you to complete "configure" and "make; make install.
With tftp-hpa, some measures to increase the security of this unreliable protocol are adopted. You can tell the background program that the in. tftpd service process will be used to change the program directory to serve folders and cancel privileges. Use this to create a special user name, tftpd, which has a directory-based home directory of TFTP, maybe/var/lib/tftpboot. Then access in. tftpd like this:
/Usr/sbin/in. tftpd-u tftpd-s/var/lib/tftpboot
If you install an RPM or DEB package, it is very likely that there will be an available initial script. Typically, in. tftpd is called a super server like inetd or xinetd. For example, the structure of an inetd is as follows:
Tftp dgram udp wait root/usr/sbin/in. tftpd in. tftpd-u tftpd-s/var/lib/tftpboot
Socket_type = dgram
Protocol = udp
Wait = yes
User = root
Server =/usr/sbin/in. tftpd
Server_args =-u tftpd-s/var/lib/tftpboot
The tftp-hpa package will also be accompanied by a tftp client program that can be used to test the client program.
To test some normal operations, start (or restart) xinetd or inetd, create a test folder, and use the tfpt client program to obtain the file:
|# Dd if =/dev/zero of =/var/lib/tftpboot/foo bs = 1024 count = 100
100 + 0 records in
100 + 0 records out
102400 bytes (102 kB) copied, 0.00041193 s, 249 MB/s
# Tftp-v localhost-c get foo
Connected to localhost (127.0.0.1), port 69
Getting from localhost: foo to foo [netascii]
Received 102400 bytes in 0.1 seconds [11872463 bit/s]
# Ls-l foo
-Rw-r -- 1 root 102400 2008-01-06 17:05 foo
Now you can use the TFTP server to provide a boot image for PXE booting or a hardware and software image for the router or other devices, so that you can upgrade the hardware and software through TFTP.