サーバーのローカルタイムクロックをネットワーク内の NTP タイムソースにするにはどうすればよいでしょうか?

サーバーのローカルタイムクロックをネットワーク内の NTP タイムソースにするにはどうすればよいでしょうか?

Stratum 1 サーバーのローカル TE クロックをネットワークのネットワーク タイム ソースにしたいです (アンテナ付きの Stratum 0 サーバーは不要です)。ネットワークでこれを設定するにはどうすればよいですか? ネットワーク タイム プロトコルの使用方法と設定方法を説明したチュートリアルはありますか? これを実現する方法については、Google で今のところ何も見つかりません。ご協力いただければ幸いです。

答え1

汎用コンピュータのクロックは、現代のデバイスに期待される精度に比べると、ひどいものです。正確に調整されておらず、サーバーの温度変化によってドリフトが変化する可能性があります。そのため、何らかの方法で更新する必要があります。そうしないと、最終的には不正確になり、極端な場合には数分単位で不正確になります。クロックが一致しているだけで十分な場合もありますが、人々はもっと高い精度を期待する傾向があります。

実用的な設定に進みます。たとえばLinuxではchronyが人気があり、手動で時計を設定したり、切断されたときに対処したりする機能があります。次のような例から始めましょう。時間管理に関する RHEL ドキュメント、chrony マニュアルを参考にしてください。

ほとんどのタイム サーバーには、インターネット アクセス、衛星ナビゲーション アンテナ、または正確なクロック ハードウェアの少なくとも 1 つが備わっています。デフォルトでは、最終的に NTP 経由の参照クロックから取得された場合、chrony は時間を提供します。ネットワークに allow ディレクティブを設定し、NTP サーバーを使用します。ただし、これらのいずれもない場合は、local ディレクティブを使用して chrony に時間を提供させることができます。

これが本当にエアギャップ ネットワークであり、時間ハードウェアもない場合は、手動ディレクティブも有効にして、 で手動で時間を伝えることができますchronyc settime

これらをオンにした chrony.conf、NTP サーバーに使用できるものに関するコメント、および EL のデフォルト設定で気に入っている点をいくつか示します。

# chrony.conf that still serves time if not syncronized 

# Options for time sources

# NTP appliance
# For example, sat nav modules are inexpensive
# Assuming it is available over IP, it is an NTP server
#server time.zone.example.net iburst

# Isolated computers need software updates too!
# If there is an update server on the local net via IP,
# it can serve NTP as well as patches
#server updateproxy.example.net iburst

# Public internet NTP
# Use if you actually have internet
# But no local time source somehow
#pool 2.pool.ntp.org iburst


# Pretend local clock is syncronized
# Enabling serving time
# Use a high stratum, as a lower priority over better clocks 
local stratum 10

# Allow "chronyc settime"
# Run this with input time based on e.g. a watch or other clock
# Regularly and when the time is wrong
manual

# Allow clients to query this server
# Replace with your local net prefix
allow 2001:db8:2ea1::/48


### End source customization
### Begin other configuration

# 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

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

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

logdir /var/log/chrony
log measurements statistics tracking

関連情報