| サイズ: 5383 コメント:  | サイズ: 6666 コメント:  | 
| 削除された箇所はこのように表示されます。 | 追加された箇所はこのように表示されます。 | 
| 行 13: | 行 13: | 
| ネットワーク機器をメンテナンスするための、前述の不満を解消するために、以下の機能を必要and/or用意した。 | ネットワーク機器をメンテナンスするための、前述の不満を解消するために、以下の機能を必要`and/or`用意した。 | 
| 行 28: | 行 28: | 
| * SSH * TFTP * シリアル通信 | * SSH(`OpenSSH`) * TFTP(`tftp-hpa`) * シリアル通信(`kermit`) | 
| 行 38: | 行 38: | 
| * NIC1: DHCPによりIPアドレス自動設定 | * NIC1: DHCPによりIPアドレス自動取得・設定 | 
| 行 41: | 行 41: | 
| * SSH 7.8p1 * TFTP [[https://www.freshports.org/ftp/tftp-hpa|tftp-hpa]] 5.2 | * SSH `OpenSSH 7.8p1` * TFTP [[https://www.freshports.org/ftp/tftp-hpa|tftp-hpa]] `5.2` | 
| 行 44: | 行 44: | 
| * Syslogサーバー syslogd * DNSキャッシュサーバー local-unbound 1.8.1 * NTPサーバー ntpd 4.2.8p12-a (1) * DHCPサーバー [[https://www.freshports.org/net/isc-dhcp44-server|isc-dhcpd]] 4.4.1 | * Syslogサーバー `syslogd` * DNSキャッシュサーバー `local-unbound 1.8.1` * NTPサーバー `ntpd 4.2.8p12-a (1)` * DHCPサーバー [[https://www.freshports.org/net/isc-dhcp44-server|isc-dhcpd]] `4.4.1` | 
| 行 49: | 行 49: | 
| * Kermit [[https://www.freshports.org/comms/kermit|kermit]] 9.0.304 | * Kermit [[https://www.freshports.org/comms/kermit|kermit]] `9.0.304` | 
| 行 54: | 行 54: | 
| 1. /etc/rc.conf に対して設定の追加。 1. local_unbound のセットアップ。 1. 必須ではないが /etc/resolv.conf の確認(nameserver 127.0.0.1 の追加の確認)。 1. /etc/unbound/conf.d/local.conf ファイルを作成する。 | 1. `/etc/rc.conf` に対して設定の追加。 1. `local_unbound` のセットアップ。 1. 必須ではないが `/etc/resolv.conf` の確認({{{nameserver 127.0.0.1}}} の追加の確認)。 1. `/etc/unbound/conf.d/local.conf` ファイルを作成する。 | 
| 行 59: | 行 59: | 
| 上記作業完了後に local_unbound を立ち上げる。 | 上記作業完了後に `local_unbound` を立ち上げる。 | 
| 行 62: | 行 62: | 
| {{{ | 以下の行を追加する。 {{{#!highlight shell numbers=disable | 
| 行 64: | 行 66: | 
| 行 68: | 行 69: | 
| {{{ service local_unbound setup | 以下のコマンドを実行する。 | 
| 行 71: | 行 71: | 
| {{{#!highlight console numbers=disable # service local_unbound setup | |
| 行 74: | 行 76: | 
| 以下のファイルを作成する。 | |
| 行 76: | 行 80: | 
| outgoing-range: 948 | |
| 行 81: | 行 86: | 
| ※環境に合わせてinterface, access-control 行の追加または削除を実施すること。 | * ※環境に合わせて`interface`、`access-control`行の追加または削除を実施すること。 * `outgoing-range` 設定については最初は要らない可能性がある。詳細は後述のメモを参考に対応すること。 | 
| 行 84: | 行 90: | 
| {{{ service local_unbound start | 以下のコマンドを実行する。 | 
| 行 87: | 行 92: | 
| {{{#!highlight console numbers=disable # service local_unbound start Starting local_unbound. Waiting for nameserver to start... good | |
| 行 91: | 行 100: | 
| ==== outgoing-range パラメータメモ ==== {{{#!highlight console numbers=disable # 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 }}} 上記のような警告メッセージが表示される場合は「`continuing with less udp ports`」の指示に従い「outgoing-range」パラメータを設定することで回避できる。 | |
| 行 92: | 行 112: | 
| 1. /etc/rc.conf に対して設定の追加。 1. /etc/ntp.conf に対して設定の修正。 | 1. `/etc/rc.conf` に対して設定の追加。 1. `/etc/ntp.conf` に対して設定の修正。 | 
| 行 106: | 行 126: | 
| {{{#!diff | {{{#!highlight diff numbers=disable | 
ネットワーク機器メンテナンスサーバー
ネットワーク機器のメンテナンスを行う際には、Windows上でtftpd64を運用するのが定番ではある。 しかし以下の点で使い勝手が悪く、この問題を解決するためにFreeBSDで構成してみることにしてみた。
- NIC(ネットワークインターフェース)をアプリ(tftpd64)とOS(Windows)が奪い合うことによる不安定さ。
- tftpd64自体の不安定さ。
- 全体的にトラブルシューティングのしにくさ(パケットキャプチャーするのに別アプリのインストールなど)。
- ターミナルアプリの選択が必要で、かならずしも自身が使い慣れたターミナルアプリ*だけ*で完結するわけではない、など。
目次
設定目標
ネットワーク機器をメンテナンスするための、前述の不満を解消するために、以下の機能を必要and/or用意した。
- 2ポートNIC構成。ただしNIC自身はUSBイーサーでは構成せず。 - 経験的に、マルチキャスト関連の処理で不安定になる経験が多々あったため、USBイーサーの使用はお勧めしない。
 
- 2つのNICの用途は、以下の通りである - ポート1: 外部接続用ポートで内部(ポート2)の通信を外部と通信する時にNATする。 - ダイナミックNAT(IPマスカレード)を想定し、1対1NATは行わない。
 
- ポート2: 内部(ネットワーク機器)接続用ポートでこのポートに対して以下のサービスを提供する。 - スパニングツリー(RSPAN)
- DHCP
- リゾルバ(DNSキャッシュ)
- NTP
- Syslog
- TFTP
 
 
- ポート1: 外部接続用ポートで内部(ポート2)の通信を外部と通信する時にNATする。 
- またネットワーク機器に対するクライアントツールとして以下のツールを使用する。 - SSH(OpenSSH) 
- TFTP(tftp-hpa) 
- シリアル通信(kermit) 
 
構築環境
- ハードウェア - FreeBSDが認識可能な2ポートNIC搭載機(ECS LIVA Z-4を使用) 
 
- OS - FreeBSD(12.0-R)
 
- NIC設定 - NIC1: DHCPによりIPアドレス自動取得・設定
- NIC2: 10.0.0.0/8 を割り当て、静的設定
 
- クライアント・サーバー共通 - SSH OpenSSH 7.8p1 
- TFTP tftp-hpa 5.2 
 
- サーバーアプリケーション - Syslogサーバー syslogd 
- DNSキャッシュサーバー local-unbound 1.8.1 
- NTPサーバー ntpd 4.2.8p12-a (1) 
- DHCPサーバー isc-dhcpd 4.4.1 
 
- クライアントツール - Kermit kermit 9.0.304 
 
セットアップ
local-unbound
- /etc/rc.conf に対して設定の追加。 
- local_unbound のセットアップ。 
- 必須ではないが /etc/resolv.conf の確認(nameserver 127.0.0.1 の追加の確認)。 
- /etc/unbound/conf.d/local.conf ファイルを作成する。 
上記作業完了後に local_unbound を立ち上げる。
/etc/rc.conf
以下の行を追加する。
local_unbound_enable="YES"
local_unbound のセットアップ
以下のコマンドを実行する。
# service local_unbound setup
/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
- ※環境に合わせてinterface、access-control行の追加または削除を実施すること。 
- outgoing-range 設定については最初は要らない可能性がある。詳細は後述のメモを参考に対応すること。 
local_unbound の立ち上げ
以下のコマンドを実行する。
# 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
上記のような警告メッセージが表示される場合は「continuing with less udp ports」の指示に従い「outgoing-range」パラメータを設定することで回避できる。
ntpd
- /etc/rc.conf に対して設定の追加。 
- /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
