LoginSignup
0
0

More than 1 year has passed since last update.

NTPサーバの作成【サーバ構築】

Posted at

参考サイト

環境

OS:CentOs8 stream
IPアドレス:192.168.160.10/24

手順

今回、CentOsの構築手順は省略する。
全体的に、そこまで長くない。

Chronyのインストール

以下のコマンドでインストールする。

sudo yum -y install chrony

設定ファイルの変更

インストールしたら、設定ファイルを変更する。

sudo vi /etc/chrony.conf
sudo vi /etc/chrony.conf
------------------------------------------------------------
以下をコメントアウト
 #pool 2.centos.pool.ntp.org iburst
 pool ntp.nict.jp iburst
 pool jp.pool.ntp.org iburst

 # Allow NTP client access from local network.
 # allow 192.168.0.0/24(アクセスを許可するネットワークアドレス)
 # Serve time even if not synchronized to a time source.
local stratum 10
  • allow アドレスのセグメント アクセスを許可するセグメント帯を指定する。
  • local stratum 10 上位NTPサーバーを参照していなくても、時刻同期を行えるようにする
  • pool ntp.nict.jp iburst パブリックの、ntpサーバ群を参照するようにする。
    • 独立行政法人情報通信研究機構(NICT) の公開NTPサーバー

NTPサーバの再起動

以下のコマンドで、NTPサーバの再起動と、自動起動の設定を行う。

sudo systemctl restart chronyd
sudo systemctl enable chronyd

動作確認

以下のコマンドで、_NTPのサービスが起動しているかを確認する。

sudo systemctl status chronyd

Activeとなっている事を確認する。

また、以下のコマンドを実行する。

sudo timedatectl

そして、

  • 表示されている時刻が現在の時刻と正しいか、
  • NTP service: active と表示されており、ntpのサービスが動いているか
  • System clock synchronized: no で、他のntpサーバに同期していないか
    を確認する。

以上

注意(コンプラ的な)

公開用のpublicサーバは、数台の指定なら問題ないが、何十台、何百台と指定するのは、接続先のNTPサーバに負荷がかかるので、マナー違反となる。
そのため、今回のように自前でNTPサーバを作成し、後から作るサーバはその自前のサーバを参照する事で、元の公開用ntpサーバの負荷を減らす。

0
0
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
0
0