TFTPのインストールと設定

GNOMEの「ソフトウェアの追加と削除」で"tftp-server"で検索して該当するパッケージを導入する。コマンドラインからインストールする場合は次の通り。

[root@vmserver ~]# yum install tftp-server
	:
	:
[root@vmserver ~]# chkconfig --list tftp
tftp            off

tftpdはxinetdから起動されるので、tftp-serverパッケージを導入する際に、xinetdが未導入であれば依存解決によりxinetdも同時にインストールされる。また、tftp-serverは後述するsystem-config-netbootパッケージの導入時に一緒に導入できる。(つまりnetbootパッケージの導入だけを先にするのであれば、tftpbootの導入は必要ない。)

次に/etc/xinetd.d/tftpを設定する。

[root@vmserver ~]# cat /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		= -v -s /tftpboot
	disable			= no
	per_source		= 11
	cps			= 100 2
	flags			= IPv4
}

"disable"行を"no"にする。また任意で"server_args"行に"-v"を加えておくことで/var/log/messagesに詳しいログを取ることができる。

xinetdを起動する。

[root@vmserver ~]# service xinetd start
Starting xinetd:                                           [  OK  ]

ファイヤーウォールでTFTPのポート(69/UDP)を開放することも忘れずに。

さて、tftpdが機能するかどうかテストしてみる。Linuxからテストするにはtftp-serverの他にtftpパッケージが必要となる。tftpはWindows XP Professionalなどでも利用できるので試してみるといい。試験用に適当なファイル(下の例では/etc/dhcpd.confを使っているが何でも構わない)を/tftpbootの下にコピーして、他のPCからtftpでダウンロードできるか試してみる。

TFTPサーバ側

[root@vmserver ~]# cp /etc/dhcpd.conf /tftpboot/

TFTPクライアント側

C:\> tftp vmserver get dhcpd.conf
Transfer successful: 709 bytes in 1 second, 709 bytes/s

(テストが終わったら/tftpboot/の下から試験用ファイル取り除いておく。)