LoginSignup
0
0

More than 1 year has passed since last update.

ネットワーク構築 #8 (時刻設定)

Last updated at Posted at 2022-09-11

今回の内容

NTPサーバーと同期して、ルーターの時刻を設定する。
実施日:2022/09/10~2022/09/11

設定

###日本時間に合わせます。
R1(config)#clock timezone JST 9
R1(config)#exit
###NTPサーバーと同期の設定(preferが付いているものは同期が優先される)
R1(config)#ntp server 133.243.238.163 prefer
R1(config)#ntp server 133.243.238.164

R1#show calendar
15:19:47 JST Sat Sep 10 2022
###正しい時刻から約50分程時間が進んでいてズレています。

###NTPサーバーとの同期の状態を確認します。
R1#show ntp status
Clock is synchronized, stratum 2, reference is 133.243.238.16
nominal freq is 250.0000 Hz, actual freq is 249.8989 Hz, precision is 2**15
reference time is E6C6A852.B6539580 (15:08:18.712 JST Sat Sep 10 2022)
clock offset is -150.3905 msec, root delay is 3.53 msec
root dispersion is 169.70 msec, peer dispersion is 1.81 msec
loopfilter state is 'SPIK' (Spike), drift is 0.000404150 s/s
system poll interval is 64, last update was 245 sec ago.

R1#show ntp association
  address         ref clock       st   when   poll reach  delay  offset   disp
*~133.243.238.163 .NICT.           1     30     64    17  4.115 -14.866  2.650
+~133.243.238.164 .NICT.           1     12     64    17  3.401 -20.824  2.395
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
### *がついているので、133.243.238.163と同期されていることが判ります。

###時刻確認のコマンドを間違えていた。
R1#show clock
15:39:37.264 JST Sat Sep 10 2022
###正しい時間が表示されました。
###R1#show calendarはハードウェアクロックであるため、NTPサーバーと同期をしても、表示される時間がルーター上に設定されている時刻を
###を表示しているため、NTPサーバーと時刻が一致しませんでした。

R1(config)#ntp update-calendar
###上記のコマンドを実行すると、NTPサーバーとハードウェアクロックが同期されるため、
###R1#show calendarを実行しても正しい時刻が表示されました。

他のルーターの設定

他のルーターもNTPサーバーと時刻同期をして、ルーター内の時刻を正しい時間に設定をしたい。
ただ、R1で設定したコマンドをルーター毎に実行するのも面倒であるため、手間の掛からない方法はないか。
①ntp broadcast
②ntp multicast
これらのコマンドを使用すれば、ピアに時刻同期が出来るようです。

①ntp broadcast⇒同一セグメント内での同期のみ(DHCPサーバーのようにip helper-addressのようなものは無し)、ルーター上で実行できない。
②ntp multicast⇒ルーター上で実行が出来ない、L3スイッチでのみ可能?

同じ設定をルーターの数だけ実行するのはやはり面倒ですが、ntp ?でコマンドを確認するとコマンド2つとも表示されなかったためユニキャストで台数分設定しました。

追記 2022/10/02

debug ip packet実行時に表示される時刻が日本時間になっていなかったため、日本時間表示の設定は以下が必要。

(config)# service timestamps log datetime msec localtime show-timezone
(config)# service timestamps debug datetime msec localtime show-timezone
(config)# clock timezone JST 9

今回はここまで。

0
0
0

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
0
0