// Lesson 36 of 49 · IP services
NTP
Why device clocks matter, NTP strata, client and server configuration, and verification.
1 min read#ntp#time
Accurate time is not cosmetic. Without it, log timestamps cannot be correlated across devices, certificates fail validation and some authentication protocols stop working.
How NTP works
NTP (UDP 123) synchronises clocks over the network. Time sources form a hierarchy of strata:
- Stratum 0 — reference clocks (GPS, atomic clocks); not on the network directly.
- Stratum 1 — servers attached to a stratum 0 source.
- Each further hop adds 1. Stratum 16 means "unsynchronised".
Configure an IOS device as a client
R1(config)# ntp server 192.168.1.20 prefer
R1(config)# ntp server 192.168.1.21
R1(config)# clock timezone GST 4 ! Gulf Standard Time, UTC+4
R1(config)# service timestamps log datetime msec localtime show-timezone
A router as a time source
R1(config)# ntp master 3 ! act as an authoritative source at stratum 3 (lab use)
In production, sync core devices to reliable upstream servers and let the rest of the network sync to them.
Authentication
Prevent rogue time sources:
R1(config)# ntp authenticate
R1(config)# ntp authentication-key 1 md5 <KEY>
R1(config)# ntp trusted-key 1
R1(config)# ntp server 192.168.1.20 key 1
Verify
R1# show ntp status
Clock is synchronized, stratum 3, reference is 192.168.1.20
R1# show ntp associations
R1# show clock detail
Synchronisation can take several minutes after configuration.
Key points
- NTP uses UDP 123; lower stratum = closer to the reference clock.
ntp serveron clients; set the time zone and timestamped logs.- Authenticate NTP in production.
- Correct time makes logs and certificates trustworthy.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.