Clock and Network Time Protocol (NTP)
2 types of clocks:
- Hardware clock -> Physical battery-backed chip on the motherboard, officially called the Real-Time Clock (RTC)
Commands:
R1# show calendarR1# calendar set hh:mm:ss day month yearR1# clock update-calendar- Software clock -> Active clock running in the router’s RAM while the device is turned on.
R1# show clockR1# clock set hh:mm:ss day month yearR1# clock read-calendarNTP uses UDP port 123
1. The Stratum Hierarchy
Section titled “1. The Stratum Hierarchy”- Stratum 0: The authoritative time sources. Devices do not operate at Stratum =
- Stratum 1: A router or server directly connected to a Stratum 0 device.
- Stratum 2 - 15: Devices that receive their time from the stratum above them over the network
- Stratum 16: The time source is unreachable or unsynchronized
2. NTP Modes of Operation
Section titled “2. NTP Modes of Operation”- Client Mode: The device polls a server for the time but does not provide time ot anyone else.
- Server Mode: The device provides time to clients.
- Peer Mode: Two routers back each other up. If one loses its connection to the main NTP server, it can temporarily sync its clock with its peer.
- Broadcast Mode: Used on LANs where a server broadcasts the time to all devices on the subnet so they do not have to poll it individually.
3. Configuration commands in CISCO IOS
Section titled “3. Configuration commands in CISCO IOS”R1 (config)# clock timezone PST -8R1 (config)# ntp server [ip-addr] -- Tells the router to act as an NTP client and sync its time with the specified IP addrR1 (config)# ntp master [stratum-level] -- This makes the router act as an authoritative NTP server for the network, even if does not have an external source to sync with.4. Verification commands in CISCO IOS
Section titled “4. Verification commands in CISCO IOS”show ntp statusshow ntp associations- Client Server Mode
ntp server [IP ADDRESS]- Symmetric Active Mode
ntp peer [IP_ADDRESS]- Broadcast mode
ntp broadcastntp broadcast clientA Cisco router can operate in several different NTP roles depending on the network topology and design requirements.
1. NTP Client
Section titled “1. NTP Client”- Function: The router synchronizes its own internal clock by reaching out to an external time source, such as a public internet server or a corporate core router.
- Command:
ntp server <ip-address>
2. NTP Server & NTP Master
Section titled “2. NTP Server & NTP Master”- NTP Server: By default, once a Cisco router successfully synchronizes its time as a client, it automatically begins functioning as an NTP server to provide time to other local network devices.
- NTP Master: If the router is isolated or lacks an external time connection, it can be configured to act as the authoritative time source for the network using its own internal hardware clock.
- Command:
ntp master <stratum-level>(e.g.,ntp master 4)
3. NTP Peer (Symmetric Active)
Section titled “3. NTP Peer (Symmetric Active)”- Function: Two routers are configured to mutually synchronize with each other. This provides high availability; if Router A loses its connection to the primary time server, it can seamlessly pull the time from Router B.
- Command:
ntp peer <ip-address>
4. NTP Broadcast (Optional/Less Common)
Section titled “4. NTP Broadcast (Optional/Less Common)”- Function: Instead of having clients actively poll the server for the time (unicast), the router periodically broadcasts time updates out of a specific interface to the entire subnet.
- Commands:
ntp broadcast(configured on the server’s interface) andntp broadcast client(configured on the receiving devices).