我试图tftpd
从xinetd
CentOS 6 上运行;但是,我只能从本地主机进行 tftp。
我有一个文件,/opt/tftpboot/fw.test.conf
如果我tftp
到本地主机,我可以检索它:
[mpenning@localhost ~]$ tftp localhost
tftp> get fw.test.conf
tftp> quit
[mpenning@localhost ~]$ ls
fw.test.conf
[mpenning@localhost ~]$
tftp
但是,如果我在eth1
这个服务器上(地址eth1
是172.16.1.4),我无法接收到这个文件。
[mpenning@localhost ~]$ sudo tshark -i eth1 udp and host 172.16.1.5
Running as user "root" and group "root". This could be dangerous.
Capturing on eth1
0.000000 172.16.1.5 -> 172.16.1.4 TFTP Read Request, File: fw.test.conf\000, Transfer type: netascii\000
5.000133 172.16.1.5 -> 172.16.1.4 TFTP Read Request, File: fw.test.conf\000, Transfer type: netascii\000
10.000184 172.16.1.5 -> 172.16.1.4 TFTP Read Request, File: fw.test.conf\000, Transfer type: netascii\000
15.000297 172.16.1.5 -> 172.16.1.4 TFTP Read Request, File: fw.test.conf\000, Transfer type: netascii\000
20.000331 172.16.1.5 -> 172.16.1.4 TFTP Read Request, File: fw.test.conf\000, Transfer type: netascii\000
^C5 packets captured
[mpenning@localhost ~]$
我有以下 xinetd 配置:
[root@localhost mpenning]# 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 /opt/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
[root@localhost mpenning]#
在生产环境中,您可能希望专门允许 TFTP 通过防火墙。这可以通过运行
system-config-firewall-tui
、自定义防火墙并选择“TFTP”服务来完成。CentOS 默认阻止以太网接口上的入站 UDP tftp 请求
iptables
...禁用该iptables
服务解决了问题(这是一台实验室机器,所以禁用iptables
是可以的)。