Checking NTP Status
Problem
You want to check that NTP is working properly on your network, and you want to check which NTP peers your router is getting time information from.
Solution
Use the show ntp associations command to verify that NTP is operating correctly:
aviva@router1> show ntp associations remote refid st t when poll reach delay offset jitter ============================================================================== *ntpserver.mynet . GPS. 1 u 108 256 377 6.915 3.977 0.078
Discussion
You can verify that NTP operation and status from any router on the network. The show ntp associations command output is the same as that of the FreeBSD ntpqp utility. The first column in the output, remote, shows the servers and peers that you have configured on the router, either by name or IP address. The asterisk (*) before the server name indicates that this is the NTP server that is being used for time synchronization. If you had multiple NTP servers configured, a plus sign (+) would indicate alternate NTP servers that the router could use for time synchronization.
The second, third, and fourth columnsthe reference ID, stratum, and typeshow that the current source of the time synchronization is a GPS and that the remote server is a stratum 1 time source sending in unicast. (The remote server is a directly tied to a GPS receiver, which is an authoritative source of time. The GPS is effectively a stratum 0 device.) The next fields tell you when the router last received an NTP message (in seconds), how often the local router polls the NTP server (in seconds), the status of the NTP reachability register (in octal). The last three fields show specific information pertaining to the accuracy of clocks (the latest time delay, offset, and jitter), which NTP peers use to correct their clocks as they attempt to synchronize time.
You can also check the NTP operation and the clock on the local router:
aviva@router1> show ntp status status=0664 leap_none, sync_ntp, 6 events, event_peer/strat_chg, processor="i386", system="JUNOS7.2-20050317.0", leap=00, stratum=2, precision=-28, rootdelay=7.058, rootdispersion=11.410, peer=27124, refid=ntpserver.mynetwork.com, reftime=c5e45c16.17eb399f Thu, Mar 17 2005 19:42:14.093, poll=7, clock=c5e45c74.a72fba01 Thu, Mar 17 2005 19:43:48.653, state=4, phase=1.340, frequency=75.783, jitter=0.411, stability=0.004
A detailed explanation of all these fields is beyond the scope of this discussion. Most of the variables are defined in RFC 1305. However, there are a few fields are of general interest. The value sync_ntp in the first line tells you that this router has synchronized its time with an NTP server. If the output shows sync_alarm or sync_unspec, it means that the router is not synched. This could mean that it was more than 128 seconds off and never synched, but assuming that it was synched at least once since it was manufactured, it more likely means that none of its NTP servers are themselves synched or they are unreachable. Having multiple stratum 1 servers minimizes the chances of this latter case happening. If the router's time has drifted more than 128 seconds from the time on the NTP server, manually reset the time on the router with the set date ntp command.
Another field of interest is stratum. This output shows that the NTP server is a stratum 2 time source, so it is one hop from a stratum 1 server. The refid field lists the stratum 1 server. If the value in this field shows 0.0.0.0, it provides another indication that the router's clock is not synchronized with the NTP server.