配置tftp服務(wù)器實用又簡單的方法
在網(wǎng)絡(luò)協(xié)議中,TFTP協(xié)議大家應(yīng)該是比較了解的。那么今天我們則重點講解一下關(guān)于配置tftp服務(wù)器的內(nèi)容。TFTP(Trivial File Transfer Protocol簡樸文件傳輸協(xié)議)是TCP/IP協(xié)議族中的一個用來在客戶機與服務(wù)器之間進行簡單文件傳輸?shù)膮f(xié)議,提供不復(fù)雜、開銷不大的文件傳輸服務(wù)。TFTP承載在UDP上,提供不可靠的數(shù)據(jù)流傳輸服務(wù),不提供存取授權(quán)與認(rèn)證機制,使用超時重傳方式來保證數(shù)據(jù)的到達(dá)。與FTP相比,TFTP的大小要小的多,TFTP是用來下載遠(yuǎn)程文件的最簡單網(wǎng)絡(luò)協(xié)議,它基于UDP協(xié)議而實現(xiàn)。它使用的是UDP的69端口 。
配置tftp服務(wù)器1、檢查系統(tǒng)是否安裝tftp服務(wù)
- [root@wk ~]# rpm -qa | grep tftp
- tftp-0.42-3.1.el5.centos
- tftp-server-0.42-3.1.el5.centos
假如沒有安裝可以掛載CentOS5.2光盤安裝
- [root@wk ~]# mount -t auto /dev/cdrom /mnt/cdrom
- mount: block device /dev/cdrom is write-protected mounting read-only
- [root@wk ~]# cd /mnt/cdrom/CentOS
- [root@wk CentOS]# rpm -ivh tftp-0.42-3.1.el5.centos.i386.rpm
- [root@wk CentOS]# rpm -ivh tftp-server-0.42-3.1.el5.centos.i386.rpm
配置tftp服務(wù)器2、修改啟動配置文件
默認(rèn)情況下TFTP服務(wù)是禁用的,所以要修改文件來開啟服務(wù)。
修改文件/etc/xinetd.d/tftp。主要是設(shè)置TFTP服務(wù)器的根目錄,開啟服務(wù)。
修改后的配置文件如下:
- service tftp
- {
- disable = yes 把這里的yes改為no
- socket_type = dgram
- protocol = udp
- wait = yes
- user = root
- server = /usr/sbin/in.tftpd
- server_args = -s /tftpboot -c
- per_source = 11
- cps = 100 2
- flags = IPv4
- }
這里指定/tftpboot 為tftp服務(wù)器的根目錄
參數(shù)-s指定chroot,-c指定了可以創(chuàng)立文件。
配置tftp服務(wù)器3、創(chuàng)立tftp根目錄,關(guān)閉防火墻,啟動tftp-server
- [root@wk ~]# mkdir /tftpboot
- [root@wk ~]# chmod -R 777 /tftpboot
- [root@wk ~]# /etc/init.d/iptables stop
- [root@wk ~]# service xinetd restart
重啟xinetd服務(wù),因為TFTP服務(wù)受控與xinetd服務(wù),xinetd是管服務(wù)的服務(wù),它是不開端口的。
所以要驗證一下TFTP是否開啟69端口起來了:
- [root@wk ~]# netstat -nlp
- udp 0 0 0.0.0.0:67 0.0.0.0:* 5172/dnsmasq
- udp 0 0 0.0.0.0:67 0.0.0.0:* 4745/dhcpd
- udp 0 0 0.0.0.0:69 0.0.0.0:* 6171/xinetd
- udp 0 0 0.0.0.0:994 0.0.0.0:* 4633/rpc.rquotad
配置tftp服務(wù)器4、測試tftp服務(wù)器
- [root@wk ~]# tftp 192.168.0.110
- tftp>get
- tftp>put
- tftp>q