VOOZH about

URL: https://qiita.com/nikofu501/items/1ef06ef7eb0758db65d4

⇱ NTP設定メモ #ntp - Qiita


👁 Image
10

Go to list of users who liked

14

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@nikofu501

NTP設定メモ

10
Posted at

RHEL6
ntpdate : ntpdate-4.2.6p5-12.el6.centos.2.x86_64
ntp : ntp-4.2.6p5-12.el6.centos.2.x86_64

で設定したNTPのメモ

デフォルト値の確認

#/etc/init.d/ntpd start
ntpd を起動中: [ OK ]
#ntpq -p
 remote refid st t when poll reach delay offset jitter
==============================================================================
 x.ns.gin.ntt.ne .INIT. 16 u - 64 0 0.000 0.000 0.000
 y.ns.gin.ntt.ne 249.224.99.213 2 u 1 64 1 5.086 4.880 0.000
 nipper.paina.ne 131.113.192.40 2 u - 64 1 0.437 6.861 0.000
 nipper.paina.ne .INIT. 16 u - 64 0 0.000 0.000 0.000

設定するNTPサーバ

以下の3つのNTPサーバーを設定。

  1. NICT
    http://jjy.nict.go.jp/tsp/PubNtp/index.html
    ntp.nict.jp

  2. インターネットマルチフィード
    http://www.jst.mfeed.ad.jp/about/04.html
    ntp1.jst.mfeed.ad.jp

  3. Google Public NTP
    https://developers.google.com/time/
    time.google.com

/etc/ntp.conf 確認、バックアップ、設定変更

/etc/ntp.confのデフォルトのNTPサーバをコメントアウトする。
上の3サーバを/etc/ntp.confに記載する
参考:iburstの意味
http://d.hatena.ne.jp/incarose86/20110505/1312522379

#ls -l /etc/ntp.conf
-rw-r--r-- 1 root root 1778 12月 18 22:51 2017 /etc/ntp.conf
#cp /etc/ntp.conf /etc/ntp.conf.`date "+%Y%m%d"`
#ls -l /etc/ntp.conf /etc/ntp.conf.20180314 
-rw-r--r-- 1 root root 1878 3月 15 00:02 2018 /etc/ntp.conf
-rw-r--r-- 1 root root 1778 3月 14 23:48 2018 /etc/ntp.conf.20180314
#vi /etc/ntp.conf
#diff /etc/ntp.conf /etc/ntp.conf.20180314 
22,29c22,25
< server ntp.nict.jp iburst
< server ntp1.jst.mfeed.ad.jp iburst
< server time.google.com iburst
< 
< #server 0.centos.pool.ntp.org iburst
< #server 1.centos.pool.ntp.org iburst
< #server 2.centos.pool.ntp.org iburst
< #server 3.centos.pool.ntp.org iburst
---
>server 0.centos.pool.ntp.org iburst
>server 1.centos.pool.ntp.org iburst
>server 2.centos.pool.ntp.org iburst
>server 3.centos.pool.ntp.org iburst

設定の反映

時刻がずれているとntpdが上手く動作しないため(なぜ?)、手動で時刻を合わせてからntpdを再起動する。
参考:手動の時刻合わせの必要性
http://www.turbolinux.co.jp/products/server/11s/user_guide/x6278.html

#/etc/init.d/ntpd stop
ntpd を停止中: [ OK ]
#ntpdate ntp.nict.jp
15 Mar 00:12:01 ntpdate[14309]: adjust time server 2001:df0:232:eea0::fff3 offset 0.009183 sec
#/etc/init.d/ntpd start
ntpd を起動中: [ OK ]
#ntpq -p
 remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp-a2.nict.go. .NICT. 1 u 8 64 1 1.421 -7.424 0.183
+ntp1.jst.mfeed. 133.243.236.17 2 u 7 64 1 0.748 -7.689 0.143
+time4.google.co .GOOG. 1 u 6 64 1 53.146 -14.625 2.835
10

Go to list of users who liked

14
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10

Go to list of users who liked

14