今天完成了tftp服務器的安裝配置,寫下來以作總結linux
由於要作linux移植,用tftp傳文件(內核和文件系統)更方便,比串口快,出錯率底我用的系統環境是debian 5.0vim
首先,安裝tftp客戶端和服務端,由於debian5.0默認下是不安裝的服務器
sudo apt-get install tftp tftpdsocket
而後,安裝xinetd,由於默認下用的是openbsd-inetd ,而tftp須要xinetd這個網路管理的背景程式的支持tcp
sudo apt-get install xinetdide
配置inetd.conf測試
將/etc/inetd.conf中關於tftp的部份註釋刪掉:this
#:BOOT: TFTP service is provided primarily for booting. Most sitesspa
# run this only on machines acting as "boot servers."rest
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/creater/image #將這句的注刪掉
其中/home/creater/image爲你要下載的文件所在的目錄
接下來在/etc/xinetd.d/下新建一個tftp的文件:
sudo vim /etc/xinetd.d/tftp
添加以下內容:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home/creater/image #替換爲你的目錄,注意權限
disable = no
per_source = 11
cps = 1002
flags = IPv4
}
重啓xinetd:
sudo /etc/init.d/xinetd reload
sudo /etc/init.d/xinetd restart
測試:
tftp localhost
tftp>get u-boot.bin #一開始在image下有u-boot.bin
Received 97353 bytes in 0.1 seconds
到此,說明tftp服務器已經裝好了