NTP設定

Last-modified: 2010-07-13 (火) 00:25:09

http://www.asahi-net.or.jp/~aa4t-nngk/ntpd.htmlを参考に、のちほど再点検しよう。

システム構成

[外部NTPサーバ] プロバイダ提供や一般のタイムサーバ
  ↓
 Internet
  ↓
[NTPサーバ1] 外部通信できるDNZ層のNTPサーバ、制御ファイル:ntp.conf#1
  ↓
 内部Network
  ↓
[NTPサーバ2] 内部のローカル環境のNTPサーバ、ntp.conf#2
  ↓
[クライアント] 外部にアクセスできないクライアント群

ntp.confの設定

http://www.obenri.com/_ntp_sshserver/ntpconf5.htmlを参考にしています

  • restrictは、NTPによる通信の拒否・許可を設定するもの
  • デフォルトでは、以下のようになっている。基本的には、一旦全てのアクセスを拒否し、必要なアクセスのみ公開する。
    • restrict default kod nomodify notrap nopeer noquery 全ての通信を拒否
    • restrict 127.0.0.1  ここでは、許可するアドレスのみを指定
  • restrictのオプション
    • ignore 指定したサーバからの全てのNTPアクセスを無視
    • noquery 指定したサーバからの時刻問合せパケットを無視
    • nomodify 指定したサーバからの設定変更要求パケットを無視
    • notrap 指定したサーバに対して状態変更時にトラップをあげない
    • notrust 時刻の問合せに応答はするが、自身の時刻合わせには使用しない
    • nopper 指定したホストと相互に同期しない
    • kod(Kiss of death) 問合せ頻度が閾値を超えた場合、クライアントに対して中止を連絡
    • default 「この後に指定したものが、デフォルトのルールですよ」という意味、宣言
       restrict default ignore で、デフォルトではNTP通信を全て無視する
  • 「restrict default kod nomodify notrap nopeer noquery」と、「restrict default ignore」は
     同じ?違う?よくわかってません・・

ntp.conf#1

ntp.confの設定内容

restrict default kod nomodify notrap nopeer noquery
#外部NTPサーバへの通信を許可
restrict xxx.xxx.xxx.xxx noquery nomodify notrap
restrict 127.0.0.1
#LAN内のホストからの問合せへの応答を許可
restrict 192.168.10.0 mask 255.255.255.0 noquery nomodify notrap
※ここでは、noqueryを指定する例もあるんだけど、よくわかってません・・
  ただ、noqueryをつけても、時刻問合せには影響しないようです。
Server xxx.xxx.xxx.xxx #プロバイダのタイムサーバのアドレス
fudge 192.168.1.2 stratum 10 #自分自身をNTPサーバとして公開する
driffile /var/lib/ntp/drift #デフォルト
keys /etc/ntp/keys #デフォルト

ntp.conf#2

ntp.confの設定内容

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 #自身からのNTP通信を許可
restrict 192.168.2.0 mask 255.255.255.0 noquery nomodify nopeer notrap
#ローカルネットワークからのNTP通信を許可
Server 192.168.1.2 #NTPサーバー(ここでは[NTPサーバ1]のこと)のアドレス
fudge timeserv02 stratum 10 #自身をNTPサーバーとして公開する
driffile /var/lib/ntp/drift #デフォルト
keys /etc/ntp/keys #デフォルト