CentOS7下tftp服务安装配置

时光总嘲笑我的痴心妄想 提交于 2019-11-25 23:37:01

1、软件包安装

root用户或者普通用户使用sudo权限执行如下命令:

yum install xinetd tftp tftp-server        # root 用户执行
sudo yum install xinetd tftp tftp-server   # 普通用户执行

2、tftp-Server服务配置

[root@localhost ~]# cat /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 /var/lib/tftpboot -c   # 注意这行,如果允许上传,一定要加上参数 -c
    disable            = no   # 这行默认为yes,改成no,允许
    per_source         = 11
    cps                = 100 2
    flags              = IPv4
}

3、启动tftp服务

[root@localhost ~]#systemctl restart xinetd.service 
[root@localhost ~]#netstat -a | grep tftp 
[root@localhost ~]#netstat -tunap | grep :69

4、测试上传下载

C:\>d:

D:\>tftp 10.190.38.213 get test.log
传输成功: 1 秒 17 字节,17 字节/秒

D:\>tftp 10.190.38.213 put d:\readme
传输成功: 1 秒 474 字节,474 字节/秒

D:\>

5、常见问题处理

5.1 如果上传时出现"连接请求失败"的提示,请确保tftp服务的文件存放目录权限设置正确

  • 解决办法:chmod  0777  /var/lib/tftpboot

5.2 文件上传时提示:Error code 1: File not found

在/etc/xinetd.d/tftp配置文件中,server_args后加上 -c 选项,方可上传

service tftp
{
    socket_type     = dgram
    protocol        = udp
    wait            = yes   
    user            = root  
    server          = /usr/sbin/in.tftpd
    server_args     = -s /var/lib/tftpboot -c
    disable         = no    
    per_source      = 11    
    cps             = 100 2 
    flags           = IPv4  
}

5.3 待续...

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!