Synchronizing the Time on All Routers (NTP)

Problem

You want your routers to automatically learn the time and synchronize their clocks through the network.

Solution

Network Time Protocol (NTP) is an open standard protocol for time synchronization. You can implement NTP on a router to provide automatic and efficient time synchronization. To enable a basic NTP configuration, enter the following commands:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#clock timezone EST -5
Router(config)#clock summer-time EDT recurring
Router(config)#ntp server 172.25.1.1 
Router(config)#end
Router#

The ntp server command accepts either IP addresses or hostnames. To use a hostname, however, you will need to configure the router to either use a static host table or DNS for name resolution, as discussed in Chapter 2.

Some low-end routers such as Cisco 1000 series, Cisco 1600 series, Cisco 1720, and Cisco 1750 series do not support NTP. For these, Cisco provides support for the Simple Network Time Protocol ( SNTP), which is a compatible subset of the NTP standard. The SNTP configuration is similar to NTP:

Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#clock timezone EST -5
Router(config)#clock summer-time EDT recurring
Router(config)#sntp server 172.25.1.1
Router(config)#end
Router#

Discussion

When NTP is enabled on a router, it will start trying to synchronize with the configured peers or servers as soon ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.