centos7
chrony

CentOS7のNTP設定

CentOS7よりntpdではなくchronydが標準となった。

普通にntpdを使おうとして無くて困ったのでまとめておきます。

timedatectlで時刻がどうなっているか確認できる。

$ timedatectl
      Local time: 月 2018-05-28 22:41:24 JST
  Universal time: 月 2018-05-28 13:41:24 UTC
        RTC time: 月 2018-05-28 13:41:24
       Time zone: Asia/Tokyo (JST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

chonyc sourcesでサーバ同期状況を確認

$ chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* x.x.x.x                  2   6   377    37    -14us[  -18us] +/- 4058us

設定ファイルは /etc/chrony.confとなる。

/etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

server x.x.x.x iburst

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking
~
~
~
参考資料:CentOS 7 NTP設定・・・ちょっと待て!?