Network Time Protocol (NTP) setup and configuration
Introduction
Based on the previous NTP and Linux post, this will cover setting up any Cisco device to be a time server of your network.
Setup
Setting up the timezone of your area:
router1(config)#clock timezone AST 3 0
I am living in a UTC +3:00 zone thus my config reflects it, if you are living in UTC 0:00 use:
router1(config)#no clock timezone
more timezone setup is available at this Cisco page.
router1(config)#clock calendar-valid
configures the device as an authoritative time source for a network based on its hardware clock.
router1(config)#ntp master
configures the Cisco IOS software as a master clock (at default stratum 7) to which peers synchronize themselves when an external source is not available. Here, when the device cannot sync to an external NTP (no Internet connection as an example), it will rely on its internal clock (again at the default stratum number 7) to satisfy any request.
router1(config)#ntp update-calendar
periodically updates the hardware clock (calendar) from the configured time source(s).
Now, setup time source(s):
router1(config)#ntp server ip-address or hostname
if you use hostname in this command, IOS will resolve it to an IP address and then save it. Use as many as you need (I am using 3 sources).
A Working NTP
Leave the device working for around 10 minutes and then issue:
router1#sh ntp a
an output such as:
address ref clock st when poll reach delay offset disp
~127.127.1.1 .LOCL. 7 12 16 377 0.000 0.000 0.250
*~xxx.xxx.xxx.xxx .MSF. 1 434 1024 377 165.60 -6.331 14.827
+~yyy.yyy.yyy.yyy .PTB. 1 695 1024 377 170.05 7.694 14.834
+~zzz.zzz.zzz.zzz aaa.aaa.aaa.aaa 2 184 1024 377 173.38 -0.953 14.815
* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
and:
router1#sh ntp s Clock is synchronized, stratum 2, reference is xxx.xxx.xxx.xxx nominal freq is 250.0000 Hz, actual freq is 249.9943 Hz, precision is 2**24 reference time is D6DC17CD.061F0269 (17:57:17.023 AST Tue Mar 25 2014) clock offset is -6.3312 msec, root delay is 165.60 msec root dispersion is 42.01 msec, peer dispersion is 14.82 msec loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000022822 s/s system poll interval is 1024, last update was 692 sec ago.
Finally
Setup all your internal devices to use this Cisco node as their master NTP clock.
