TFTP服务器安装与使用

63 篇文章 1 订阅

TFTP服务器安装

操作系统:RedHat Enterprise Linux 5 

Abstract

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

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

Solution

一.TFTP服务器的安装

  利用以下命令就可以看到TFTP服务器已启动,则不用安装

[root@localhost Server]# netstat -a |grep tftp
udp        0      0 *:tftp                      *:*      

  若没有安装,在Redhat Enterprise Linux 5的安装光盘中有RPM安装包,挂在光盘后进入到文件夹,找到相应的安装包。

[root@localhost user]# cd /media/
[root@localhost media]# ls
RHEL_5.1 i386 DVD
[root@localhost media]# cd RHEL_5.1\ i386\ DVD/
[root@localhost RHEL_5.1 i386 DVD]# ls 
[root@localhost RHEL_5.1 i386 DVD]# cd Server/

[root@localhost Server]# ls tftp*
tftp-0.42-3.1.i386.rpm  tftp-server-0.42-3.1.i386.rpm

执行安装命令
[root@localhost Server]# rpm -ivh  tftp-server-0.42-3.1.i386.rpm 
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        xinetd is needed by tftp-server-0.42-3.1.i386

提示需要安装xinetd,找到安装包并安装

[root@localhost Server]# ls xinet*
xinetd-2.3.14-10.el5.i386.rpm

[root@localhost Server]# rpm -ivh  xinetd-2.3.14-10.el5.i386.rpm 
warning: xinetd-2.3.14-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:xinetd                 ########################################### [100%]

 再执行安装TFTP命令
[root@localhost Server]# rpm -ivh  tftp-server-0.42-3.1.i386.rpm 
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:tftp-server            ########################################### [100%]

建立tftp的主工作目录
[root@localhost Server]# mkdir /tftpboot

 修改配置文件

[root@localhost Server]# 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
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

重启服务

[root@localhost Server]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [FAILED]
Starting xinetd:                                           [  OK  ]

查看是否启动
[root@localhost Server]# netstat -a |grep tftp
udp        0      0 *:tftp                      *:*    

可以在/tftpboot中放一些文件,然后使用tftp客户端命令连接服务器,然后用GET命令下载文件,如果下载成功,就大功告成了。
配置结束。

也可以用如下方式启动 tftp

[root@localhost Server]#  /sbin/chkconfig tftp on
[root@localhost Server]#  /sbin/chkconfig --list
 
这时linux主机会显示
..............
xinetd based services:
        chargen-dgram:  off
        chargen-stream: off
        cvs:            off
        daytime-dgram:  off
        daytime-stream: off
        discard-dgram:  off
        discard-stream: off
        echo-dgram:     off
        echo-stream:    off
        eklogin:        off
        ekrb5-telnet:   off
        gssftp:         off
        klogin:         off
        krb5-telnet:    off
        kshell:         off
        rsync:          off
        tcpmux-server:  off
        
tftp:           on
        time-dgram:     off
        time-stream:    off
on表示 TFTP SERVER已经运行。

注意:

       如果你用的是交叉网线直连2440开发板,在确定U-boot的DM9000网卡驱动移植没问题的情况下,可以通过window下的终端ping通XP和虚拟机Linux,但就是无法
tftp 0x31000000 filename      //filename代表你要通过tftp下载的文件名,即在/tftpboot文件夹下的文件名
       有一种情况就说明你机器的网卡不支持这样与2440开发板连接,我的机器就出现了这个问题,但当我换作用交换机连接XP、虚拟机Linux与2440开发板时就可以tftp了。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值