In the network protocol, we should be familiar with the TFTP protocol. Today, we will focus on the configuration of the tftp server. TFTPTrivial File Transfer Protocol simple File Transfer Protocol) is a Protocol used in the TCP/IP Protocol family to transmit simple files between the client and the server, provides File Transfer services that are not complex and costly. TFTP is carried on UDP and provides unreliable data stream transmission services. It does not provide access authorization and authentication mechanisms, and uses the timeout retransmission method to ensure data arrival. Compared with FTP, TFTP is much smaller, and TFTP is the simplest network protocol used to download remote files. It is implemented based on UDP protocol. It uses UDP port 69.
Configure the tftp Server 1. Check whether the system has installed the tftp service.
- [root@wk ~]# rpm -qa | grep tftp
- tftp-0.42-3.1.el5.centos
- tftp-server-0.42-3.1.el5.centos
If no installation is available, you can mount the CentOS5.2 CD to install it.
- [root@wk ~]# mount -t auto /dev/cdrom /mnt/cdrom
- mount: block device /dev/cdrom is write-protected mounting read-only
- [root@wk ~]# cd /mnt/cdrom/CentOS
- [root@wk CentOS]# rpm -ivh tftp-0.42-3.1.el5.centos.i386.rpm
- [root@wk CentOS]# rpm -ivh tftp-server-0.42-3.1.el5.centos.i386.rpm
Configure the tftp Server 2. Modify the startup configuration file
By default, the TFTP service is disabled, so you need to modify the file to enable the Service.
Modify the/etc/xinetd. d/tftp file. It mainly sets the root directory of the TFTP server and enables the service.
The modified configuration file is as follows:
- Service tftp
- {
- Disable = yes. Change "yes" to "no ".
- Socket_type = dgram
- Protocol = udp
- Wait = yes
- User = root
- Server =/usr/sbin/in. tftpd
- Server_args =-s/tftpboot-c
- Per_source = 11
- CPIs = 100 2
- Flags = IPv4
- }
Specify/tftpboot as the root directory of the tftp server.
The-s parameter specifies the chroot and-c specifies the file to be created.
Configure the tftp server 3. Create the tftp root directory, disable the firewall, and start the tftp-server
- [root@wk ~]# mkdir /tftpboot
- [root@wk ~]# chmod -R 777 /tftpboot
- [root@wk ~]# /etc/init.d/iptables stop
- [root@wk ~]# service xinetd restart
Restart the xinetd service. Because the TFTP service is controlled by the xinetd service, xinetd is a service that manages services and does not open ports.
Check whether port 69 is enabled for TFTP:
- [root@wk ~]# netstat -nlp
- udp 0 0 0.0.0.0:67 0.0.0.0:* 5172/dnsmasq
- udp 0 0 0.0.0.0:67 0.0.0.0:* 4745/dhcpd
- udp 0 0 0.0.0.0:69 0.0.0.0:* 6171/xinetd
- udp 0 0 0.0.0.0:994 0.0.0.0:* 4633/rpc.rquotad
Configure the tftp Server 4. Test the tftp Server
- [root@wk ~]# tftp 192.168.0.110
- tftp>get
- tftp>put
- tftp>q