NTPサーバ

CentOS7からはNTPDからChronyに変更されています。
最小インストールでChronyがインストールされます。
# vi /etc/chrony.conf
同期をとるサーバーを変更
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst
server ntp3.jst.mfeed.ad.jp iburst

うるう秒対策
leapsecmode slew
maxslewrate 1000
smoothtime 400 0.001 leaponly

# systemctl start chronyd
# systemctl enable chronyd
以下のように結果が返ってくれば OK
# chronyc sources
210 Number of sources = 3
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp1.jst.mfeed.ad.jp 2 10 377 460 -780us[ -762us] +/- 80ms
^+ ntp2.jst.mfeed.ad.jp 2 10 377 569 +674us[ +695us] +/- 89ms
^+ ntp3.jst.mfeed.ad.jp 2 9 377 150 +229us[ +229us] +/- 130ms
従来のNTPDの場合
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+ntp1.jst.mfeed. 133.243.236.17 2 u 113 128 377 3.775 -4.485 1.841
*ntp2.jst.mfeed. 133.243.236.17 2 u 46 128 377 3.867 -3.220 1.916
+ntp3.jst.mfeed. 133.243.236.17 2 u 114 128 377 3.790 -2.480 1.079

うるう秒

平成29年(2017年)1月1日(日)に1年6ヶ月ぶりとなる「うるう秒」の調整が行われます。

Leap Indicatorを確認する方法
NTPDの場合 $ ntpq -c rv
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.6p5@1.2349-o Mon Nov 14 18:25:09 UTC 2016 (1)",
processor="x86_64", system="Linux/3.10.0-514.2.2.el7.x86_64", leap=00,
stratum=3, precision=-23, rootdelay=55.372, rootdisp=7990.110,
refid=210.173.160.57,
reftime=dc10c634.e9d02c85 Fri, Dec 30 2016 20:40:36.913,
clock=dc10c655.17579ba6 Fri, Dec 30 2016 20:41:09.091, peer=53238, tc=6,
mintc=3, offset=0.542, frequency=4.306, sys_jitter=1.081,
clk_jitter=0.293, clk_wander=0.000

leap=00というのがLeap Indicatorです。
00 の場合は調整は発生しません
01 正の調整が発生
10 負調整が発生

Leap Indicatorがセットされた様子
$ ntpq -c rv associd=0 status=4615 leap_add_sec, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.6p5@1.2349-o Mon Nov 14 18:25:09 UTC 2016 (1)",
processor="x86_64", system="Linux/3.10.0-514.2.2.el7.x86_64", leap=01,
stratum=3, precision=-23, rootdelay=51.102, rootdisp=57.864,
refid=210.173.160.27,
reftime=dc117ac3.e3837dbb Sat, Dec 31 2016 9:30:59.888,
clock=dc117adb.692eb816 Sat, Dec 31 2016 9:31:23.410, peer=53237, tc=6,
mintc=3, offset=-0.136, frequency=0.182, sys_jitter=0.480,
clk_jitter=0.061, clk_wander=0.004

chronydの場合
$ chronyc tracking
Reference ID : 210.173.160.27 (ntp1.jst.mfeed.ad.jp)
Stratum : 3
Ref time (UTC) : Fri Dec 30 11:29:52 2016
System time : 0.000047456 seconds fast of NTP time
Last offset : +0.000052418 seconds
RMS offset : 0.000052418 seconds
Frequency : 0.042 ppm slow
Residual freq : +0.966 ppm
Skew : 0.090 ppm
Root delay : 0.049980 seconds
Root dispersion : 0.045825 seconds
Update interval : 65.2 seconds
Leap status : Normal

Leap Indicatorがセットされた様子
$ chronyc tracking
Reference ID : 210.173.160.27 (ntp1.jst.mfeed.ad.jp)
Stratum : 3
Ref time (UTC) : Sat Dec 31 00:30:15 2016
System time : 0.000132790 seconds slow of NTP time
Last offset : +0.000019502 seconds
RMS offset : 0.000169355 seconds
Frequency : 0.190 ppm slow
Residual freq : -0.001 ppm
Skew : 0.064 ppm
Root delay : 0.048311 seconds
Root dispersion : 0.054025 seconds
Update interval : 1044.5 seconds
Leap status : Insert second

うるう秒 挿入された様子

平成29年(2017年)1月1日(日)9:00 に「うるう秒」の調整が行われました。 その時の挙動に差があったので備忘録です。

CentOS Linux release 7.3.1611 + ntp-4.2.6p5-25 ( -x )
Jan 1 09:00:00 hostname ntpd[pid]: Ignoring leap second
Jan 1 09:00:00 hostname ntpd[pid]: 0.0.0.0 061b 0b leap_event
CentOS release 6.8 + ntp-4.2.6p5-10 ( -x )
Dec 31 10:52:34 hostname ntpd[pid]: kernel reports leap second insertion scheduled
Jul 1 09:00:00 hostname ntpd[pid]: 0.0.0.0 061b 0b leap_event
Jan 1 09:10:50 hostname ntpd[pid]: kernel reports leap second has occurred
CentOS Linux release 7.3.1611 + chrony-2.1.1-4
Jan 1 09:00:00 hostname chronyd[pid]: Adjusting system clock for leap second

2017-01-01
08:59:58.824881
08:59:58.925078
08:59:59.025272
08:59:59.125484
08:59:59.225674
08:59:59.325906
08:59:59.426173
08:59:59.526316
08:59:59.626489
08:59:59.726635
08:59:59.826833
08:59:59.927041
08:59:59.027267 ← 挿入された様子
08:59:59.127448
08:59:59.227636
08:59:59.327865
08:59:59.428059
08:59:59.528180
08:59:59.628325
08:59:59.728502
08:59:59.828691
08:59:59.928894
09:00:00.029020
09:00:00.129168

Leap Indicatorが通常に戻った様子
$ chronyc tracking
Reference ID : 210.173.160.27 (ntp1.jst.mfeed.ad.jp)
Stratum : 3
Ref time (UTC) : Sun Jan 1 00:21:06 2017
System time : 0.000181221 seconds slow of NTP time
Last offset : -0.000161002 seconds
RMS offset : 0.000119950 seconds
Frequency : 0.044 ppm fast
Residual freq : +0.065 ppm
Skew : 0.137 ppm
Root delay : 0.050606 seconds
Root dispersion : 0.042788 seconds
Update interval : 1030.2 seconds
Leap status : Normal

↑先頭