1、安装相关软件包
sudo apt-get install tftpd (服务端)
sudo apt-get install tftp (客户端)
sudo apt-get install xinetd
2、建立配置文件
在根目录下建立TFTP文件夹,做为TFTP的根目录
$ mkdir ~/TFTP
$ chmod 777 ~/TFTP
在 /etc/xinetd.d/目录下建立tftp配置文件:
# vim /etc/xinetd.d/tftp
输入:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home/alyan/TFTP 替换为你的目录,注意权限。
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
將/etc/inetd.conf中关于tftp的部份注释掉:#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
3、从新启动服务
sudo /etc/init.d/xinetd restart
4、TFTP服务测试
(1)、登录TFTP服务器
$ tftp localhost
tftp>
tftp> put text //测试上传文件 在~/TFTP 目录下将看到text文件
tftp> get text //测试文件下载 退出tftp在该目录中将看到text文件。
5、上传中产生的错误。
如果产生Error code 2: Access violation
则首先给要上传的文件赋予权限 666,
root@sdaiden-desktop:~# chmod 666 usb.c
下载同理:。
OVER!参考 http://www.anshld.com/blog/post/1.html
====================================================================================
混乱版: old
TFTP(Trivial File Transfer Protocol),即普通文件传输协议,是用来传送文件的Internet程序,它比文件传输协议(FTP)使用简单,但是功能少。
在嵌入式系统中(特别是在开发初期),TFTP和NFS(网络文件系统)这两种方式常用来,为目标板从服务器上下载。debian源里自带了tftp,所以安装很简单。
安装:服务端tftpd
配置:/etc/inetd.conf 将其中默认的目录/tftpboot改为个人主目录下
$ mkdir ~/tftpboot
启动+测试:不知道怎么启动,后来发现没办法启动
查了一下资料:
tftp是有inetd控制的. inetd是管理其他守护进程的守护进程, 使用RPC的守护进程的端口号由portmap分配,未安装inetd。
sudo apt-get install netkit-inetd
发现可找到,但无论如何也安装不对。提示了一个信息要指定一个确定安装软件,有一个是openbsd-inetd。继续查找:
netkit-inetd已经由openbsd-inetd所替代.(etch 預設的 inet 超級服務管理程式已由
netkit-inetd 替換為
openbsd-inetd。如果沒有設定任何服務,在預設上它將不會啟動。這個新預設的服務程式將會在升級的過程中被自動安裝進來。
)
openbsd-inetd:/usr/sbin/inetd
启动的script: /etc/init.d/openbsd-inetd$
sudo /etc/init.d/openbsd-inetd reload$ sudo /etc/init.d/openbsd-inetd restart
安装:客户端 tftp
测试tftpd:
$ tftp localhost
tftp> get file (file 存在于tftpboot目录下)
timeout...
人品真是不好,sigh。
继续发现:
“在Ubuntu下,tftp是不能單獨運作的,需要xinetd這個網路管理的背景程式之支援。”
$ sudo apt-get install xinetd
配置 /etc/xinetd.conf,不过更好的办法是tftp配置文件:
(xinetd.conf引入專門存放設定檔的資料夾includedir /etc/xinetd.d)
$sudo vim /etc/xinetd.d/tftp
加入:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot 替换为你的目录,注意权限。
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
將/etc/inetd.conf中关于tftp的部份注释掉:
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
$ sudo /etc/init.d/xinetd reload
$ sudo /etc/init.d/xinetd restart
$ tftp localhost
$ get file ok!!
这样就可以在/TFTPBOOT目录传递文件了。
[WINDOWS :]
tftp -i ipxxx get/put filename
[LINUX :]
tftp>connect ipxx
get/put filename
总结一下以上:
先安装xinetd,然后安装tftp tftpd ,配置xinetd关于tftp即可。
学习点:Linux关于网络部分的守护进程。
设置开发板:
连接:
参考资料:
%E8%88%87_xinetd_%E7%9A%84%E5%AE%89%E8%A3%9D:_Debian/Ubuntu
http://www.cublog.cn/u/13991/showart_108131.html
阅读(3665) | 评论(0) | 转发(0) |