FreeBSDでntpdateからntpdに変更し、期限切れの閏秒ファイルも更新した
人気ブログランキング
にほんブログ村
ntpdateならびにntpdはインターネット標準時間サーバーと同期してシステム時刻を設定および維持するオペレーティングシステムのプログラムだ。
元々、何年も前に現在のPCにFreeBSDを初めてインストールした際にntpdateを選択していたのだが、近い将来にFreeBSDでntpdateが廃止されるとのことなので、ntpdに移行する。
# ee /etc/rc.conf
以下を追加する。
ntpd_enable="YES"
ntpd_sync_on_start="YES"
# ee /etc/ntp.conf
FreeBSDでは初めから標準で以下のサーバーが設定されている。
pool 0.freebsd.pool.ntp.org iburst
もし接続するサーバーをNetwork Time Protocolとする場合は以下を追加する。
driftfile /var/db/ntp/ntpd.drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
サービスを再起動する。
# service ntpd restart
時間の同期を確認する。
% ntpq -p
以下のように表示される。
remote refid st t when poll reach delay offset jitter
==============================================================================
0.freebsd.pool. .POOL. 16 p - 64 0 0.000 +0.000 0.000
202.28.116.236 .PPS. 1 u 57 64 3 34.595 +1.247 0.127
61-91-205-20.st 203.147.59.17 2 u 55 64 3 31.221 +0.813 0.738
*ntp1.bknix.co.t .GPS. 1 u 56 64 3 29.048 +0.265 0.319
ntp.kku.ac.th .PPS. 1 u 56 64 3 35.318 +0.252 0.214
ns.tu.ac.th 203.159.70.33 2 u 47 64 1 28.679 +0.256 0.149
124.109.2.169 203.159.70.33 2 u 52 64 3 28.753 +0.793 1.554
また起動時に以下のような閏秒ファイルの期限切れが警告されるようになった。
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): good hash signature
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): loaded, expire=2023-06-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): expired 1 day ago
そのため、閏秒ファイル(ntpd.leap-seconds.list)も更新することにする。
先ず既存のファイルをバックアップしておく。
# mv /var/db/ntpd.leap-seconds.list /var/db/ntpd.leap-seconds.list_old
ファイルを更新をする。
# /etc/rc.d/ntpd fetch
更新できない場合は、以下をインストールしてから更新する。
# pkg install ca_root_nss
ファイルの日付を確認する。
% ls -la /var/db/ntpd.leap-seconds.list
-rw-r--r-- 1 root wheel 10666 4月 12 18:45 /var/db/ntpd.leap-seconds.list
ファイルが新しい日付となっていれば良し。
次回起動時に、ファイルの更新と次回の期限も確認する。
% cat /var/log/messages | grep ntpd
Jun 28 16:07:57 freebsd ntpd[1376]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): good hash signature
Jun 28 16:07:57 freebsd ntpd[1376]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): loaded, expire=2023-12-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
次回の期限は以下のとおり。
expire=2023-12-28T00:00:00Z
人気ブログランキング
にほんブログ村
にほんブログ村
ntpdateならびにntpdはインターネット標準時間サーバーと同期してシステム時刻を設定および維持するオペレーティングシステムのプログラムだ。
元々、何年も前に現在のPCにFreeBSDを初めてインストールした際にntpdateを選択していたのだが、近い将来にFreeBSDでntpdateが廃止されるとのことなので、ntpdに移行する。
# ee /etc/rc.conf
以下を追加する。
ntpd_enable="YES"
ntpd_sync_on_start="YES"
# ee /etc/ntp.conf
FreeBSDでは初めから標準で以下のサーバーが設定されている。
pool 0.freebsd.pool.ntp.org iburst
もし接続するサーバーをNetwork Time Protocolとする場合は以下を追加する。
driftfile /var/db/ntp/ntpd.drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
サービスを再起動する。
# service ntpd restart
時間の同期を確認する。
% ntpq -p
以下のように表示される。
remote refid st t when poll reach delay offset jitter
==============================================================================
0.freebsd.pool. .POOL. 16 p - 64 0 0.000 +0.000 0.000
202.28.116.236 .PPS. 1 u 57 64 3 34.595 +1.247 0.127
61-91-205-20.st 203.147.59.17 2 u 55 64 3 31.221 +0.813 0.738
*ntp1.bknix.co.t .GPS. 1 u 56 64 3 29.048 +0.265 0.319
ntp.kku.ac.th .PPS. 1 u 56 64 3 35.318 +0.252 0.214
ns.tu.ac.th 203.159.70.33 2 u 47 64 1 28.679 +0.256 0.149
124.109.2.169 203.159.70.33 2 u 52 64 3 28.753 +0.793 1.554
また起動時に以下のような閏秒ファイルの期限切れが警告されるようになった。
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): good hash signature
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): loaded, expire=2023-06-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
Jun 28 15:57:10 freebsd ntpd[1390]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): expired 1 day ago
そのため、閏秒ファイル(ntpd.leap-seconds.list)も更新することにする。
先ず既存のファイルをバックアップしておく。
# mv /var/db/ntpd.leap-seconds.list /var/db/ntpd.leap-seconds.list_old
ファイルを更新をする。
# /etc/rc.d/ntpd fetch
更新できない場合は、以下をインストールしてから更新する。
# pkg install ca_root_nss
ファイルの日付を確認する。
% ls -la /var/db/ntpd.leap-seconds.list
-rw-r--r-- 1 root wheel 10666 4月 12 18:45 /var/db/ntpd.leap-seconds.list
ファイルが新しい日付となっていれば良し。
次回起動時に、ファイルの更新と次回の期限も確認する。
% cat /var/log/messages | grep ntpd
Jun 28 16:07:57 freebsd ntpd[1376]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): good hash signature
Jun 28 16:07:57 freebsd ntpd[1376]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): loaded, expire=2023-12-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
次回の期限は以下のとおり。
expire=2023-12-28T00:00:00Z
人気ブログランキング
にほんブログ村
コメント
コメントを投稿