L7 · management · reviewed
NTP
Network Time Protocol
Stratum, association modes, and the fact that time sync is soft state — bad time breaks certificates and logs.
Presenter modeEmbed this figure
Why it exists
Certificates, logs, and replay windows all assume clocks agree. Wrong time looks like a crypto or AAA failure.
Point clients at authenticated NTP servers with a local calendar fallback.
Client associates and disciplines
A client reaches a stratum-2 server, selects it, and slews toward the server offset.
The client sends mode-3 client packets and receives mode-4 server replies from its configured association. R1. R2.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| R1 | router | — |
| R2 | router | — |
| R1 — R2 | link | up |
The client sends mode-3 client packets and receives mode-4 server replies from its configured association.
What changed
- Client mode 3
- Server mode 4
How it works
Clients associate with servers; stratum counts hops from a reference clock. The discipline algorithm slews or steps. Authentication is optional but operationally important.
On the wire
Constructed examples, encoded from the field table below them — not captured traffic.
- UDP
- Destination port 123. Mode selects client, server, broadcast, or control traffic. RFC 5905
- NTP header
- Fixed fields through Origin, Receive, and Transmit timestamps. RFC 5905
Configure it
ntp server 192.0.2.10 ntp server 192.0.2.11Associate with reachable time servers.
ntp authenticate ntp authentication-key 1 md5 REPLACE_ME ntp trusted-key 1Prefer authenticated associations when keys are deployed.
Verify
show ntp associations- Reach bits and selected server.
show clock- Time consistent with peers.
Caveats
- Marked draft: syntax has not been checked against a device.
When it breaks
Symptom first, because that is what you have when it happens.
Certificates rejected on an otherwise healthy PKI.
Narrow it down
- show clock
- NTP associations
Cause
Local clock far from real time.
Fix
Sync NTP before chasing CA config.
Persistent offset that never settles.
Narrow it down
- Compare forward/reverse delay
- Traceroute both ways
Cause
Path asymmetry.
Fix
Fix routing or relocate the server.
Association never reaches sync.
Narrow it down
- ACL/UDP 123
- Server reach bits
Cause
Filtered or unreachable server.
Fix
Open UDP/123 and verify reachability.
Two NTP servers fight.
Narrow it down
- Selection scores
- Authentication
Cause
Inconsistent servers or auth failure.
Fix
Prefer a coherent set; enable auth.
Logs out of order across devices.
Narrow it down
- Compare clocks
- Confirm the related configuration and counters.
Cause
Mixed synced and free-running nodes.
Fix
Make NTP mandatory in the build.
Design notes
Point clients at authenticated NTP servers with a local calendar fallback.
Misconceptions
- “NTP steps the clock on every poll.”
- Small offsets are usually slewed; steps are for large errors and are operationally disruptive.
- “Stratum 1 is “more accurate” than a well-synced stratum 2.”
- Stratum counts hops from a reference clock, not a precision guarantee by itself.
- “TLS failures are never a time problem.”
- notYetValid/expired often means the box clock, not the CA.
More walkthroughs
Wrong time breaks TLSfailure
A device with a year-off clock rejects otherwise valid certificates — the outage looks like PKI.
TLS handshakes fail with certificate not-yet-valid or expired. The CA is fine; the local clock is not. R1: TLS cert time failure. R2.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| R1 | router | TLS: cert time failure |
| R2 | router | — |
| R1 — R2 | link | up |
TLS handshakes fail with certificate not-yet-valid or expired. The CA is fine; the local clock is not.
What changed
- Clock year-off
- R1: TLS → cert time failure
Path asymmetry looks like offsetfailure
Delay calculation cannot distinguish persistent path asymmetry from clock offset — NTP reports a wrong offset.
Forward and reverse paths have different delay. NTP attributes the difference partly to clock offset. R1. R2.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| R1 | router | — |
| R2 | router | — |
| R1 — R2 | link | up |
Forward and reverse paths have different delay. NTP attributes the difference partly to clock offset.
What changed
- Apparent offset
- Emphasis: Asymmetric delay