歡迎您光臨本站 註冊首頁

CentOS5.3下安裝Tftp 原創

←手機掃碼閱讀     火星人 @ 2014-03-25 , reply:0


說明:本操作是通過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:08Thunder
 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

[火星人 ] CentOS5.3下安裝Tftp 原創已經有188次圍觀

http://coctec.com/docs/linux/show-post-159503.html