tftp服务器最简单安装配置
1.安装tftp-server
sudo apt-get install tftpd-hpa
sudo apt-get install tftp-hpa(如果不需要客户端可以不安装)
tftp-hpa是客户端
tftpd-hpa是服务器端
2.配置TFTP服务器
sudo vim /etc/default/tftpd-hpa
将原来的内容改为:
TFTP_USERNAME=”tftp”
TFTP_ADDRESS=”0.0.0.0:69″
TFTP_DIRECTORY=”tftp根目录” #服务器目录,需要设置权限为777,chomd 777
TFTP_OPTIONS=”-l -c -s”
我的文件内容如下:
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
#TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_DIRECTORY="/slq/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
#TFTP_OPTIONS="--secure"
TFTP_OPTIONS="-l -c -s"
服务器目录,需要设置权限为777,chomd 777 /slq/tftpboot
3.重新启动TFTP服务
sudo service tftpd-hpa restart
4.验证一下TFTP是否开启69端口起来了:
$ netstat -nlp |grep 69
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::60769 :::* LISTEN -
udp 0 0 0.0.0.0:35169 0.0.0.0:* -
udp 0 0 0.0.0.0:69 0.0.0.0:* -
unix 2 [ ACC ] SEQPACKET LISTENING 6961 - /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 6769 - @/com/ubuntu/upstart
我的ubuntu上IP地址是192.168.0.233 ,在 /slq/tftpboot 目录下放置文件 testget.txt,进入测试目录/slq/test,取得文件testget.txt,将testput.txt放入/slq/tftpboot
ls@ubuntu:/slq/test$ tftp 192.168.0.233
tftp> get testget.txt
tftp> put testput.txt
tftp> q
6.Busybox中tftp