/usr/sbin/ntpdate -s -b サーバIPはやっぱり必要なので先にやっておきましょう
/sbin/clock -w
まず、ntp.confの設定ですが、以下のようになります。(イカサマ意訳日本語注釈付き(笑))
訳注で書きましたが最初restrict をホスト名で指定していてはまりました(笑)# Prohibit general access to this service. #とりあえず全てのアクセスを無効に設定 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 # -- CLIENT NETWORK ------- # Permit systems on this network to synchronize with this # time service. Do not permit those systems to modify the # configuration of this service. Also, do not use those # systems as peers for synchronization. # restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap #クライアントからの同期参照を許可するネットワークを指定してください。 #ここで指定するIPには「notrust nomodify notrap」などのオプションをつけて #クライアントからの変更を許可させないでください。 #またpeersなどで相互同期させることもやめましょう restrict 192.16.1.0 mask 255.255.255.0 notrust nomodify notrap # --- OUR TIMESERVERS ----- # or remove the default restrict line # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. # restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery # server mytrustedtimeserverip #いちいちrestrict を指定するのが面倒なら最初の「restrict default ignore」を #削除してください。(ってそれで良いのか?) #ここではあなたが参照する親のNTPサーバを指定してください。ただしその際は #「nomodify notrap noquery」などのオプションをつけて親サーバからの変更などを #抑止してください #(訳注:restrictはホスト名での指定が出来ません。必ずIPアドレスで指定してください) #アクセス許可 restrict 210.173.160.27 nomodify notrap noquery restrict 210.173.160.57 nomodify notrap noquery restrict 210.173.160.87 nomodify notrap noquery #サーバーとして設定 server 210.173.160.27 server 210.173.160.57 server 210.173.160.87 # --- NTP MULTICASTCLIENT --- #普通は設定不用 #multicastclient # listen on default 224.0.1.1 # restrict 224.0.1.1 mask 255.255.255.255 notrust nomodify notrap # restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap # --- GENERAL CONFIGURATION --- # # 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. #英文は長くってよう判りませんが。外部とつながらない時用のバックアップの設定です。 #外部のNTPサーバにつながらないときは自分自身の時計で同期を計ります。 #つけておいた方が無難でしょう # server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 #優先度を10まで下げる # # 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. #ドリフトファイルの場所を指定してください。 #もちろんそのファイルはNTPデーモンが書き込み権限を持ってなければなりません # driftfile /etc/ntp/drift broadcastdelay 0.008 # # Authentication delay. If you use, or plan to use someday, the # authentication facility you should make the programs in the auth_stuff # directory and figure out what this number should be on your machine. #認証関連。がんばる元気のある人以外はnoがベターです # #authenticate yes authenticate no # # 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. #キーファイルの場所。やるんならちゃんとパーミッション600にして見られないように! #それから、デフォルトの場所を使うのも認証を使う意味が無くなるので自分で設定して #ください #あと-Aオプションで認証が無効になるのにも注意のこと # #keys /etc/ntp/keys #ログは必要な方だけどうぞ。でも、重要な情報はsyslogにかかれるので、個人的には #要らないかと・・・ #logfile /var/log/ntpd.log
あとntpdを起動後
ntpq -pを実行するとntpがちゃんと昨日しているか判ります。
(なお、各項目の意味は下記のサイトを参照のこと)ntp起動直後(同期前) remote refid st t when poll reach delay offset jitter ============================================================================== ntp1.jst.mfeed. mf-isdn4.mfeed. 2 u 57 64 1 8.089 18.083 0.008 ntp2.jst.mfeed. mf-isdn4.mfeed. 2 u 56 64 1 8.221 18.083 0.008 ntp3.jst.mfeed. mf-isdn4.mfeed. 2 u 3 64 3 8.040 17.491 0.719 LOCAL(0) LOCAL(0) 10 l 61 64 1 0.000 0.000 0.008 起動30分後(同期後) remote refid st t when poll reach delay offset jitter ============================================================================== +ntp1.jst.mfeed. mf-isdn4.mfeed. 2 u 163 1024 377 8.959 -141.59 30.249 +ntp2.jst.mfeed. mf-isdn2.mfeed. 2 u 91 1024 377 8.201 -143.83 30.894 *ntp3.jst.mfeed. mf-isdn4.mfeed. 2 u 418 1024 377 10.586 -133.18 32.088 LOCAL(0) LOCAL(0) 10 l 60 64 377 0.000 0.000 0.008
こうなった場合はたいてい動いてないのでremote refid st t when poll reach delay offset jitter ============================================================================== ntp1.jst.mfeed. 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00 ntp2.jst.mfeed. 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00 ntp3.jst.mfeed. 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00 LOCAL(0) LOCAL(0) 10 l - 64 0 0.000 0.000 4000.00
grep ntp /var/log/messagesなどでntpがエラーを出してないか確認してみましょう。
Posted by Takuchan at 2003年10月25日 14:19
| トラックバック(1)