Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1395161
  • 博文数量: 188
  • 博客积分: 1784
  • 博客等级: 上尉
  • 技术积分: 2772
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-05 22:20
个人简介

发上等愿,结中等缘,享下等福;择高处立,就平处坐,向宽处行。

文章分类

全部博文(188)

文章存档

2020年(12)

2019年(11)

2018年(4)

2017年(3)

2016年(11)

2015年(22)

2014年(19)

2013年(25)

2012年(32)

2011年(49)

分类: LINUX

2011-05-04 10:10:43

TFTP(Trivial File Transfer Protocol,简单文件传输协议)是TCP/IP协议族中的一个用来在客户机与服务器之间进行文件传输的简单协议,主要基于UDP协议来实现。该协议最初设计的目的是进行小文件的传输,因此它不具备通常的FTP的许多功能,它只能从TFTP服务器上获得或写入文件,不能列出目录,不进行认证。
1.tftp的配置文件
[root@localhost Desktop]# gedit /etc/xinetd.d/tftp
1    # default: off
 2    # description: The tftp server serves files using t he trivial file transfer \
 3    #    protocol.  The tftp protocol is often used to boot diskless \
 4    #    workstations, download configuration files to network-aware printers, \
 5    #    and to start the installation process for some operating systems.
 6    service tftp
 7    {
 8        socket_type        = dgram
 9        protocol        = udp
10        wait            = yes
11        user            = root
12        server            = /usr/sbin/in.tftpd
13        server_args        = -s /tftpboot
14        disable        = no
15        per_source        = 11
16        cps            = 100 2
17        flags            = IPv4
18    }
其中,server_args = -s /tftpboot是tftp服务器运行时的参数。-s /tftpboot表示服务器默认的目录是/tftpboot,当执行put a.txt命令时,文件被放到服务器的路径是/tftpboot/a.txt。
可以执行tftp、get命令下载文件。在嵌入式开发中,多使用下载功能。
可以执行put命令上传文件。上传文件时,需要先把服务器上的/tftpboot目录和这个目录下的文件变成可读可写权限,可以执行如下命令:
[root@localhost Desktop]# chmod -R 666 /tftpboot
默认情况下,只能上传tftp服务器已经存在的文件,例如,在tftp服务器上有/tftpboot/a.txt这个文件,可以执行如下命令:
[root@localhost Desktop]# put a.txt
如果想上传tftp服务器目录中没有的文件,需要修改tftp服务器的配置文件,
将/etc/xinetd.d/tftp文件的第13行改为“server_args = -s /tftpboot -c”即可,然后重启tftp服务器。
2.重启tftp服务器
[root@localhost Desktop]# service xinetd restart
停止 xinetd:                                              [确定]
启动 xinetd:                                              [确定]
[root@localhost Desktop]#
3.测试tftp
[root@localhost Desktop]# netstat -a|grep tftp
udp        0      0 *:tftp                      *:*                                     
[root@localhost Desktop]# netstat -an|grep 69|grep udp
udp        0      0 0.0.0.0:69                  0.0.0.0:*
udp        0      0 :::56996                    :::*                                    
执行上面两条命令中的任何一条,如果有相关的输出,就表明tftp服务器配置成功。
注:tftp服务器使用UDP协议,使用的端口号是69。

阅读(1113) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~