码迷,mamicode.com
首页 > 其他好文 > 详细

tftp问题

时间:2015-04-18 23:36:00      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

声明:本文来与http://wenku.baidu.com/link?url=_YyQz85cyMB0pGLQcKrgZ-sdkyVbmwXxTfDABcTrxc4XPYlhy-apdvAUKIje943Eyjb9c_CiFZ7_dcdjRgnHuVd4KzLfgUjWEwdnrR5i-RK

本文所介绍的程序平台: 

虚拟机系统:Red Hat Enterprise Linux 5 

Linux内核版本:2.6.18-194.e5 1.1 tftp的概述

 

在嵌入式开发过程中有宿主机和目标机的角色之分:宿主机是执行编译、链接嵌入式软件的计算机,目标机是运行嵌入式软件的硬件平台。

Tftp服务器作为工作于宿主机上的软件,主要提供对目标机的主要映像文件的下载工作。

1.2 tftp

安装测试

1.2.1 使用

RPM包安装

tftp-server 

利用下面的命令查看服务器是否已经启动,如果已经安装则不用安装

 

netstat –a | grep tftp 

已安装结果:udp 00 *:tftp *:* 

如果没有安装则执行

  #rpm  -ivh  tftp-0.42-3.1.i386.rpm         //安装tftp-client 

注意要安装了客户端才有tftp命令

#rpm  -ivh  tftp-server-0.42-3.1.i386.rpm         //安装tftp-server 

 

1.2.2建立tftp主工作目录

 mkdir /tftpboot 

注意:权限问题

 chmod 777 /tftpboot 

1.2.3

修改配置文件

 vi /etc/xinetd.d/tftp 

# default: off 

# description: The tftp server serves files using the trivial file transfer 

protocol.  The tftp protocol is often used to boot diskless 

workstations, download configuration files to network-aware printers, \ 

and to start the installation process for some operating systems. 

service tftp 

disable = no

socket_type = dgram 

protocol = udp 

wait = yes 

user = root 

server = /usr/sbin/in.tftpd 

server_args = -s /tftpboot –c 

工作目录per_source = 11 

ps  = 100 2 

flags = IPv4 

 1.2.4 

重启服务

 /etc/init.d/xinetd restart 

netstat 

a | grep tftp 

udp 00 *:tftp *:* 

 

1.2.5

测试服务

 

修改客户机的

IP

跟主机在同一个网段

 

    ifconfig eth0 192.168.1.30 

tftp> put 1.txt

 

tftp> get 1.txt

 

 

安装过程中出现的问题及原因

 

现象一:

 

tftp> get test.log 

Transfer timed out. 

原因:

 

tftpd

服务没有启动

 

 

 

现象二:

 

tftp> get test.log 

Error code 2: Only absolute filenames allowed 

原因:

 

/etc/xinetd.d/tftpd

中设置的

server_args

/etc/default/tftpd-hpa 

cat /etc/default/tftpd-hpa 

#Defaults for tftpd-hpa 

RUN_DAEMON="no" 

OPTIONS="-s /home/tftpd -c -p -U 077 -u tftpd" 

设置的时候只要将

server_args

=改为你自己设定的服务器文件夹就行了

 

 

 

现象三:

 

tftp> put ex070416.log 

Error code 1: File not found 

原因:

 

指定的文件不存在;或

tftpd

启动参数中没有指定

-c

选项,允许上传文件。

 

 

现象四:

 

tftp> get test.log 

Error code 1: File not found 

原因:

 

指定文件的权限不够,使用

chmod 777

 

tftp问题

标签:

原文地址:http://www.cnblogs.com/boyiliushui/p/4438223.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!