如何使我的 tftp 服务器在本地网络上可见/可用?

Ale*_*uer 5 server iptables networking tftp

我查看了以下问题但没有成功:

我尝试过使用 tftp-hpa、atftpd 和 tftp。我又回到了 tftp,因为使用其他的没有什么区别。

到目前为止我有:

安装了tftp

sudo apt-get install xinetd tftpd tftp
Run Code Online (Sandbox Code Playgroud)

设置/etc/xinetd.d/tftp

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}
Run Code Online (Sandbox Code Playgroud)

创建 /tftpboot 文件夹并为其运行以下命令:

sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot
Run Code Online (Sandbox Code Playgroud)

我已经通过 iptables 允许端口 69:

sudo iptables -A INPUT -p tcp --dport 69 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 69 -j ACCEPT
sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:tftp
ACCEPT     udp  --  anywhere             anywhere             udp dpt:tftp
Run Code Online (Sandbox Code Playgroud)

并重新启动服务:

sudo /etc/init.d/xinetd restart
Run Code Online (Sandbox Code Playgroud)

我可以使用 localhost 正常连接(如果我明确使用 127.0.0.1,结果相同):

tftp localhost
tftp> status
Connected to localhost.
Mode: netascii Verbose: off Tracing: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> get test
Received 21 bytes in 0.0 seconds
tftp> quit
Run Code Online (Sandbox Code Playgroud)

但是,我的同事都无法从他们的计算机(相同的网络、相同的子网掩码)访问它,最重要的是,我无法从我需要它的嵌入式板访问它(以太网电缆插入同一交换机)。我已经用谷歌搜索了几个小时,但还没有找到解决办法。

它在本地工作的事实表明它是防火墙/端口问题,但 iptables 允许端口 69,我不确定我还能做什么。

Gen*_*Gen 3

由于您只有INPUT规则,这意味着您只接受来自端口 69 的传入流量,但也有传出流量,这意味着您也需要ACCEPT传出流量。

sudo iptables -A OUTPUT -p tcp --dport 69 -j ACCEPT
sudo iptables -A OUTPUT -p udp --dport 69 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)