mxin
作者mxin·2023-08-11 13:09
资深工程师·上海宝信软件股份有限公司

tftp配置 win(client)+RHEL(server)

字数 3190阅读 529评论 0赞 2

部分源起网络
简单文件传输协议(Trivial File Transfer Protocol,TFTP)是一种基于 UDP 协议在客户端 和服务器之间进行简单文件传输的协议。顾名思义,它提供不复杂、开销不大的文件传输服 务(可将其当作 FTP 协议的简化版本)。
W in10安装tftp客户端

首先,打开“开始”菜单,然后单击“控制面板”。

2.在“控制面板”中,单击“程序和功能”,然后单击“打开或关闭Windows功能”。

3.在弹出的“Windows功能”窗口中,勾选“TFTP客户端”选项,然后单击“确定”按钮。

4.系统将自动安装TFTP客户端,安装完成后,即可在网络中传输文件。

本文介绍了如何在Windows 10系统中启用TFTP客户端,以便在网络中传输文件。首先,打开“开始”菜单,然后单击“控制面板”,在“控制面板”中,单击“程序和功能”,然后单击“打开或关闭Windows功能”,在弹出的“Windows功能”窗口中,勾选“TFTP客户端”选项,然后单击“确定”按钮,系统将自动安装TFTP客户端,安装完成后,即可在网络中传输文件。

RHEL7安装tftp-server端**


[root@linuxprobe ~]# yum install tftp-server tftp

Loaded plugins: langpacks, product-id, subscription-manager

………………省略部分输出信息………………

Installing:

tftp x86_64 5.2-11.el7 rhel 35 k

tftp-server x86_64 5.2-11.el7 rhel 44 k

Installing for dependencies:

xinetd x86_64 2:2.3.15-12.el7 rhel 128 k

Transaction Summary ===============================================================================

Install 2 Packages (+1 Dependent package)

Total download size: 207 k Installed size: 373 k

Is this ok [y/d/N]: y

Downloading packages:

………………省略部分输出信息………………

Installed:

tftp.x86_64 0:5.2-11.el7 tftp-server.x86_64 0:5.2-11.el7 Dependency Installed:

xinetd.x86_64 2:2.3.15-12.el7

Complete!

vim /etc/xinetd.d/tftp

 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

 }

然后,重启xinetd 服务并将它添加到系统的开机启动项中,以确保 TFTP 服务在系统重 启后依然处于运行状态。考虑到有些系统的防火墙默认没有允许 UDP 协议的 69 端口,因此 需要手动将该端口号加入到防火墙的允许策略中:

[root@linuxprobe ~]# systemctl restart xinetd

[root@linuxprobe ~]# systemctl enable xinetd

[root@linuxprobe ~]# firewall-cmd --permanent --add-port=69/udp

success

[root@linuxprobe ~]# firewall-cmd --reload

success

测试:

C:\Users\Administrator>echo 1234 > b

C:\Users\Administrator>tftp 192.168.10.10 put b

传输成功: 1 秒 7 字节,7 字节/秒

C:\Users\Administrator>tftp 192.168.10.10 get readme.txt

传输成功: 1 秒 13 字节,13 字节/秒

C:\Users\Administrator>type readme.txt

i lov linux

C:\Users\Administrator>

[root@linuxprobe ~]# cd /var/lib/tftpboot

[root@linuxprobe tftpboot]# ls

a b error.txt readme.txt

[root@linuxprobe tftpboot]# cat b

1234

[root@linuxprobe tftpboot]# cat readme.txt

i lov linux

[root@linuxprobe tftpboot]#

附: 安装过程中出现的问题及原因 现象一: tftp> get test.log Transfer timed out. 原因: tftpd服务没有启动

现象二 tftp> put test2 Error code 0: Permission denied

原因: 运行命令,查看系统日志 #tail /var/log/messages 发现有如下一段文字: Mar 24 19:05:26 localhost setroubleshoot: SELinux is preventing /usr/sbin/in.tftpd (tftpd_t) "write" to tftpboot (tftpdir_t). For complete SELinux messages. run sealert -l 40a5a6bf-8ded-4bfa-ab6e-fa669a25fc6c 知道这是是由SELinux造成的,在FC3和FC3以后的FC版本中SELinux默认的都是开启的,现关掉它,修改文件 /etc/sysconfig/selinux,设定其中的

SELINUX=disabled

然后重启电脑即可

或者执行命令system-config-securitylevel 打开 “安全级别配置”对话框,将SELinux(S)选项中 “强制” 改为“允许”。

现象三: tftp> put ex070416.log Error code 1: File not found 原因: 指定的文件不存在;或tftpd启动参数中没有指定-c选项,允许上传文件

现象四: tftp> get test.log Error code 2: Only absolute filenames allowed 原因: 在/etc/xinetd.d/tftpd中设置的server_args为/etc/default/tftpd-hpa cat /etc/default/tftpd-hpa #Defaults for tftpd-hpa RUN_DAEMON="no" OPTIONS="-s /home/tftpd -c -p -U 077 -u tftpd" 设置的时候只要将server_args=改为你自己设定的服务器文件夹就行了

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

2

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广