tftp服務器搭建三步走
我們了解了tftp服務器的一些基礎內容后,就要著手于對tftp服務器搭建的學習了。那么下面,我們將這個搭建過程作了一個簡單的總結,希望大家能夠通過文章的內容,對這部分有所領悟。
tftp服務器搭建1.檢查系統是否安裝tftp服務端軟件:
[root@localhost lqm]# rpm -qa |grep tftp
tftp-0.39-2
tftp-server-0.39-2
tftp服務器搭建2.編輯文件:/etc/xinetd.d/tftp
[root@localhost xinetd.d]# vi 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 /home/lqm/tftpboot -c
disable = yes ---------------將yes改為no!
per_source = 11
cps = 100 2
flags = IPv4
注: 修改項server_args= -s -c,其中處可以改為你的tftp-server的根目錄,參數-s指定chroot,-c指定了可以創建文件。
tftp服務器搭建3.建立tftp文件夾
#mkdir /home/lqm/tftpboot
#chmod o+w /home/lqm/tftpboot
/etc/init.d/iptables stop //關閉防火墻
service xinetd restart //重啟 xinetd 服務
重啟xinetd服務,因為TFTP服務受控與xinetd, xinetd是管服務的服務,它是不開端口的。
驗證一下TFTP是否起來了:
[root@localhost tftp_root]# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::22 :::* LISTEN 2828/sshd
udp 0 0 0.0.0.0:69 0.0.0.0:* 10887/xinetd
udp 0 0 0.0.0.0:69 0.0.0.0:* 10863/in.tftpd
udp 0 0 0.0.0.0:69 0.0.0.0:* 10778/in.tftpd
可以看到69端口已經打開,說明服務啟動正常。
#service xinetd restart
這樣,tftp-server就啟動了。你可以登陸本機測試以下,命令如下:
#tftp your-ip-address
tftp>get <download file>
tftp>put <upload file>
tftp>q
#