Previous section   Next section

Recipe 14.7 Setting the Router as the NTP Master for the Network

14.7.1 Problem

You want to use the router as an NTP server to act as the primary time source for the network.

14.7.2 Solution

There is no need for a dedicated NTP server; you can pick one or two routers to act as authoritative NTP servers for the whole network. (The router should have a calendar function.)

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)#clock calendar-valid
Router(config)#ntp master 8
Router(config)#end
Router# 

14.7.3 Discussion

When no authoritative time sources are available, and you still need to synchronize clocks throughout a network, you can configure a router to act as an NTP master server. Although this situation should be considered as a last resort, the router can become a "self-professed" NTP master, even if it is not actually synchronized from an accurate clock.

NTP provides two important services: accurate time setting and clock synchronization. Enabling a router to become an NTP master will not guarantee accurate time, but it will ensure that all network components' time remain synchronized. This distinction is important because routers acting as NTP masters can synchronize their entire network to an incorrect time. However, if the reliable time sources that your network uses become unreachable for any length of time, it is often useful to at least keep the clocks synchronized, even if they aren't completely accurate.

For this reason, we recommend that if your routers provide master NTP services, they should never advertise themselves as Stratum 1 servers. Timekeeping instability can occur on networks with both legitimate NTP time sources and router NTP masters. This is because NTP clients cannot distinguish between legitimate time sources and a router acting as a NTP master. Please use caution when configuring this feature.

Setting a router to act as a NTP master can interrupt legitimate time sources.

In the example, we have set the NTP master to the relatively safe Stratum level 8. In most cases, this will prevent the router from being preferred over valid time sources since NTP clients tend to synchronize to the lowest available Stratum server, assuming their clock is sane.

For obvious reasons, only routers with battery-protected timers or calendars are good candidates to become NTP masters. Otherwise, a power failure or reload of a single router could cause the entire network to become unsynchronized. For increased resilience, the design should include a minimum of two NTP master routers with peering configured between them.

14.7.4 See Also

Recipe 14.3; Recipe 14.4; Recipe 14.5


  Previous section   Next section
Top