RockyLinuxのchronyで時刻同期をする手順
| 登録日 | :2024/03/02 12:13 |
|---|---|
| カテゴリ | :Linux |
並列計算機の時刻同期をする方法として、クライアントのノードは管理サーバの時刻を参照するようにし、管理サーバがインターネットの時刻を取得する構成とする。
1 管理サーバのchrony設定
/etc/chrony.confにて、接続許可するIPアドレスの範囲を記述する
[root@manage etc]# vi chrony.conf
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.1.0/24
設定したら、chronydのenable(自動起動)を有効化して、サービスの再起動をする。
[root@manage etc]# systemctl enable chronyd
[root@manage etc]# systemctl restart chronyd
ちなみに、管理サーバは、インターネットのNTPサーバを参照する(デフォルト設定)
[root@manage etc]# vi 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.rocky.pool.ntp.org iburst
2 クライアント側の設定
/etc/chrony.confにて参照先のサーバ設定を記述する
[root@newhead etc]# 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.rocky.pool.ntp.org iburst
# 2024.03.02
server 192.168.1.1 iburst
設定したら、chronydのenable(自動起動)を有効化して、サービスの再起動をする。
[root@manage etc]# systemctl enable chronyd
[root@manage etc]# systemctl restart chronyd
chronyc sources -vにて、chronydの参照状況を確認する
[root@newhead etc]# chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* manage 3 6 377 40 -4228us[ +16ms] +/- 15ms
[root@newhead etc]#
chronyc trackingで同期されていることを確認する
[root@newhead etc]# chronyc tracking
Reference ID : C0A83865 (manage)
Stratum : 4
Ref time (UTC) : Sat Mar 02 03:24:38 2024
System time : 0.010771716 seconds fast of NTP time
Last offset : +0.012181508 seconds
RMS offset : 0.014343089 seconds
Frequency : 10.915 ppm slow
Residual freq : +222.031 ppm
Skew : 2.550 ppm
Root delay : 0.029154643 seconds
Root dispersion : 0.014457643 seconds
Update interval : 64.9 seconds
Leap status : Normal
[root@newhead etc]#
これで、管理サーバの時刻と同期される。
[root@manage etc]# date
2024年 3月 2日 土曜日 12:27:44 JST
[root@manage etc]#
[root@newhead etc]# date
2024年 3月 2日 土曜日 12:27:46 JST
[root@newhead etc]#