ntp

こちらは昔のメモ
ntp memo ..http://d.hatena.ne.jp/toshi_hirasawa/20110508/1304809367

hwclock ..http://d.hatena.ne.jp/toshi_hirasawa/20090702/1246502623

ここから本文ーーーーーー

このPC うぶんちゅの設定はこうなってる。
このPCはふつーのクライアントPCなので、ほとんどいじってないので、
ほぼでふぉですな

[hirasawa@aspire-white ~]$ cat /etc/ntp.conf | grep -v "^#" | grep -v "^$"
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.orgj
server 3.ubuntu.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
[hirasawa@aspire-white ~]$ 
[hirasawa@aspire-white ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-lasvegas-nv-dat 64.113.32.9      3 u  242  256  377  132.137  -48.182  34.621
+four10.gac.edu  18.26.4.105      2 u  142  256  377  196.490  -22.720  36.910
 bindcat.fhsu.ed .INIT.          16 u    - 1024    0    0.000    0.000   0.000
*vcxen01.bw.phl. 128.118.25.5     2 u    2  256  377  177.467  -18.450  19.742
+europium.canoni 193.79.237.14    2 u  208  256  377  286.348    7.225  33.846
[hirasawa@aspire-white ~]$ 

以下、栗日記からのぱくり。
いっつも大変お世話になってます。 

よんでて、へーっておもったのは
server ntp.nict.jp
server ntp.nict.jp
server ntp.nict.jp

な部分。

こんなやり方もありなんてしらんかったです

楽じゃん
これからはこのやりかたでいきましょw

 ……………………………………………………………………………………
 $ sudo apt-get install ntp ntpdate openntpd   (Debian系の場合)
 # yum instal ntp                              (RedHat系の場合)
 ……………………………………………………………………………………


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
□ ntpd が時刻同期を担います

Linuxでは、ntpd というデーモンが、上位のNTPサーバから情報を得て、
下位のNTPサーバからの要求に答えます。

ntpd の設定ファイルは、「/etc/ntp.conf」です。
いろいろな設定を記述できますが、まずは、上位のNTPサーバを設定する
だけにとどめて、時刻同期が行われることを確かめてみましょう。

参照するNTPサーバですが、NICT(独立行政法人 情報通信研究機構)が公開
しているものにしたいと思います。

日本標準時プロジェクト 公開NTP
http://www2.nict.go.jp/w/w114/tsp/PubNtp/index.html

ホスト名「ntp.nict.jp」を指定すると、以下のように複数のアドレスが
登録されているため、うまい具合に分散される…という寸法です。

 ……………………………………………………………………………………
 $ host ntp.nict.jp
 ntp.nict.jp has address 133.243.238.243
 ntp.nict.jp has address 133.243.238.244
 ntp.nict.jp has address 133.243.238.163
 ntp.nict.jp has address 133.243.238.164
 ntp.nict.jp has IPv6 address 2001:df0:232:eea0::fff4
 ntp.nict.jp has IPv6 address 2001:df0:232:eea0::fff3
 ……………………………………………………………………………………

ですので、/etc/ntp.conf には、以下のように「server」というコマンド
と上位のNTPサーバ名を指定します。

……………………………………………………………………………………
server ntp.nict.jp
server ntp.nict.jp
server ntp.nict.jp
……………………………………………………………………………………

書き終わったら、ntpd を起動します。
以下のように、ntp サービスもしくは ntpd サービスを起動します。
(すでに動いている場合は、start ではなく restart で再起動します。)

 ……………………………………………………………………………………
 $ sudo service ntp start    (Debian系の場合)
 # service ntpd start        (RedHat系の場合)
 ……………………………………………………………………………………


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
□ ntpq で確認します

時刻同期されているかどうかは、ntpq コマンドで確認します。
「-p」オプションをつけて実行すると、NTPサーバの一覧を表示します。

 ……………………………………………………………………………………
 $ ntpq -p
      remote       refid   st t when poll reach   delay   offset  jitter
 =======================================================================
 *ntp-b3.nict.go. .NICT.    1 u   57   64   37   11.037    2.340   2.178
 +ntp-b2.nict.go. .NICT.    1 u   58   64   37   11.219    4.045   2.797
  ntp-a3.nict.go. .NICT.    1 u   57   64   37    9.429    2.357   2.334
 ……………………………………………………………………………………

それぞれの項目の意味は、以下の通りです。

 ……………………………………………………………………………………
 項目名    概要
 ……………………………………………………………………………………
 remote    上位のNTPサーバ。先頭の文字の意味は以下の通り。
           *,o  参照・同期中のNTPサーバ。
           +  いつでも参照可能なNTPサーバ。
           #  参照可能だが遠いNTPサーバ。
           -,x,.  参照しないことになったNTPサーバ。
 refid     参照ID。
 st        stratum.
 t         型。(l=local, u=unicast, m=multicast, b=broadcast)
 when      最後のパケットを受信してからの経過秒。
 poll      ポーリング間隔。(秒)
 reach     最近の8回の接続結果を8進数で表したもの。(377=すべて)
 delay     通信による往復の時間の推測値。(ミリ秒)
 offset    NTPサーバとの時刻のずれ。(ミリ秒)
 jitter    同期のタイミングのばらつき。(ミリ秒)
 ……………………………………………………………………………………