TFTPサーバ構築メモ
先日TFTPサーバを構築したのでその時の手順やらのメモ書きです。
TFTPサーバのモジュールインストール
[root@localhost ~]# yum install tftp tftp-server 読み込んだプラグイン:fastestmirror Determining fastest mirrors base | 3.6 kB 00:00 centosplus | 3.4 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 updates/7/x86_64/primary_db | 1.3 MB 00:00 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ tftp.x86_64 0:5.2-22.el7 を インストール ---> パッケージ tftp-server.x86_64 0:5.2-22.el7 を インストール --> 依存性解決を終了しました。 依存性を解決しました ================================================================================ Package アーキテクチャー バージョン リポジトリー 容量 ================================================================================ インストール中: tftp x86_64 5.2-22.el7 base 38 k tftp-server x86_64 5.2-22.el7 base 47 k トランザクションの要約 ================================================================================ インストール 2 パッケージ 総ダウンロード容量: 85 k インストール容量: 117 k Is this ok [y/d/N]: y Downloading packages: (1/2): tftp-5.2-22.el7.x86_64.rpm | 38 kB 00:00 (2/2): tftp-server-5.2-22.el7.x86_64.rpm | 47 kB 00:00 -------------------------------------------------------------------------------- 合計 227 kB/s | 85 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction インストール中 : tftp-5.2-22.el7.x86_64 1/2 インストール中 : tftp-server-5.2-22.el7.x86_64 2/2 検証中 : tftp-server-5.2-22.el7.x86_64 1/2 検証中 : tftp-5.2-22.el7.x86_64 2/2 インストール: tftp.x86_64 0:5.2-22.el7 tftp-server.x86_64 0:5.2-22.el7 完了しました! [root@localhost ~]#
xinetdのインストールも忘れずに
[root@localhost ~]# yum install xinetd 読み込んだプラグイン:fastestmirror Loading mirror speeds from cached hostfile 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ xinetd.x86_64 2:2.3.15-13.el7 を インストール --> 依存性解決を終了しました。 依存性を解決しました ================================================================================ Package アーキテクチャー バージョン リポジトリー 容量 ================================================================================ インストール中: xinetd x86_64 2:2.3.15-13.el7 base 128 k トランザクションの要約 ================================================================================ インストール 1 パッケージ 総ダウンロード容量: 128 k インストール容量: 261 k Is this ok [y/d/N]: y Downloading packages: xinetd-2.3.15-13.el7.x86_64.rpm | 128 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction インストール中 : 2:xinetd-2.3.15-13.el7.x86_64 1/1 検証中 : 2:xinetd-2.3.15-13.el7.x86_64 1/1 インストール: xinetd.x86_64 2:2.3.15-13.el7 完了しました! [root@localhost ~]#
xinetdの設定変更
[root@localhost ~]# 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 = -s /var/lib/tftpboot disable = no ←★デフォルトだとyesなのでnoに変更する per_source = 11 cps = 100 2 flags = IPv4 }
ファイアウォールの設定
[root@localhost ~]# firewall-cmd --zone=public --add-port=69/udp --permanent←ポートで指定する場合 [root@localhost ~]# firewall-cmd --add-service=tftp --zone=public --permanent←サービスで指定する場合 [root@localhost ~]# firewall-cmd --reload←ファイアウォールの再読み込み
xinetdサービスの起動
[root@localhost ~]# systemctl start xinetd
動作確認
TFTPサーバに向けてテキトーなファイルのアップロードを行う。
今回は192.168.2.161の別サーバからtest.cfgと言うファイルをアップロードしてみます。
192.168.2.161側の操作
[root@localhost ~]# tftp -v 192.168.151.2 -c put test.cfg Connected to 192.168.151.2 (192.168.151.2), port 69 putting test.cfg to 192.168.151.2:test.cfg [netascii] Sent 17618 bytes in 0.0 seconds [4469595 bit/s] [root@localhost ~]#
TFTPサーバ側の操作
[root@localhost tftpboot]# ll 合計 24 -rw-rw-rw-. 1 nobody nobody 17618 1月 16 13:53 test.cfg -rwxrwxrwx. 1 root root 5 1月 16 11:30 test.txt [root@localhost tftpboot]#