How to Configure NTP on Cisco IOS XE

How to Configure NTP on Cisco IOS XE
Profile Picture Small
Matt Albrecht, September 29th 2019

Network Time Protocol synchronizes the clocks of all computers, servers, phones, and routers. Let's learn how to configure it on a Cisco IOS XE router.

The NTP protocol specification

This post will focus on NTP configuration for a Cisco IOS XE router.

For detailed information on how the protocol works check out RFC 5905.

How to configure NTP

Configuring a Cisco router to synchronize its clock to an NTP server is very straightforward. Simply enter configuration mode and add one line of config.

conf t
!
ntp server pool.ntp.org

In our example, we are synchronizing our clock to a public NTP cluster resolved via the domain "pool.ntp.org". To learn more about this cluster, check out their website NTP Pool Project.

Ensure DNS is also configured

For our configuration to work, we'll need to ensure we also have a DNS server configured for domain name resolution.

ip name-server 8.8.8.8

Verify NTP is working

You should now be able to verify NTP is operating correctly with the operational commands below.

! Verify your clock is synchronized
show ntp status

! Verify the NTP version running
show ntp information

! Verify NTP traffic exists both inbound and outbound
show ntp packets

! Verify the NTP reference clock
show ntp associations

Here is a sample output for these operational commands.

Router# show ntp status
Clock is synchronized, stratum 3, reference is 103.126.53.123
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
ntp uptime is 6400 (1/100 of seconds), resolution is 4000
reference time is E13A7EC4.80C49D08 (00:52:20.503 UTC Sun Sep 29 2019)
clock offset is -18.7891 msec, root delay is 68.26 msec
root dispersion is 242.99 msec, peer dispersion is 188.50 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000000012 s/s
system poll interval is 64, last update was 51 sec ago.

Router# show ntp information
Ntp Software Name       :  Cisco-ntpv4
Ntp Software Version    :  Cisco-ntpv4-1.0
Ntp Software Vendor     :  CISCO
Ntp System Type         :  Cisco IOS / 1RU

Router# show ntp packets
Ntp In packets                  :  10
Ntp Out packets                 :  10
Ntp bad version packets         :  0
Ntp protocol error packets      :  0

Router# show ntp associations
  address         ref clock       st   when   poll reach  delay  offset   disp
*~103.126.53.123  210.9.192.50     2     15     64     7 36.940 -18.789  2.871
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

If you have any issues ensure your router has connectivity to the NTP server on UDP port 123.

How to configure a time-zone

Once working, check the time on your router using the command show clock. You'll probably notice that the output doesn't match your time-zone. We'll need to configure that next. In our case, we are in the time-zone "AEST" which has a 10 hour offset from UTC.

Enter configuration mode once again and add the line below after adjusting the parameters to your locality.

clock timezone AEST 10

You should now observe the output clock time in the correct format.

Router# show clock
10:57:49.916 AEST Sun Sep 29 2019

Hopefully, these instructions helped your understanding of how basic NTP is configured on a Cisco router. If you have any questions, feel free to leave a comment beneath the post and we'll do our best to help.

Ultra Config Generator

You can download a template of the configuration discussed above and import it into your Ultra Config Generator instance. A screenshot of the NTP template in action is shown for illustration.

Download: ntp-2019-09-29.json

UCG NTP Template for Cisco IOS-XE devices

Figure 1: UCG NTP Template for Cisco IOS-XE devices

If you haven't heard of Ultra Config Generator, I would highly recommend you check it out. We designed the product to allow network engineers to generate and automate network configuration in a highly flexible, efficient and elegant manner. Our customers love the application and I hope that you will too.

Take care until next time!

Ultra Config


JOIN THE DISCUSSION

Subscribe to the Blog

Subscribe now and never miss a new post!