CentOS 7 で NTP クライアントを設定する

CentOS 7 で NTP クライアントを設定するには、CentOS 7 では chronyd を使うようです。

cronyd

# yum -y install chrony
# vi /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 ntp.nict.jp iburst
server 0.jp.pool.ntp.org iburst
server 1.jp.pool.ntp.org iburst
    :
# systemctl start chronyd.service
# systemctl enable chronyd.service
# systemctl status chronyd.service
chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)
   Active: active (running) since 日 2015-03-29 14:47:46 JST; 8min ago
 Main PID: 9930 (chronyd)
   CGroup: /system.slice/chronyd.service
           └─9930 /usr/sbin/chronyd -u chrony
    :

確認は、

# chronyc sources -v
210 Number of sources = 3

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||                                                /   xxxx = adjusted offset,
||         Log2(Polling interval) -.             |    yyyy = measured offset,
||                                  \            |    zzzz = estimated error.
||                                   |           |                         
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp-b2.nict.go.jp             1   7   377    37  +3279ns[+5000ns] +/-  930us
^- secure.opticnerve.asia        2   7   377   106  -9930us[-9926us] +/-   98ms
^- x.ns.gin.ntt.net              2   6   377    37   -557us[ -555us] +/-   65ms
# chronyc tracking
Reference ID    : 133.243.238.163 (ntp-b2.nict.go.jp)
Stratum         : 2
Ref time (UTC)  : Sun Mar 29 06:00:51 2015
System time     : 0.000000760 seconds fast of NTP time
Last offset     : 0.000001721 seconds
RMS offset      : 0.000107525 seconds
Frequency       : 0.071 ppm fast
Residual freq   : 0.001 ppm
Skew            : 0.130 ppm
Root delay      : 0.001857 seconds
Root dispersion : 0.000132 seconds
Update interval : 65.1 seconds
Leap status     : Normal
# 

ntpd

chronyd を使用しない場合には ntpd も使用できます。

# yum -y install ntp
# vi /etc/ntp.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 ntp.nict.jp
    :
# systemctl start ntpd.service
# systemctl enable ntpd.service
ln -s '/usr/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'
# systemctl status ntpd.service
ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
   Active: active (running) since 土 2015-03-28 01:20:52 JST; 30s ago
 Main PID: 5816 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─5816 /usr/sbin/ntpd -u ntp:ntp -g

    :
#  ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp-b3.nict.go. .NICT.           1 u   52   64    3    1.948   -0.060   0.008
#

確認バージョン

# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 
# uname -srvo
Linux 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 GNU/Linux
カテゴリー: CentOS 7 タグ: , パーマリンク

コメントは停止中です。