运维开发网

CentOS部署TFTP服务

运维开发网 https://www.qedev.com 2020-04-15 12:38 出处:网络 作者:运维开发网整理
1、安装tftp服务 [root@cxishs-Nettest ~]# yum install -y tftp-server Loaded plugins: fastestmirror, refresh-packagekit, security

1、安装tftp服务

[root@cxishs-Nettest ~]# yum install -y tftp-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:0.49-7.el6 will be installed
--> Processing Dependency: xinetd for package: tftp-server-0.49-7.el6.x86_64
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.14-39.el6_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================
 Package                 Arch               Version                        Repository            Size
======================================================================================================
Installing:
 tftp-server             x86_64             0.49-7.el6                     c6-media              39 k
Installing for dependencies:
 xinetd                  x86_64             2:2.3.14-39.el6_4              c6-media             121 k

Transaction Summary
======================================================================================================
Install       2 Package(s)

Total download size: 161 k
Installed size: 317 k
Downloading Packages:
------------------------------------------------------------------------------------------------------
Total                                                                 2.6 MB/s | 161 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 2:xinetd-2.3.14-39.el6_4.x86_64                                                    1/2 
  Installing : tftp-server-0.49-7.el6.x86_64                                                      2/2 
  Verifying  : tftp-server-0.49-7.el6.x86_64                                                      1/2 
  Verifying  : 2:xinetd-2.3.14-39.el6_4.x86_64                                                    2/2 

Installed:
  tftp-server.x86_64 0:0.49-7.el6                                                                     

Dependency Installed:
  xinetd.x86_64 2:2.3.14-39.el6_4                                                                     

Complete!
[root@cxishs-Nettest ~]#

2、修改TFTP配置文件

[root@cxishs-Nettest ~]# vi /etc/xinetd.d/tftp 

# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tmp/tftp/data -c         ##TFTP文件目录,-c表示支持上传
        disable                 = no                         ##开启服务,默认TFTP服务关闭
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
~
~
~
~
~
"/etc/xinetd.d/tftp" 18L, 514C written
[root@cxishs-Nettest ~]# 
[root@cxishs-Nettest ~]# mkdir /tmp/tftp
[root@cxishs-Nettest ~]# mkdir /tmp/tftp/data
[root@cxishs-Nettest ~]# chmod 777 /tmp/tftp
[root@cxishs-Nettest ~]# chmod 777 /tmp/tftp/data

3、重启并验证服务

[root@cxishs-Nettest ~]# /etc/init.d/xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]
[root@cxishs-Nettest ~]# netstat -au | grep tftp
udp        0      0 *:tftp                      *:*                                     
[root@cxishs-Nettest ~]#


使用感想:

在使用过程中,发现tftp服务器有假死现象,从客户端推送文件失败,而服务器上观察服务处于正常状态。

此时重启tftp服务后再次生效。因此,博主在计划任务里周期自动重启tftp服务,以保证tftp服务的可用性。

0

精彩评论

暂无评论...
验证码 换一张
取 消