トップ 一覧 検索 ヘルプ RSS ログイン

tips-ntpの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!! NTP
https://incarose86.hatenadiary.org/entry/20110505/1312522379

! FREE BSD
FB-ntpd 

! Linux
LN-ntpd

! GPS

https://akizukidenshi.com/catalog/g/gK-09991/

これでやろうかな。。1PPSがでているし。。

!!自宅に Stratum 1 のサーバーを作ろう。

C-dex シーデックス(株)さんの JST200 と言う物をつかって自宅にNTPのサーバを作る
(基本的に電波時計と同じ理論なので電波が受信できればよいらしい。)
( chrony ( tips-chrony )
でもできるのかな?? )


http://www.c-dex.co.jp/main/1.html

自宅には FedoraCore4 と FreeBSD が動いているのでとりあえず
FC4 で
 /etc/ntp.conf
 に
 server		127.127.40.0	prefer	mode 2	# C-dex JST2000
 fudge		127.127.40.0	time1 0.070
 を追加して
 /etc/rc.d/init.d/ntpd restart
 とで。。。。ここで急いでは行けない。。
 /dev 以下に少し修正。。
 cd /dev/
 ln -s ./ttyS0 ./jjy0

FreeBSDで
 ここからはたぶん!!
 /usr/local/etc/ntp.conf
 に
 server		127.127.40.0	prefer	mode 2	# C-dex JST2000
 fudge		127.127.40.0	time1 0.070
 を追加して
 cd /dev/
 ln -s ./cuad0 ./jjy0
 最後に
 /etc/rc.conf に
 ntpd=YES
 でよいのかな??
 
!ntp-4.2.2 には以下のパッチが必要
 ネタ元
 https://support.ntp.org/bugs/show_bug.cgi?id=732
 
 --- ../ntp-4.2.2p4/ntpd/refclock_jjy.c	2006-06-07  05:16:51.000000000 +0900
 +++ refclock_jjy.c	2006-11-04 14:52:10.000000000  +0900
 @@ -70,6 +70,10 @@
  /*  2004/11/28                                                         */
  /*    [Add]    Support the Echo Keisokuki LT-2000 receiver            */
  /*                                                                    */
 +/*  2006/11/04                                                        */
 +/*    [Fix]    C-DEX JST2000                                          */
 +/*             Thanks to Hideo Kuramatsu for the patch                */
 +/*                                                                    */
   /**********************************************************************/
 
 #ifdef HAVE_CONFIG_H
 @@ -281,6 +285,7 @@
 		up->unittype = UNITTYPE_CDEX_JST2000 ;
 		up->lineexpect = 1 ;
 		up->charexpect[0] = 15 ; /* <STX>JYYMMDD HHMMSSS<ETX> */
 +		break ;
 	case 3 :
 		up->unittype = UNITTYPE_ECHOKEISOKUKI_LT2000 ;
 		up->operationmode = 2 ;  /* Mode 2 : Continuous mode */

# 国内の NTP サーバ
!! 国内の NTP サーバ
  ntp.nict.jp
  ntp.jst.mfeed.ad.jp
 
  0.jp.pool.ntp.org
  1.jp.pool.ntp.org
  2.jp.pool.ntp.org
  3.jp.pool.ntp.org
 
 time.google.org
    time1.google.com
    time2.google.com
    time3.google.com
    time4.google.com
 
 ntp1.jst.mfeed.ad.jp (210.173.160.27)
 ntp2.jst.mfeed.ad.jp (210.173.160.57)
 ntp3.jst.mfeed.ad.jp (210.173.160.87)
    ntp1.v6.mfeed.ad.jp (2001:3a0:0:2001::27:123)
    ntp2.v6.mfeed.ad.jp (2001:3a0:0:2005::57:123)
    ntp3.v6.mfeed.ad.jp (2001:3a0:0:2006::87:123)
 
 time.cloudflare.com
 
 s2csntp.miz.nao.ac.jp



,団体,ntp server 
,独立行政法人 情報通信研究機構(NICT,	ntp.nict.jp,https://jjy.nict.go.jp/tsp/PubNtp/index.html,1時間に20回以上の場合には要確認
,インターネットマルチフィード(MFEED,ntp.jst.mfeed.ad.jp,https://www.mfeed.ad.jp/ntp/detail.html
,,ntp1.v6.mfeed.ad.jp, IPv6 
,国立天文台,	s2csntp.miz.nao.ac.jp, 利用には要確認
,Ring Server Project,	ntp.ring.gr.jp
,NTP POOL PROJECT,	jp.pool.ntp.org,https://www.ntppool.org/zone/jp

! Tips
https://qiita.com/halpas/items/5a451ead0b13f6792595

! server と peer の違い

peer
  ピアのアドレス、つまり同一 stratum の NTP サービスを実行しているサーバーのアドレスを追加するには、ntp.conf ファイルの peer コマンドを利用します。
 peer コマンドは以下の形式になります。
 
 peer address
 
 ここでの address は、IP ユニキャストアドレスまたは DNS の解決可能な名前になります。アドレスは、同一 stratum のメンバーに既知のシステムのものである必要があります。ピアは、相互に異なる時間ソースを少なくとも 1 つ持っている必要があります。ピアは通常、同一管理制御下にあるシステム群です。 


server

  サーバーのアドレス、つまり一段階上の stratum の NTP サービスを実行しているサーバーのアドレスを追加するには、ntp.conf ファイルの server コマンドを利用します。
 server コマンドは以下の形式になります。
 
 server address
 
 ここでの address は、IP ユニキャストアドレスまたは DNS の解決可能な名前になります。パケットの送信元となるリモートリファレンスサーバーまたはローカルリファレンスクロックのアドレスになります。 

! conf のサンプル
https://incarose86.hatenadiary.org/entry/20110505/1312522379
 # 
 # # SEt RC.CONF FILE #
 # ntpdate_enable="YES" 
 # ntpdate_program="/usr/sbin/ntpdate"
 # ntpdate_flags="-sbv XXX.XXX.XXX.XXX"
 # #
 # ntpd_enable="YES"         
 # ntpd_program="/usr/sbin/ntpd"
 # ntpd_flags="-p /var/run/ntpd.pid " 
 # 
 # 
 ## X : サーバーのIPアドレス
 ## Y : PEER の IPアドレス
 ## x : クライアントのIPアドレス
 # すべてのパケットを無視する
 restrict -4 default ignore
 restrict -6 default ignore
 #
 # 上位NTPサーバへのアクセスを許可する
 restrict XXX.XXX.XXX.XXX noquery nomodify nopeer notrap
 restrict XXX.XXX.XXX.XXX noquery nomodify nopeer notrap
 restrict XXX.XXX.XXX.XXX noquery nomodify nopeer notrap
 #
 # ピアNTPサーバへのアクセスを許可する
 restrict YYY.YYY.YYY.YYY noquery nomodify notrap
 #
 # 下位NTPサーバ・クライアントからのアクセスを許可する
 # ※ネットワークレベルの許可は mask を使って設定する
 # ※noquery は ntpq, ntpdc を拒否するだけなので問い合わせには影響ない
 restrict xxx.xxx.xxx.xxx mask xxx.xxx.xxx.xxx limited kod noquery nomodify nopeer notrap
 restrict xxx.xxx.xxx.xxx mask xxx.xxx.xxx.xxx limited kod noquery nomodify nopeer notrap
 restrict xxx.xxx.xxx.xxx mask xxx.xxx.xxx.xxx limited kod noquery nomodify nopeer notrap
 #
 ####################################################################
 # 上位サーバー
 # # ※3サーバ以上が望ましい。特に優先して使いたいサーバがあれば prefer オプションをつける
 # ※iburstは同期を迅速に実施するための指定(無応答のサーバに対して無駄にバーストする事は無いので使用を推奨)
 # ※burstは使用しないこと(Do not use burst unless you have a very good reason for doing so.)
 # ※minpoll と maxpoll は上位サーバの負荷を考慮して決める
 #   (内部のNTPサーバなら小さくしてもよいが、公開NTPサーバの場合は周期が最終的に1024秒以上になるようにしておく)
 # ※共通鍵を使用して認証する場合は "key 鍵番号" を追加する (keys および trustedkey 指定が必要)
 server xxx.xxx.xxx.xxx iburst minpoll 6 maxpoll 10 prefer
 server xxx.xxx.xxx.xxx iburst minpoll 6 maxpoll 10
 server xxx.xxx.xxx.xxx iburst minpoll 6 maxpoll 10
 #
 #####################################################################
 # ピアNTPサーバ
 # peer xxx.xxx.xxx.xxx minpoll 6 maxpoll 6 ## 64 のポーリングでは短過ぎ。。なので
 peer xxx.xxx.xxx.xxx minpoll 6 maxpoll 7