/etc/ntp.confの編集
以下を組み合わせて設定する。
ignore すべてのNTPアクセスを無視
noquery 時刻問い合わせパケットを無視
nomodify 設定変更要求パケットを無視
notrap 状態変更時にトラップを上げない
デフォルトはすべて無視
ローカルホスト、LAN内は許可する
serverはインターネットマルチフィードに指定(日本で公開されているStratum2)
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default ignore
# 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
# Hosts on local network are less restricted.
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).
restrict 210.173.160.27 mask 255.255.255.255 nomodify notrap noquery
restrict 210.173.160.57 mask 255.255.255.255 nomodify notrap noquery
restrict 210.173.160.87 mask 255.255.255.255 nomodify notrap noquery
server ntp1.jst.mfeed.ad.jp
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntp/drift
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
リブート時の自動サービス起動
#chkconfig --level 35 ntpd on
ntpdの起動
/etc/init.d/ntpd start
ntpd動作確認
#ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+ntp1.jst.mfeed. 210.173.160.86 2 u 59 64 377 4.884 -47.930 4.057
*ntp2.jst.mfeed. 210.173.160.86 2 u 48 64 377 5.117 -47.076 3.823
ntpclientからの接続
※またサーバ設定時刻があまりにも正確な時刻からかけ離れている場合はこのコマンドでserverに接続しまずは時刻を合わせる。
#ntpdate 192.168.1.4
21 Dec 22:39:12 ntpdate[1107]: adjust time server 192.168.1.4 offset 0.000612 sec
最終更新:2008年07月10日 00:00