100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is NTP (Network Time Protocol)?

Learn what NTP is, how clock synchronization and strata work, and why accurate time matters — with networking interview Q&A.

mediumQ42 of 224 in Computer Networks Est. time: 6 minsLast updated:
Open Code Lab

Expected Interview Answer

NTP (Network Time Protocol) is an application-layer protocol, running over UDP port 123, that synchronizes a device’s clock to an accurate reference time by exchanging timestamped messages with time servers and correcting for network delay.

An NTP client sends a request to a time server and records the exact moment it was sent; the server stamps the request with its own receive and transmit times, and when the reply arrives the client calculates round-trip delay and clock offset from the four timestamps, then gradually adjusts its own clock to close the gap. NTP servers are organized in a hierarchy of "strata," where stratum 0 devices are precision reference clocks like atomic or GPS clocks, stratum 1 servers are directly synced to those, and stratum 2+ servers sync from higher strata, forming a tree that distributes accurate time without every device needing direct hardware access to a reference clock. Accurate, synchronized time matters enormously in distributed systems: TLS certificate validation, Kerberos authentication, log correlation across servers, distributed database consistency, and cache expiry all depend on clocks that agree closely with each other. Because NTP corrects drift gradually by default (rather than jumping the clock instantly), tools like chrony or ntpd are commonly used to keep production servers within milliseconds of true time.

  • Keeps distributed system clocks closely synchronized
  • Corrects for network delay when calculating time offset
  • Hierarchical stratum design distributes load from reference clocks
  • Underpins TLS, authentication, and log correlation across servers

AI Mentor Explanation

NTP is like every stadium clock in a league being synchronized to the exact time kept by the official ICC master clock, so that a delivery timed at 3:45:02 in one ground matches the same moment recorded at another ground during a rain-delay review. Each stadium’s timekeeper periodically checks in with a more authoritative clock and nudges their own slightly to stay aligned, rather than jumping abruptly. This gradual, hierarchical correction against a trusted reference is exactly how NTP keeps computer clocks in sync.

Step-by-Step Explanation

  1. Step 1

    Client request

    The client sends an NTP request to a time server and records the exact send timestamp.

  2. Step 2

    Server timestamps

    The server marks its own receive and transmit timestamps and replies.

  3. Step 3

    Offset calculation

    The client uses the four timestamps to calculate round-trip delay and clock offset.

  4. Step 4

    Gradual correction

    The client slowly adjusts its own clock to close the offset rather than jumping abruptly.

What Interviewer Expects

  • Correctly explains NTP synchronizes clocks over UDP port 123
  • Understands the stratum hierarchy concept
  • Explains why round-trip delay must be accounted for in the calculation
  • Names real-world dependencies on synchronized time (TLS, logs, Kerberos)

Common Mistakes

  • Confusing NTP with a protocol for displaying time zones rather than syncing clocks
  • Thinking NTP jumps the clock instantly instead of correcting it gradually
  • Not knowing NTP runs over UDP, not TCP
  • Underestimating how badly clock drift breaks TLS and distributed systems

Best Answer (HR Friendly)

NTP is the protocol that keeps computer clocks accurate by regularly checking in with trusted time servers and nudging the local clock to match, correcting for how long the message took to travel. It sounds minor, but almost everything from secure website connections to log files being in the right order depends on servers agreeing closely on what time it is.

Code Example

Checking and syncing NTP time
# Check current NTP synchronization status (chrony)
chronyc tracking

# List the time sources chrony is using
chronyc sources -v

# One-off query of an NTP server’s offset (ntpdate style, for diagnostics)
ntpdate -q pool.ntp.org
# server 162.159.200.1, stratum 3, offset -0.002145, delay 0.03217

Follow-up Questions

  • What is a stratum in NTP and how does the hierarchy work?
  • Why does clock drift break TLS certificate validation?
  • How does NTP account for network round-trip delay?
  • What is the difference between NTP and PTP (Precision Time Protocol)?

MCQ Practice

1. What transport protocol and port does NTP use by default?

NTP operates over UDP port 123.

2. What is a stratum 1 NTP server?

Stratum 1 servers sync directly from stratum 0 reference clocks like atomic or GPS clocks.

3. Why does NTP calculate round-trip delay during synchronization?

Round-trip delay is used to accurately estimate the true clock offset despite network latency.

Flash Cards

What is NTP?A protocol that synchronizes device clocks to an accurate reference time over UDP port 123.

What is an NTP stratum?A hierarchy level indicating how many hops a server is from a stratum 0 reference clock.

How does NTP correct time?Gradually adjusts the local clock based on calculated offset, rather than jumping abruptly.

Why does synchronized time matter?TLS validation, authentication protocols, log correlation, and distributed systems rely on it.

1 / 4

Continue Learning