2007-11-19

w32tm で ntp クライアントになる

Windows から ntp サーバと時刻同期する w32tm に関するメモ。
…超既出とか言わない。

yu-ji@aspirin:$ w32tm /config /update \
> /manualpeerlist:"ntp1.example.net,0x8 ntp2.example.net,0x8" \
> /syncfromflags:MANUAL
yu-ji@aspirin:$ w32tm /resync

/update を付けとくと w32time サービスの再起動がいらない。
各 ntp サーバの指定に 0×8 を付けとくとそのサーバに対してはただの ntp クライアントとして動作する。ntp.org の ntp で言うところの server 指定。peer 構成にしたり、定時同期にしたい場合はなんか変わるようだ。
/resync しなくて良さそうな気がする。

イベントログはあんまりアテにならないらしい。記録されない場合 / 情報もあるとかないとか。

w32tm /monitor とかすると、どんな感じか表示される。

yu-ji@aspirin:$ w32tm /monitor \
> /computers:"ntp1.example.net,ntp2.example.net"
ntp1.example.net [192.168.100.2]:
  ICMP: 0ms delay.
  NTP: -0.2013728s offset from local clock
  RefID: st2ntp1.example.net [192.168.0.2]
ntp2.example.net [192.168.100.3]:
  ICMP: 8ms delay.
  NTP: -0.2005907s offset from local clock
  RefID: st2ntp2.example.net [192.168.1.2]

参考