CentOS6
・NTPサーバー構築
-時刻合わせのためNTPサーバーを構築した.
# yum -y install ntp
# vi /etc/ntp.conf //ntp設定ファイルの編集
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap //内部からの時刻同期を許可
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
↓ 時刻同期先NTPサーバーを変更
server -4 ntp.nict.jp // 日本標準時を提供しているNTPサーバー(stratum 1)
server -4 ntp.jst.mfeed.ad.jp // 上記サーバーと直接同期しているNTPサーバー (stratum 2)
server -4 プロバイダのNTPサーバー名 // プロバイダのNTPサーバー
--OCNの場合は ntp-os01.ocn.ad.jp (西日本用)
ISP別公開NTPサーバー一覧
-NTPサーバーを起動
NTPサーバー起動時に大幅に時刻がずれているとNTPサーバーが起動できないので、いったん、手動で時刻を合わせる
# ntpdate ntp.nict.jp ← 手動で時刻を合わせる
2 Oct 10:11:11 ntpdate[2815]: adjust time server 133.243.238.244 offset 0.076957 sec
# /etc/rc.d/init.d/ntpd start ← NTPサーバー起動
ntpd を起動中: [ OK ]
# chkconfig ntpd on ← NTPサーバー自動起動設定
NTPサーバーの確認
# ntpq -p ← NTPサーバーへの時刻同期状態確認
NTPサーバー名の前が空白の場合は時刻同期中の状態
# ntpq -p ← 約10分後、再度NTPサーバーへの時刻同期状態確認
NTPサーバー名の前に*または+が表示されれば時刻同期完了の状態(ntpqの説明)