Chinaunix首页 | 论坛 | 博客
  • 博客访问: 347228
  • 博文数量: 74
  • 博客积分: 2705
  • 博客等级: 少校
  • 技术积分: 590
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-05 15:13
个人简介

鱼!

文章分类

全部博文(74)

文章存档

2014年(12)

2013年(10)

2012年(4)

2011年(11)

2010年(7)

2009年(12)

2008年(16)

2007年(2)

我的朋友

分类: LINUX

2011-07-30 14:41:40

说明:本操作是通过Secure CRT SSL连接虚拟机安装的Linux centos5.3操作,虚拟机的IP 192.168.171.156,  本机XP系统的IP 192.168.171.82

连接上Secure CRT SSL 开始如下操作:

1、#rpm -qa |grep tftp
2、#cd /mnt
3、[mnt]#mkdir guazai
4、[mnt]#mount /dev/cdrom guazai
5、[mnt]#cd guazai
6、[mnt]#cd CentOS
7、[CentOS]#ls *ftp*
ftp-0.17-35.el5.i386.rpm    tftp-0.42-3.1.el5.centos.i386.rpm
gftp-2.0.18-3.2.2.i386.rpm  tftp-server-0.42-3.1.el5.centos.i386.rpm
lftp-3.5.1-2.fc6.i386.rpm   vsftpd-2.0.5-12.el5.i386.rpm
8、[CentOS]#rpm -ivh tftp-server-0.42-3.1.el5.centos.i386.rpm
Preparing...                ########################################### [100%]
   1:tftp-server            ########################################### [100%]
9.[CentOS]#   ########################################### [100%]
[root@localhost CentOS]# rpm -ivh tftp-0.42-3.1.el5.centos.i386.rpm
Preparing...                ########################################### [100%]
   1:tftp                   ########################################### [100%]
10.[root@localhost CentOS]# rpm -qa|grep tftp
tftp-server-0.42-3.1.el5.centos
tftp-0.42-3.1.el5.centos
11.[root@localhost CentOS]# 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  '加-c
        disable                 = yes   '改为no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
#该后的代码
# 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 -c
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
~
:wq! (保存退出)

11.[root@localhost CentOS]#cd /
12.[root@localhost /]# service xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]
13.[root@localhost /]# setup '查看TFTP是否开机自动开启(系统服务选项) 查看防火墙是否开放TFTP端口,并在其他端口选项增加端口69

:udp ,保存退出setup界面

14.[root@localhost /]# ls
backups  dev   lib         misc  opt   sbin     sys       usr
bin      etc   lost+found  mnt   proc  selinux  tftpboot  var
boot     home  media       net   root  srv      tmp
15.[root@localhost /]# cd tftpboot/
16.[root@localhost tftpboot]# ls
17.[root@localhost tftpboot]# cd /
18.[root@localhost /]# chmod 777 tftpboot

19.[root@localhost /]# service xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]

20.[root@localhost /]# cd tftpboot/
21.[root@localhost tftpboot]# ls
22.[root@localhost tftpboot]# touch test.txt  111  222 333
23.[root@localhost tftpboot]# ls
test.txt 111 222 333

24.[root@localhost tftpboot]# vi test.txt
test
zuo ge ce shi!

25.[root@localhost tftpboot]# cd /
26.[root@localhost /]# mkdir test

27.[root@localhost tftpboot]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:74:82:3B 
          inet addr:192.168.171.156  Bcast:192.168.171.255  Mask:255.255.254.0

28.[root@localhost /]# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=4.13 ms

29.[root@localhost /]# ping 192.168.171.156  (本linux系统IP)
PING 192.168.171.156 (192.168.171.156) 56(84) bytes of data.
64 bytes from 192.168.171.156: icmp_seq=1 ttl=64 time=0.414 ms
64 bytes from 192.168.171.156: icmp_seq=2 ttl=64 time=0.088 ms

30.[root@localhost /]# cd test
31.[root@localhost test]# tftp 192.168.171.156
32.tftp>  get test.txt
33.tftp> q
34.[root@localhost test]# ls
test.txt
35.[root@localhost test]# cat test.txt
test
zuo ge ce shi!


35.[root@localhost test]# touch aa.txt
36.[root@localhost test]# vi aa.txt
test
shi fou ce shi cheng gong ne!
:wq  (保存退出)。

37.[root@localhost test]# tftp 192.168.171.156
38.tftp> put aa.txt
39.tftp> q
40.[root@localhost test]# cd /tftpboot/
41.[root@localhost tftpboot]# ls
111  222  333  aa.txt  test.txt
42.[root@localhost tftpboot]# cat aa.txt
test
shi fou ce shi cheng gong ne!

43.[root@localhost tftpboot]# ping 192.168.171.82
PING 192.168.171.82 (192.168.171.82) 56(84) bytes of data.
64 bytes from 192.168.171.82: icmp_seq=1 ttl=64 time=0.960 ms
64 bytes from 192.168.171.82: icmp_seq=2 ttl=64 time=1.00 ms

44.在本机XP上上传、下载
在运行里面输入cmd
C:\Documents and Settings\Administrator>d:


D:\>dir
D:\ 的目录
2009-11-23  14:05   

          test
2009-06-29  13:08   
          Thunder
2009-11-23  13:29   
          我的文档
2009-08-24  09:59   
          无线TP-link
          
D:\>cd test
D:\test>dir

 D:\test 的目录

2009-11-23  14:24   

          .
2009-11-23  14:24   
          ..
2009-11-23  14:03                 9 bb.txt
2009-11-23  14:24                 0 cc.txt

D:\test>tftp 192.168.171.156 get aa.txt
Transfer successful: 37 bytes in 1 second, 37 bytes/s

D:\test>dir
D:\test 的目录

2009-11-23  14:28   

          .
2009-11-23  14:28   
          ..
2009-11-23  14:28                37 aa.txt
2009-11-23  14:03                 9 bb.txt
2009-11-23  14:24                 0 cc.txt


D:\test>tftp 192.168.171.156 put bb.txt
Transfer successful: 9 bytes in 1 second, 9 bytes/s

D:\test>tftp 192.168.171.156 put cc.txt
Transfer successful: 0 bytes in 1 second, 0 bytes/s

45.回到虚拟机上查看上传文件
[root@localhost tftpboot]# ls -lh
总计 12K
-rw-r--r-- 1 root   root    0 11-18 20:49 111
-rw-r--r-- 1 root   root    0 11-18 20:49 222
-rw-r--r-- 1 root   root    0 11-18 20:49 333
-rw-rw-rw- 1 nobody nobody 35 11-18 22:38 aa.txt
-rw-rw-rw- 1 nobody nobody  9 11-18 22:39 bb.txt
-rw-rw-rw- 1 nobody nobody  0 11-18 22:39 cc.txt
-rw-r--r-- 1 root   root   20 11-18 20:49 test.txt

tftp测试成功,完成。

 

注:如缺少xinetd包不能安装tftp包时,可先安装xinetd包

[root@localhost CentOS]# ls *xin*
ibmasm-xinput-2.1-1.el5.i386.rpm  xinetd-2.3.14-10.el5.i386.rpm
texinfo-4.8-14.el5.i386.rpm       xorg-x11-xinit-1.0.2-15.el5.i386.rpm
texinfo-tex-4.8-14.el5.i386.rpm
[root@localhost CentOS]# rpm -ivh xinetd-2.3.14-10.el5.i386.rpm
Preparing...                ########################################### [100%]
        package xinetd-2.3.14-10.el5.i386 is already installed

记得要重启xinetd服务

#service xinetd.d restart

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