NTPの設定について
FreeBSD 11でntpdを設定する
http://www.sakashita-net.jp/2016/12/freebsd-11ntpd.html
でNICTのntpサーバーについては
pool ntp.nict.jp
と書くことにしたのですが、翌日になっても同期がされないようです。
# ntpq -p
remote refid st t when poll reach delay offset jitter
=======================================================================
LOCAL(0) .LOCL. 10 l 3 64 1 0.000 0.000 0.000
ntp.nict.jp .POOL. 16 p - 64 0 0.000 0.000 0.000
これについて調べてみると、以下の記述を見つけました。
NTPの問い合わせ先をpool1箇所だけにするsedワンライナー
http://qiita.com/yunano/items/24e062987964023bc522
…
poolディレクティブを使うとそのFQDNに対してDNSラウンドロビンされたIPアドレス群を取得し、それぞれを問い合わせ先として使ってくれる。
…
$ ntpq -p
remote refid st t when poll reach delay offset jitter
=======================================================================
ntp.nict.jp .POOL. 16 p - 64 0 0.000 0.000 0.000
+ntp-b2.nict.go. .NICT. 1 u 48 64 7 5.821 -69.727 62.623
*ntp-b3.nict.go. .NICT. 1 u 59 64 3 7.504 -64.560 30.538
+ntp-a2.nict.go. .NICT. 1 u 49 64 7 10.237 -71.578 65.055
+ntp-a3.nict.go. .NICT. 1 u 55 64 7 8.362 -66.616 60.709
上記のようにpoolに書いたサーバーの一覧が出るようなのですが、私の環境でではうまくいかないようです。同期の状態を見てもreach noneになっています。
# ntpq -c assoc
ind assid status conf reach auth condition last_event cnt
===========================================================
1 45322 963a yes yes none sys.peer sys_peer 3
2 45323 8811 yes none none reject mobilize 1
#
なので、ntp.nict.go.jpで帰ってくるすべてのIPアドレスについて、server指示子で名前を使って指定することにしました。
# drill ntp.nict.go.jp
…
;; ANSWER SECTION:
ntp.nict.go.jp. 20172 IN A 133.243.238.243
ntp.nict.go.jp. 20172 IN A 133.243.238.244
ntp.nict.go.jp. 20172 IN A 133.243.238.163
ntp.nict.go.jp. 20172 IN A 133.243.238.164
…
# drill -x 133.243.238.243
…
;; ANSWER SECTION:
243.238.243.133.in-addr.arpa. 18853 IN PTR ntp-a2.nict.go.jp.
…
# cat /etc/ntp.conf
…
server ntp-a2.nict.go.jp
server ntp-a3.nict.go.jp
server ntp-b2.nict.go.jp
server ntp-b3.nict.go.jp
#
server ntp1.jst.mfeed.ad.jp
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp
#
server 0.jp.pool.ntp.org
server 1.jp.pool.ntp.org
server 2.jp.pool.ntp.org
ついでにntp.orgの日本でのサーバーも追加しました。