NTPがインストールされていないようならまずは
yum -y install nt
でインストールを行う。
「Complete!」が出るとインストール完了。
次にNTPの設定。
vi /etc/ntp.conf でファイルの編集。
NTPサーバを指定する。
※今回は独立行政法人情報通信研究機構 (NICT) の
ntp-a1.nict.go.jp
ntp-b1.nict.go.jp
を指定。
外部のNTPサーバーへのNTPアクセス許可
--------------------------------------------------------------------
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
restrict ntp-a1.nict.go.jp
restrict ntp-b1.nict.go.jp
--------------------------------------------------------------------
赤字の部分を追加。
外部のNTPサーバーの指定
-------------------------------------------------------------------
# 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
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server ntp-a1.nict.go.jp
server ntp-b1.nict.go.jp
--------------------------------------------------------------------
赤字の部分を追加。アクセス許可してる外部サーバを追加する。
:wqで保存して終了。
ntpdを起動してntpdの自動起動設定をする。
service ntpd start で起動。
chkconfig ntpd on
chkconfig --list ntpd
で自動起動設定。
----------------------------------------------------
[root@ ~]# chkconfig ntpd on
[root@ ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
-----------------------------------------------------
時刻同期状態の確認
ntpq -p で確認。
-----------------------------------------------------------------------------------
[root@ ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
vs01.typo3hosti 133.243.238.163 2 u 6 64 1 11.983 -586.21 0.001
vps.jre655.com 133.243.238.164 2 u 5 64 1 1.542 -586.73 0.001
pache.auto-id.w 131.113.192.40 2 u 5 64 1 3.122 -586.90 0.001
ntp-a1.nict.go. .INIT. 16 u - 64 0 0.000 0.000 0.000
LOCAL(o) .LOCL. 10 l 3 64 1 0.000 0.000 0.001
*参考URL*
http://mountainbigroad.jp/fc5/ntp.html
推奨公開サーバ
http://wiki.nothing.sh/page/NTP/%BF%E4%BE%A9%B8%F8%B3%AB%A5%B5%A1%BC%A5%D0#hf7bbb0e