如何在 14.04 上安装和配置 TFTP 服务器

Pau*_*maz 4 networking tftp 14.04

我一直在尝试使用我在网上找到的文章在新的 Ubuntu 14.04 版本上构建 TFTP 服务器数周,但我所有的尝试似乎都失败了,因为我安装的 TFTP 服务器似乎没有做出回应。无论我是 GET 还是 PUT,我总是收到超时错误。

我尝试过的最新文章是:

这两个都没有成功,每次都是 TFTP 客户端抱怨超时错误。

我已经向 UFW 和 iptables 添加(或至少我认为我有)规则以允许访问 UDP 端口 69,但没有任何成功。

我一直在从 mini.iso 文件构建我的基本 Ubuntu 14.04 操作系统,我从 Ubuntu 下载页面下载到在我的 Win7 pro 机器上运行的 VirtualBox VM(版本 4.3.8 r92456)。在初始构建期间没有安装其他软件包,但我在初始构建后安装了 SSH 和 NTP(两者似乎都在工作)。TFTP 客户端在我的 Win7 机器上运行,而 Ubuntu 机器有一个静态 IP 地址。


连接是从我的 Win7 机器上的远程 TFTP 客户端建立的。

$ netstat -apu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 *:tftp                  *:*                                 8166/xinetd
udp        0      0 test.paumaz.local:ntp   *:*                                 1332/ntpd
udp        0      0 localhost:ntp           *:*                                 1332/ntpd
udp        0      0 *:ntp                   *:*                                 1332/ntpd
udp6       0      0 fe80::250:56ff:febe:ntp [::]:*                              1332/ntpd
udp6       0      0 localhost:ntp           [::]:*                              1332/ntpd
udp6       0      0 [::]:ntp                [::]:*                              1332/ntpd

$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:mysql         *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp6       0      0 [::]:http               [::]:*                  LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
udp        0      0 *:tftp                  *:*
udp        0      0 test.paumz.local:ntp    *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
udp6       0      0 fe80::250:56ff:febe:ntp [::]:*
udp6       0      0 localhost:ntp           [::]:*
udp6       0      0 [::]:ntp                [::]:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     7010     @/com/ubuntu/upstart
unix  2      [ ACC ]     STREAM     LISTENING     7559     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     SEQPACKET  LISTENING     7370     /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     9458     /var/run/mysqld/mysqld.sock
unix  2      [ ACC ]     STREAM     LISTENING     9209     /var/run/acpid.socket
Run Code Online (Sandbox Code Playgroud)

270*_*974 9

安装以下软件包。

sudo apt-get install xinetd tftpd tftp

创建 /etc/xinetd.d/tftp

sudo nano /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该文件夹应与您输入的内容相匹配server_args。主要是 tftpboot

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

重新启动xinetd服务。

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

您必须udp port 69在防火墙中允许。

编辑 1

在此处输入图片说明

就像我说的,首先tftp localhost,然后get ...

给出输出 cat /var/log/syslog | grep tftp