1 views

※2015.01.25修正。NTPサーバーがntpdからchronydに変更されていることに気づきませんでした。

実現する機能

NTP(Network Time Protocol)サーバーを構築して、サーバーのシステム時刻を日本標準時間に自動的に合わせます。パソコンの内蔵時計は月に数分狂うので、日本標準時間に自動同期することでサーバー時刻の正確性を確保しました。

NTPサーバー導入手順

(1)NTPサーバー設定

[root@ufuso ~]# vi /etc/chrony.conf ← chrony.confを編集。
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst ← #を付けて無効にする
#server 1.centos.pool.ntp.org iburst ← #を付けて無効にする
#server 2.centos.pool.ntp.org iburst ← #を付けて無効にする
#server 3.centos.pool.ntp.org iburst ← #を付けて無効にする
server ntp1.jst.mfeed.ad.jp ← 追記。上記サーバーと直接同期しているNTPサーバ
ー(stratum 2)
server ntp2.jst.mfeed.ad.jp ← 追記。上記サーバーと直接同期しているNTPサーバ
ー(stratum 2)
server ntp3.jst.mfeed.ad.jp ← 追記。上記サーバーと直接同期しているNTPサーバ
ー(stratum 2)

# Allow NTP client access from local network.
#allow 192.168/16
allow 192.168.24.0/24 ← 追記。ネットワーク内のPCからの同期を許可。
192.168.24.0/24は例示

※chrony.confファイルが無ければyum -y install chronyと入力してインストール
から始めること

(2)NTPサーバー起動

[root@ufuso ~]# ntpdate ntp.nict.jp ← 手動で同期を図る
21 Jul 11:55:11 ntpdate[16055]: adjust time server 133.243.238.243 offset -0.000642 sec

[root@ufuso ~]# systemctl start chronyd ← NTPサーバーを起動させる

[root@ufuso ~]# systemctl enable chronyd ← 自動起動をONにする

(3)NTPサーバー確認

[root@ufuso ~]# chronyc sources ← NTPサーバーへの時刻同期状態確認
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ 122x215x240x52.ap122.ftth     2  10   377   729  -1332us[-1332us] +/-   64ms
^+ li528-174.members.linode.     3  10   377   723  -1004us[-1004us] +/-   99ms
^* chobi.paina.jp                2  10   377   999   -161us[ -616us] +/-   49ms
^- ntp7.vps.net                  2   6   377    39    -15ms[  -15ms] +/-   53ms

※"^"はサーバ、"="はピア、"#"はローカル、"*"は同期対象として採用中、"+"は同期
対象候補、"-"はアルゴリズムにより同期対象から外れているもの

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください