ネットワーク機器メンテナンスサーバー

ネットワーク機器のメンテナンスを行う際には、Windows上でtftpd64を運用するのが定番ではある。 しかし以下の点で使い勝手が悪く、この問題を解決するためにFreeBSDで構成してみることにしてみた。

設定目標

ネットワーク機器をメンテナンスするための、前述の不満を解消するために、以下の機能を必要and/or用意した。

構築環境

セットアップ

local-unbound

  1. /etc/rc.conf に対して設定の追加。

  2. local_unbound のセットアップ。

  3. 必須ではないが /etc/resolv.conf の確認(nameserver 127.0.0.1 の追加の確認)。

  4. /etc/unbound/conf.d/local.conf ファイルを作成する。

上記作業完了後に local_unbound を立ち上げる。

/etc/rc.conf

以下の行を追加する。

local_unbound_enable="YES"

または sysrc local_unbound_enable="YES" コマンドを実行して設定する。

# sysrc local_unbound_enable="YES"
local_unbound_enable: NO -> YES

local_unbound のセットアップ

service local_unbound setup コマンドを実行する。

# service local_unbound setup
Performing initial setup.
destination:
Extracting forwarders from /etc/resolv.conf.
/usr/sbin/local-unbound-setup: cannot open /etc/resolv.conf: No such file or directory
No forwarders found in resolv.conf, unbound will recurse.
/var/unbound/lan-zones.conf created
/var/unbound/control.conf created
/var/unbound/unbound.conf created
/etc/resolvconf.conf created
/usr/sbin/local-unbound-setup: cannot open /etc/resolv.conf: No such file or directory
/etc/resolv.conf created

/etc/unbound/conf.d/local.conf

以下のファイルを作成する。

server:
  outgoing-range: 948
  interface:      0.0.0.0
  access-control: 127.0.0.0/8 allow_snoop
  access-control: 10.0.0.0/8 allow_snoop

local_unbound の立ち上げ

service local_unbound startコマンドを実行する。

# service local_unbound start
Starting local_unbound.
Waiting for nameserver to start... good

※なお再起動により、自動的に立ち上がる。

outgoing-range パラメータについてのメモ

# service local_unbound start
Starting local_unbound.
[xxxxxxxxxx] local-unbound[XXXXX:0] warning: too many file descriptors requested. The builtinmini-event cannot handle more than 1024. Config for less fds or compile with libevent
[xxxxxxxxxx] local-unbound[XXXXX:0] warning: continuing with less udp ports: 948
Waiting for nameserver to start... good

ntpd

  1. /etc/rc.conf に対して設定の追加。

  2. /etc/ntp.conf に対して設定の修正。

上記作業完了後に ntpd を立ち上げる。

/etc/rc.conf

ntpd_enable="YES"
ntpd_flags="-N -p /var/run/ntpd.pid -f /var/db/ntpd.drift"
ntpd_sync_on_start="YES"

/etc/ntp.conf

--- /etc/ntp.conf.orig  2018-08-16 19:07:30.542265000 +0900
+++ /etc/ntp.conf       2018-08-16 14:33:41.609429000 +0900
@@ -29,7 +29,7 @@
 #
 # The option `iburst' is used for faster initial synchronization.
 #
-pool 0.freebsd.pool.ntp.org iburst
+pool ntp.nict.jp iburst                # NICT

 #
 # If you want to pick yourself which country's public NTP server
@@ -97,6 +97,8 @@
 #
 #server 127.127.1.0
 #fudge 127.127.1.0 stratum 10
+server 127.127.1.0
+fudge 127.127.1.0 stratum 10

 # See http://support.ntp.org/bin/view/Support/ConfiguringNTP#Section_6.14.
 # for documentation regarding leapfile. Updates to the file can be obtained

※ここではNICTのNTPサーバーを指名している。環境に応じて修正すること。

syslogd

isc-dhcpd

tftp-hpa

kermit