自宅サーバー ≫ Linux Server ≫ CentOS 7 ≫ 時刻サーバー(Chrony)

 
Chrony のインストール
CentOS7 より時刻(NTP)サーバーが変更になり Chrony になった
CentOS の一般的なインストールでは標準でインストールされるが最小インストール等ではインストールされないのでインストールする
バージョン:chronyd (chrony) version 3.2
 
 
[root@centos]# yum -y install chrony
 
ntp の設定
時刻を正確な日本標準時間に合わせる
 
 
[root@centos]# ntpdate ntp.nict.jp
 
時刻設定ファイルの作成
 
 
[root@centos]# 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   <--- 独立行政法人 情報通信研究機構のNTPサーバーに変更(日本標準時) 
 server
ntp.jst.mfeed.ad.jp iburst   <--- 上記サーバーと直接同期しているサーバー
 
 # Ignore stratum in source selection.
 stratumweight 0

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

 # Enable kernel RTC synchronization.
 rtcsync

 # In first three updates step the system clock instead of slew
 # if the adjustment is larger than 10 seconds.
 makestep 10 3

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

 allow 192.168.1.0/24   <--- コメントを解除して書き換え LAN内からの時刻同期を許可
 
 
以下略
 
ntp の起動
 
 [root@
centos]# systemctl start chronyd
 
ntpd の自動起動設定
 
 [root@
centos]# systemctl enable chronyd
 
自動起動設定の確認
 
 [root@
centos]# systemctl list-unit-files | grep chronyd   <--- 入力
 
chronyd.service                              enabled   <--- enabled になっていればOK
 
ntp の起動 &時刻調整の確認
 
 [root@centos]# 
chronyc sources
 210 Number of sources = 2
 MS Name/IP address         Stratum Poll Reach LastRx Last sample
 ==============================================================================
 
*ntp-b3.nict.go.jp               1   6   377     17  +664us[ +579us] +/- 3963us
 
-ntp3.jst.mfeed.ad.jp            2   6   377     16  +726us[ +726us] +/-   12ms
 
上記のようにサーバー名(アドレス)の前に + * のマークが付いていればネット上にあるメインNtpサーバーと同期が取れている
もし、 + * のマークが付いていない場合は10~15分ぐらい経ってから再度実行

戻る