LoginSignup
32
40

More than 5 years have passed since last update.

閉じたネットワークでNTPで時刻同期する

Posted at

インターネットに接続していない環境で、NTPで時刻同期する場合、

親玉のサーバは、自分のローカルの時刻と同期し、

子分たちは、親玉の言いなりになります。

親分の設定

/etc/ntp.conf
# 子分たちがアクセスするネットワークからの時刻同期は許可
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# 親分は自分のローカルタイムを参照
server  127.127.1.0 prefer
fudge   127.127.1.0 stratum 10

ntpdを再起動して、時刻同期できていることを確認。

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.          10 l   35   64  377    0.000    0.000   0.000

子分たちの設定

/etc/ntp.conf
# 親分に時刻同期
server 192.168.1.1 prefer

ntpdを再起動。

あまりに子分の素行が悪ければ、手動で時刻同期。 ntpdate –u 192.168.1.1

時刻同期できていることを確認

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*oyabun        LOCAL(0)        11 u   36   64  377    0.123    0.529   0.129
32
40
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
40