CentOS tftp 服务器坏了

CentOS tftp 服务器坏了

tftpd我正在尝试在CentOS 6 上运行xinetd;但是,我只能从本地主机进行 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]#

答案1

在生产环境中,您可能希望专门允许 TFTP 通过防火墙。这可以通过运行system-config-firewall-tui、自定义防火墙并选择“TFTP”服务来实现。

答案2

iptablesCentOS默认阻止以太网接口上的入站 UDP tftp 请求...禁用该iptables服务即可解决问题(这是一台实验室机器,因此禁用iptables是可以的)。

[root@localhost mpenning]# chkconfig iptables off
[root@localhost mpenning]# /etc/init.d/iptables stop
[root@localhost mpenning]# 

相关内容