Watch on Instagram

Network Bytes · Episode 51 · CCNA 4.2

"NTP: why time matters"

Logins, certificates and logs all depend on correct clocks. NTP, the Network Time Protocol, keeps devices in sync by asking a time server and correcting for the delay, with time flowing down in layers called strata.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

Why a wrong clock breaks logins

Many security checks quietly look at the time. Windows domain logins use Kerberos tickets, and Kerberos rejects a ticket when the two clocks differ by more than the allowed clock skew, 5 minutes by default in Active Directory. Websites prove who they are with TLS certificates, and each certificate has a "not before" and a "not after" date. If your device's clock is badly wrong, a perfectly good certificate can look expired (or not yet valid), and the connection is refused.

Why logs need matching clocks

When something breaks, several devices usually report it: a switch, a router, a firewall, a server. Each one stamps its log lines with its own clock. If those clocks disagree, the lines come out in the wrong order and you can't tell what happened first, which is usually the cause. With synced clocks, all the logs line up into one timeline.

How NTP sets the clock

A device running NTP sends a request to a time server and gets a reply with the server's time. The trick is that the reply takes time to travel. NTP records four timestamps (when the request left, when the server got it, when the server replied, when the reply arrived) to estimate the round-trip delay and the offset between the two clocks. The client then adjusts its clock, usually gradually rather than in one jump. NTP version 4 is defined in RFC 5905 and runs over UDP port 123.

Strata: steps from the source

NTP time is organized in layers called strata (one layer is a stratum). Stratum 0 is the reference clock itself, such as an atomic clock or a GPS receiver. Stratum 1 servers connect straight to a stratum 0 clock; NIST runs public servers like this, fed by its atomic clocks. Every server that syncs from a stratum 1 server is stratum 2, and each further step adds one. The highest usable number is 15; stratum 16 means "not synchronized". A lower number means fewer hops from the source, not necessarily a better server.

Try it yourself

Check your own computer's time sync. On Windows, open Command Prompt and run w32tm /query /status to see the time source, its stratum and the last successful sync. On a Mac, open System Settings, General, Date & Time, and look at "Set time and date automatically" and its server (often time.apple.com). On Linux with systemd, run timedatectl to see whether the system clock is synchronized and NTP is active.

Good to know

  • NTPv4 is RFC 5905 and runs on UDP port 123.
  • The client uses four timestamps to estimate round-trip delay and clock offset, then adjusts gradually.
  • Stratum 0 is the reference clock itself (atomic, GPS); stratum 1 servers attach directly to it; each hop adds one, up to 15; 16 means unsynchronized.
  • Kerberos (used by Windows domain logins) rejects tickets when clocks differ by more than its allowed skew, 5 minutes by default in Active Directory.
  • TLS certificates have notBefore/notAfter dates, so a badly wrong clock can make a valid certificate look expired or not yet valid.
  • Cisco devices use ntp server <address> to sync and can also serve time to other devices.
  • The log lines and times in the video are just examples.

For CCNA learners

This lines up with CCNA 200-301 exam topic 4.2, configure and verify NTP operating in a client and server mode: know why synced time matters for logs and security, what a stratum number means, and that ntp server <address> makes a Cisco device an NTP client (check it with show ntp status and show ntp associations).

Answer to the comment question

Stratum 3. Your router syncs to a stratum 2 server, and each step further from the source adds one, so the router is one more than its server: 2 + 1 = 3.

Test your knowledge

Quick quiz: "NTP: why time matters"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1Why can a badly wrong clock stop a website from loading securely?
2Why do network logs need matching clocks?
3What does an NTP client correct for when it sets its clock from a server's reply?
4What does a stratum 1 NTP server connect to directly?

Sources

Video transcript

How can a wrong clock stop you from logging in?

Security checks the time. Login tickets and website certificates are only valid for a set window. If a device's clock drifts too far, they look expired, and get rejected.

Logs need time too. When five devices report a problem, matching clocks let you see exactly what happened first.

So devices set their clocks with NTP, the Network Time Protocol. They ask a time server, then correct for how long the answer took to arrive.

Time flows down in layers called strata. Stratum one servers connect straight to an atomic or GPS clock. Each step further away adds one.

Your router syncs to a stratum two server. What stratum is your router? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons