(30b530fc30fc30de30b730f3306e6642523b5408308f305b)
Personal tools
You are here: Home Linux Vine Linux サーバーマシンの時刻合わせ
Navigation

今の天気
  7℃ 45% 1025hPa NW 4m
福岡地方の今の天気
« November 2008 »
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
最近のログイン

seko
2008/11/19 23:27

Reiko
2008/11/18 13:15

Guest
2008/11/12 15:50

Papasan
2008/10/22 19:40

hage88
2008/10/19 17:39

Peter
2008/10/06 21:22

猫さん。
2008/10/06 04:19

 
Document Actions

サーバーマシンの時刻合わせ

by Papasan last modified 2007-12-26 16:06

NTPサーバーを利用してサーバーマシンの時刻合わせを行います。

  1. ntpのインストール:
     # apt-get update
     # apt-get install ntp
    
  2. NTPサーバーの選択
    • BBIQでは、有料もしくは利用できないようなので「インターネットマルチフィード(MFEED) 時刻情報提供サービス for Public」 を利用させていただく。
    • 今回利用するNTPサーバー:
        ntp1.jst.mfeed.ad.jp
        ntp2.jst.mfeed.ad.jp
        ntp3.jst.mfeed.ad.jp
      
    • 利用するNTPサーバーの選択について
      1. 利用しているプロバイダのNTPサーバーが使えるなら優先的に利用する。
      2. 地理的に近いNTPサーバーを利用する。
      3. 個人が複数台のPCを保有して時刻合わせを行う場合、メインのPCが外部のNTPサーバーによる時刻合わせを行い、他のPCはメインPCに時刻を合わせるようにする。
  3. 設定ファイルの編集

    設定ファイル /etc/ntp.conf を以下のように編集する、他の部分はコメントアウト。:

      server ntp1.jst.mfeed.ad.jp
      server ntp2.jst.mfeed.ad.jp
      server ntp3.jst.mfeed.ad.jp
      driftfile /etc/ntp.drift
      logfile /var/log/ntp.log
    

  4. ntpdの起動:
     # date
     # /etc/rc.d/init.d/ntpd start ← 既に起動しているときは restart
     # ntpq -p
    
          remote           refid      st t when poll reach   delay   offset  jitter
     ==============================================================================
      ntp1.jst.mfeed. 210.173.160,56   2 u   15   64    1   20.119   -2.429   0.001
      ntp2.jst.mfeed. 210.173.160.56   2 u   14   64    1   19.911   -2.507   0.001
      ntp3.jst.mfeed. 210.173.160.56   2 u   13   64    1   20.256   -2.013   0.001
    
  5. ntpdの動作確認(10分から30分後に)

    先頭に * (同期中)や + (使用可能)が付いていれば時刻合わせはOKです。 ntpq表示内容の詳細は こちら をご覧ください。:

      #ntpq -p
    
           remote           refid      st t when poll reach   delay   offset  jitter
      ==============================================================================
      *ntp1.jst.mfeed. 210.173.160,56   2 u   32   64  377   19.835    4.585   0.781
      +ntp2.jst.mfeed. 210.173.160.56   2 u   27   64  377   19.812    4.053   0.354
      +ntp3.jst.mfeed. 210.173.160.56   2 u   36   64  377   19.950    4.066   0.433
    

  6. マシン起動時にntpdを自動起動:
     # chkconfig ntpd on
    
  • 備考

    メインマシンとLAN内のマシンの時刻を合わせるには、LAN内のマシンの /etc/ntp.conf を同様に編集、但し server のところを server 192.168.0.11 のようにメインマシンのIPアドレスを指定する。