ntpdの設定
#RedHat9
■ntp.confの編集
# cd /etc
# vi ntp.conf
# -- CLIENT NETWORK -------
restrict 192.168.1.0 mask 255.255.255.0 noquery
# server mytrustedtimeserverip
# U-netsurf ntp.netsurf.ad.jp (プロバイダのNTP)
restrict 202.233.0.36 nomodify notrap noquery
# NICT ntp.nict.jp (NICTのNTP)
restrict 133.243.238.243 nomodify notrap noquery
restrict 133.243.238.244 nomodify notrap noquery
restrict 133.243.238.163 nomodify notrap noquery
restrict 133.243.238.164 nomodify notrap noquery
CLIENT NETWORK 許可するネットワークを設定
server mytrustedtimeserverip 参照する上位のNTPサーバを指定
noquery 192.168.1.0からntpサーバが逆に時間をもらうことの禁止
以下をコメントアウト&追加
#server 127.127.1.0 # local clock
server ntp.netsurf.ad.jp
server ntp.nict.jp
#fudge 127.127.1.0 stratum 10
#authenticate yes
#keys /etc/ntp/keys
※ プロバイダのntpサーバ(使用プロバイダによって変更)
NICTのntpサーバ
http://internet.watch.impress.co.jp/cda/news/2006/...
※ 127.127.1.0 本体のマザーボードの時計
# service ntpd start (すでに起動しているならrestart)
ntsysvでntpdをlinux起動時に起動するようにする。
■起動確認
# ntpd -p
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp.netsurf.ad. 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00
*ntp-b2.nict.go. .PPS. 1 u 19 64 17 23.343 0.252 0.304
おまけ
ハードウェアクロックも同期する
# crontab -e
以下を追加
0 3 * * * /sbin/clock -w
成功例
失敗例
※失敗としてよくあるのがiptablesでTCP 123のアクセス制御がかかっている場合。うっかりうっかり。
■ntp.confの編集
# cd /etc
# vi ntp.conf
# -- CLIENT NETWORK -------
restrict 192.168.1.0 mask 255.255.255.0 noquery
# server mytrustedtimeserverip
# U-netsurf ntp.netsurf.ad.jp (プロバイダのNTP)
restrict 202.233.0.36 nomodify notrap noquery
# NICT ntp.nict.jp (NICTのNTP)
restrict 133.243.238.243 nomodify notrap noquery
restrict 133.243.238.244 nomodify notrap noquery
restrict 133.243.238.163 nomodify notrap noquery
restrict 133.243.238.164 nomodify notrap noquery
CLIENT NETWORK 許可するネットワークを設定
server mytrustedtimeserverip 参照する上位のNTPサーバを指定
noquery 192.168.1.0からntpサーバが逆に時間をもらうことの禁止
以下をコメントアウト&追加
#server 127.127.1.0 # local clock
server ntp.netsurf.ad.jp
server ntp.nict.jp
#fudge 127.127.1.0 stratum 10
#authenticate yes
#keys /etc/ntp/keys
※ プロバイダのntpサーバ(使用プロバイダによって変更)
NICTのntpサーバ
http://internet.watch.impress.co.jp/cda/news/2006/...
※ 127.127.1.0 本体のマザーボードの時計
# service ntpd start (すでに起動しているならrestart)
ntsysvでntpdをlinux起動時に起動するようにする。
■起動確認
# ntpd -p
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp.netsurf.ad. 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00
*ntp-b2.nict.go. .PPS. 1 u 19 64 17 23.343 0.252 0.304
おまけ
ハードウェアクロックも同期する
# crontab -e
以下を追加
0 3 * * * /sbin/clock -w
ntpクライアントの時刻合わせ
# ntpdate ntpサーバ成功例
7 Jan 19:11:04 ntpdate[1689]: step time server 192.168.1.4 offset -4946.552378 sec
失敗例
7 Jan 20:31:21 ntpdate[1649]: no server suitable for synchronization found
※失敗としてよくあるのがiptablesでTCP 123のアクセス制御がかかっている場合。うっかりうっかり。
2007年01月07日(日) 19:15:21 Modified by glass57