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

 
Chrony のインストール
CentOS7 より時刻(NTP)サーバーが変更になり Chrony になった
CentOS の一般的なインストールでは標準でインストールされるが最小インストール等ではインストールされないのでインストールする
バージョン:chronyd (chrony) version 3.2
 
 
[root@centos]# dnf -y install chrony
 
ntp の設定
時刻設定ファイルの作成
 
 
[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).
 pool
2.centos.pool.ntp.org iburst   <--- 書き換え
      

 pool ntp.nict.jp iburst   <--- 独立行政法人 情報通信研究機構のNTPサーバーに変更(日本標準時) 
 
 # 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
      

 allow 192.168.1.0/24   <--- コメントを解除して書き換え LAN内からの時刻同期を許可
 
 
以下略
 
ntp の起動
 
 [root@
centos]# systemctl start chronyd
 
ntpd の自動起動設定
 
 [root@
centos]# systemctl enable chronyd
 
自動起動設定の確認
 
 [root@
centos]# systemctl is-enabled chronyd   <--- 入力
 
enabled   <--- enabled になっていればOK
 
ntp の起動 &時刻調整の確認
 
 [root@centos]# 
chronyc sources
 210 Number of sources = 4
 MS Name/IP address     Stratum Poll Reach LastRx Last sample
 ===============================================================================
  * ntp-a2.nict.go.jp         1    6    17   7    -95ns[  -17us] +/- 3299us
  - ntp-a3.nict.go.jp         1    6    17   7    -49us[  -49us] +/- 3459us
  - ntp-a2.nict.go.jp         1    6    17   7   -158us[ -158us] +/- 3234us
  - ntp-k1.nict.jp            1    6    17   6   +197us[ +197us] +/- 7299us
 
上記のようにサーバー名(アドレス)の前に + * のマークが付いていればネット上にあるメインNtpサーバーと同期が取れている
もし、 + * のマークが付いていない場合は10〜15分ぐらい経ってから再度実行

戻る