NTPのインストール
NTPサーバを設定し、日本標準時刻と同期するようにします。サーバの時刻同期についても設定が漏れがちだったので備忘録として掲載します。
NTPをインストール
NTPサーバをインストールします。
# yum install ntp
外部ntpサーバから時刻を取得
参照するNTPサーバの設定をします。
/etc/ntp.confを開いて以下を編集します。
# vi /etc/ntp.conf
以下の部分をコメントアウトして、
server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org
↓↓↓ 以下を追記
server -4 ntp.nict.jp server -4 ntp1.jst.mfeed.ad.jp server -4 ntp2.jst.mfeed.ad.jp server -4 ntp3.jst.mfeed.ad.jp
NTPサービスの起動と自動起動設定
NTPサービスを起動して、自動起動も設定します。
# systemctl start ntpd
設定の確認をします。「ntpq -p」を実行すると設定した外部のタイムサーバが表示されます。
先頭に「*」がついているサーバが同期しているサーバとなります。
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp-a2.nict.go. .NICT.           1 u  103 1024  377    2.241    0.040   0.090
+ntp1.jst.mfeed. 133.243.236.17   2 u  199 1024  377    3.008    0.862   0.356
+ntp2.jst.mfeed. 133.243.236.17   2 u  525 1024  377    2.998   -0.264   0.312
-ntp3.jst.mfeed. 133.243.236.17   2 u  764 1024  377    2.613   -1.291   0.087
最後に自動起動の設定も有効にしておきます。
# systemctl enable ntpd
以上で設定は完了です。
(Visited 1,970 times, 1 visits today)