Saturday, January 4, 2020

Troubleshooting NTP on a Cisco Router

Here's a nice link for troubleshooting NTP on a Cisco router. The NTP in one of my Cisco router was a little off by 45 mins (from UTC).

Router#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 249.9981 Hz, precision is 2**22
ntp uptime is 2200 (1/100 of seconds), resolution is 4016
reference time is 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 0.32 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000007357 s/s
system poll interval is 8, never updated.
Router#show clock
*04:09:11.515 UTC Thu Jun 13 2019   // THE ASTERISK (*) MEANS THAT NTP IS NOT SYNCHRONIZED

Router#ping 63.12.7.2   // NTP SERVER IS REACHABLE
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 63.12.7.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 128/129/132 ms

Router(config)#ntp update-calendar   // TRIED TO FORCE NTP SYNC BUT STILL THE SAME

Router#show run | inc ntp
ntp update-calendar
ntp server 63.12.7.2

Router#show ntp association

  address         ref clock       st   when   poll reach  delay  offset   disp
 ~63.12.7.2    45.56.118.161    3      0   1024     0  0.000   0.000 15937.
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
Router#show ntp association detail
63.12.7.2 configured, ipv4, insane, invalid, stratum 3
ref ID 45.56.118.161  , time E0708AF0.DC3BA22C (20:26:24.860 UTC Sun Apr 28 2019)
our mode client, peer mode server, our poll intvl 1024, peer poll intvl 1024
root delay 38.33 msec, root disp 59277.26, reach 0, sync dist 75245.30
delay 0.00 msec, offset 0.0000 msec, dispersion 15937.50, jitter 0.00 msec
precision 2**22, version 4
assoc id 48064, assoc name 63.12.7.2
assoc in packets 142, assoc out packets 143, assoc error packets 142
org time 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
rec time E0ACBE34.D093C10E (12:21:08.814 UTC Thu Jun 13 2019)
xmt time E0ACBE34.D093C10E (12:21:08.814 UTC Thu Jun 13 2019)
filtdelay =     0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
filtoffset =    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
filterror =  16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0
minpoll = 6, maxpoll = 10

Router#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 249.9981 Hz, precision is 2**20
ntp uptime is 1653900 (1/100 of seconds), resolution is 4016
reference time is 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 248.09 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000007357 s/s
system poll interval is 8, never updated.

Router#show clock
*11:49:46.483 UTC Thu Jun 13 2019

Router#show clock
*14:32:00.790 UTC Thu Jun 13 2019   // NTP IS A "SLOW" PROTOCOL; NTP DIDN'T SYNC AFTER A FEW HOURS

Router#show ntp association

  address         ref clock       st   when   poll reach  delay  offset   disp
 ~63.12.7.2    45.56.118.161    3   1055   1024     0  0.000   0.000 15937.
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
Router#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 249.9981 Hz, precision is 2**20
ntp uptime is 2638200 (1/100 of seconds), resolution is 4016
reference time is 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 395.74 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000007357 s/s
system poll interval is 8, never updated.


You can force NTP by configuring a secondary NTP server (and remove it afterwards). You can check for a public NTP server on this link.

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ntp server 23.252.63.82
Router(config)#do ping 23.252.63.82
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.252.63.82, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 172/175/176 ms

Router#show ntp status
Clock is synchronized, stratum 2, reference is 23.252.63.82   // NTP CLOCK IS NOW SYNCHRONIZED
nominal freq is 250.0000 Hz, actual freq is 249.9981 Hz, precision is 2**20
ntp uptime is 2662900 (1/100 of seconds), resolution is 4016
reference time is E0ACE880.1B448452 (15:21:36.106 UTC Thu Jun 13 2019)
clock offset is 12.5992 msec, root delay is 175.69 msec
root dispersion is 3951.30 msec, peer dispersion is 187.58 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000007359 s/s
system poll interval is 64, last update was 17 sec ago.

Router#show ntp association

  address         ref clock       st   when   poll reach  delay  offset   disp
*~23.252.63.82    .SOCK.           1     21     64     1 175.69  12.599 187.58
 ~63.12.7.2    45.56.118.161    3     21    128     0  0.000   0.000 15937.
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

Router#show clock
15:22:11.539 UTC Thu Jun 13 2019    // NTP CLOCK SHOWED THE CORRECT DATE/TIME

Router(config)#no ntp server 23.252.63.82    // I REMOVED THE NEWLY ADDED NTP SERVER AND ntp update-calendar COMMAND
Router(config)#no ntp update-calendar
Router(config)#end
Router#show run | inc ntp
ntp server 63.12.7.2

Router#show clock
.15:23:37.297 UTC Thu Jun 13 2019   // CLOCK STILL SHOWED THE CORRECT DATE/TIME; THE DOT (.) MEANS NTP IS SYNCHRONIZED

No comments:

Post a Comment