« デジカメ画像の取り込み方 | Main | メールサーバの構築 »

September 16, 2008

NTP(Network Time Protocol)

時刻合わせを自動的にできるように設定
NTPサーバは以下のURLで確認


http://www.venus.dti.ne.jp/~yoshi-o/NTP/NTP-Table.html

設定ファイルを編集
福岡大学のサーバ2つとOCNのサーバ1つを追加

# cat /etc/ntp.conf
 
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
#server 127.127.1.0 # local clock ←コメントアウト
#fudge 127.127.1.0 stratum 10 ←コメントアウト
server clock.nc.fukuoka-u.ac.jp
server clock.tl.fukuoka-u.ac.jp
server ntp-os01.ocn.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 /etc/ntp/drift
#multicastclient # listen on default 224.0.1.1 ←コメントアウト
broadcastdelay 0.008
 
#
# Keys file. If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
#
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will. Note also that
# ntpd is started with a -A flag, disabling authentication, that
# will have to be removed as well.
#
#keys /etc/ntp/keys ←コメントアウト
#

NTPを起動

#
# /etc/rc.d/init.d/ntpd start
ntpdを起動中: [ OK ]
#

NTPの同期状態を確認してみたが、まだ同期できていない。

#
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
clock.nc.fukuok .GPS. 1 u 29 64 1 13.511 -56199. 0.004
clock.tl.fukuok .GPS. 1 u 27 64 1 383.488 -56053. 0.004
ntp-os01.ocn.ad 202.234.233.104 3 u 27 64 1 21.452 -56199. 0.004
#

しばらくして確認してみると同期できていた。

#
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*clock.nc.fukuok .GPS. 1 u 34 64 377 11.014 0.907 22.729
+clock.tl.fukuok .GPS. 1 u 97 1024 73 12.036 36.429 48.269
+ntp-os01.ocn.ad 202.234.233.104 3 u 488 512 37 17.803 -28.696 12.131
#

NTPを常に起動できるようにする。ランレベル2がoffだったのでonに設定。

#
# chkconfig ntpd on
# chkconfig --list ntpd
ntpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
# chkconfig --level 2 ntpd on
# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#

|

« デジカメ画像の取り込み方 | Main | メールサーバの構築 »

Linux」カテゴリの記事

TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/56088/42495022

Listed below are links to weblogs that reference NTP(Network Time Protocol):

« デジカメ画像の取り込み方 | Main | メールサーバの構築 »