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

Protocol ModesRFC 5905 · PROPOSED STANDARD · June 2010Data StructuresRFC 5905 · PROPOSED STANDARD · June 2010System ProcessRFC 5905 · PROPOSED STANDARD · June 2010

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.

R1Client mode 3R2Server mode 4
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
R1router
R2router
R1R2linkup
1 / 2

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.

Mode 3 client request. Origin and receive timestamps are zero until the server replies; transmit carries T1.

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 client toward two servers with authentication preferred.

Cisco IOS-XE 17.12 · Catalyst 9300draft

  1. ntp server 192.0.2.10
    ntp server 192.0.2.11

    Associate with reachable time servers.

  2. ntp authenticate
    ntp authentication-key 1 md5 REPLACE_ME
    ntp trusted-key 1

    Prefer 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.

  1. Certificates rejected on an otherwise healthy PKI.

    Narrow it down

    1. show clock
    2. NTP associations

    Cause

    Local clock far from real time.

    Fix

    Sync NTP before chasing CA config.

  2. Persistent offset that never settles.

    Narrow it down

    1. Compare forward/reverse delay
    2. Traceroute both ways

    Cause

    Path asymmetry.

    Fix

    Fix routing or relocate the server.

  3. Association never reaches sync.

    Narrow it down

    1. ACL/UDP 123
    2. Server reach bits

    Cause

    Filtered or unreachable server.

    Fix

    Open UDP/123 and verify reachability.

  4. Two NTP servers fight.

    Narrow it down

    1. Selection scores
    2. Authentication

    Cause

    Inconsistent servers or auth failure.

    Fix

    Prefer a coherent set; enable auth.

  5. Logs out of order across devices.

    Narrow it down

    1. Compare clocks
    2. 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.

R1Clock year-offTLS: cert time failureR2
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
R1routerTLS: cert time failure
R2router
R1R2linkup
1 / 2

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.

R1Apparent offsetR2Asymmetric delay
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
R1router
R2router
R1R2linkup
1 / 2

Forward and reverse paths have different delay. NTP attributes the difference partly to clock offset.

What changed

  • Apparent offset
  • Emphasis: Asymmetric delay

Check yourself

  • Stratum primarily measures:
  • Year-off clocks often surface as:
  • For small offsets NTP usually:
  • Persistent path asymmetry makes NTP:
  • NTP uses:
  • Unauthenticated NTP risk is:
  • Large error steps are:
  • Client mode packets are mode: