ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux-TFTP服务

2020-03-13 20:06:22  阅读:268  来源: 互联网

标签:服务 server xinetd usr linux TFTP root tftp


1、TFTP协议简介
TFTP,全称是 Trivial File Transfer Protocol(简单文件传输协议),基于 UDP 实现,该协议简单到只能从远程服务器读取数据或向远程服务器上传数据。

2、TFTP实战
  1>环境准备:centos7

192.168.100.101     tftp-server
192.168.100.20      tftp-client

server端和client端分别关闭防火墙,禁用selinux # systemctl disable firewall;systemctl stop firewall 修改/etc/sysconfig/selinux,将SELINUX设定为disable,使用命令setenforce 0让selinux配置文件生效

  2>linux服务端 tftp-server 配置
  安装tftp服务器,需要安装xinetd(守护tftp)、tftp和tftp-server 3个软件

[root@tftp-server ~]# yum install xinetd tftp tftp-server -y
[root@tftp-server ~]# rpm -ql tftp-server
/etc/xinetd.d/tftp
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot

#/var/lib/tftpboot为存放数据的文件,也就是说从服务器端下载文件必须放于此目录下

  修改/etc/xinetd.d/tftp文件,将其中的disable=yes改为disable=no。开启TFTP服务,启动服务。

 

  3>启动tftp服务器,并查看是否开启

[root@tftp-server ~]# systemctl enable xinetd;systemctl start xinetd
[root@tftp-server ~]# netstat -a | grep tftp
udp        0      0 0.0.0.0:tftp            0.0.0.0:*

  4>在tftp服务器目录,创建测试文件

[root@tftp-server ~]# echo hello > /var/lib/tftpboot/test

  5>客户端安装tftp包,使用tftp工具从远程服务器下载文件

[root@tftp-client ~]# yum install tftp -y
[root@tftp-client ~]# tftp 192.168.100.101
tftp> get test
tftp> q
[root@tftp-client ~]# ls
anaconda-ks.cfg test
[root@tftp-client ~]# cat test
hello

  6>tftp命令用法如下

tftp your-ip-address

进入TFTP操作:
connect:连接到远程tftp服务器
mode:文件传输模式
put:上传文件
get:下载文件
quit:退出
verbose:显示详细的处理信息
tarce:显示包路径
status:显示当前状态信息
binary:二进制传输模式
ascii:ascii传送模式
rexmt:设置包传输的超时时间
timeout:设置重传的超时时间
help:帮助信息
?:帮助信息

 

标签:服务,server,xinetd,usr,linux,TFTP,root,tftp
来源: https://www.cnblogs.com/zyybky/p/12488620.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有