[root@localhost ~]# yum -y install chrony ← chronyインストール |
[root@centos ~]# vi /etc/chrony.conf ← ntp設定ファイル編集 |
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). ↓ 時刻同期先NTPサーバーを変更 # 日本標準時を提供しているNTPサーバー(stratum 1) server ntp.nict.jp iburst # 上記サーバーと直接同期しているNTPサーバー(stratum 2) server ntp.jst.mfeed.ad.jp iburst # Allow NTP client access from local network. #allow 192.168.0.0/16 allow 192.168.1.0/24 ← 内部(例:192.168.1.0/24)からの時刻同期を許可 |
NTPサーバー起動時に大幅に時刻がずれているとNTPサーバーが起動できないので、いったん、手動で時刻を合わせる
[root@centos ~]# chronyc makestep ← 手動で時刻を合わせる |
[root@centos ~]# systemctl restart chronyd ← NTPサーバー再起動※CentOS7の場合 |
[root@centos ~]# systemctl enable chronyd ← NTPサーバー自動起動設定※CentOS7の場合 |
[root@centos ~]# chronyc sources ← NTPサーバーへの時刻同期状態確認 |
210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample ================================================= ^* ntp-a3.nict.go.jp 1 6 17 26 -38us[ -112us] +/- 4315us ^- ntp3.jst.mfeed.ad.jp 2 6 17 26 -369us[ -369us] +/- 12ms |