HAYAGUI

FreeBSD 4.10 + tftp

はじめに

netboot にも使用される tftp をやってみました。tftp はシンプルなファイル転送プロトコルです。

tftpd

FreeBSD 4.10 には、tftpd も tftp もインストール済みで、/etc/inetd.conf にも無効の状態で設定されています。
eden# grep tftp /etc/inetd.conf
#tftp   dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot
#tftp   dgram   udp6    wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot
eden#
IPv4 の tftp の行のコメントを外します。
eden# grep tftp /etc/inetd.conf
tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot
#tftp   dgram   udp6    wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot
eden#
次に、tftpd の root ディレクトリを作成します。テスト用として /etc/motd を置いておきます。
eden# mkdir /tftpboot
eden# chmod 777 /tftpboot
eden#
eden# cp /etc/motd /tftpboot
eden# ls -la /tftpboot/
total 6
drwxrwxrwx   2 root  wheel   512 Nov 30 22:04 .
drwxr-xr-x  18 root  wheel   512 Nov 30 22:03 ..
-rw-r--r--   1 root  wheel  1113 Nov 30 22:04 motd
eden#
設定を反映させるため、inetd を再起動させます。
eden# kill -HUP `cat /var/run/inetd.pid `
超簡単。

tftp

FreeBSDとWindows2000から tftp をやってみます。

FreeBSD のローカルで tftp するとこんな感じ。

> tftp 127.0.0.1
tftp> ?
Commands may be abbreviated.  Commands are:

connect         connect to remote tftp
mode            set file transfer mode
put             send file
get             receive file
quit            exit tftp
verbose         toggle verbose mode
trace           toggle packet tracing
status          show current status
binary          set mode to octet
ascii           set mode to netascii
rexmt           set per-packet retransmission timeout
timeout         set total retransmission timeout
?               print help information
tftp> get motd
Received 1137 bytes in 0.0 seconds
tftp> quit
> ls -la motd
-rw-r--r--  1 kenz  kenz  1113 Nov 30 22:17 motd
>

Windows2000 からは一発で get 可能。

C:\Documents and Settings\kenz>tftp 192.168.0.103 get motd motd
Transfer successful: 1137 bytes in 1 second, 1137 bytes/s

戻る



(C)1999 - 2004 Kenji Ito All rights reserved.