Get AI summaries of any video or article — Sign up free
so...I put a Time Server in my HomeLab thumbnail

so...I put a Time Server in my HomeLab

NetworkChuck·
5 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Use a GPS-disciplined time reference (atomic-clock-derived via satellites) to anchor local time rather than relying solely on drifting RTCs.

Briefing

A home lab time server built around GPS-disciplined atomic timing is the centerpiece of this build: a Raspberry Pi Compute Module 4–based “open time card” that can synchronize a local network to nanosecond accuracy. The practical payoff is that systems no longer have to rely on public internet time sources, and precision-sensitive services can keep clocks aligned far tighter than typical millisecond-grade Network Time Protocol (NTP).

Instead of using NTP, which commonly delivers time within roughly 1–10 milliseconds over the internet, the setup leans on Precision Time Protocol (PTP). The time card pairs a GPS module—fed by satellites carrying atomic clocks—with a Pi CM4 server that distributes time across the LAN. The GPS side provides a high-accuracy reference (aligned to UTC), while PTP handles the network distribution and clock discipline so devices can converge on the same time base.

The transcript spends significant time on why clock drift matters. Standard computer timekeeping uses a quartz-based real-time clock (RTC) plus a CMOS battery when power is off. Quartz oscillators can drift by about 1–2 seconds per day due to factors like temperature, component aging, power supply variation, and electromagnetic interference. Over time, that drift can break assumptions in software and security workflows—illustrated by a failed attempt to run a package/repository update until time synchronization was corrected.

To reach nanosecond-level sync, the build uses TimeBeat software from Time Card (Time B) and configures it with a PTP “grand master” hierarchy. GPS provides a pulse-per-second (PPS) signal once per second, and TimeBeat uses that PPS as the primary clock input. PTP then selects the most accurate master using multicast-based messages, with optional roles like boundary clocks (switch-like intermediaries that reduce load) and transparent clocks (switches that measure and compensate packet residence time). The transcript emphasizes that accuracy at this scale depends heavily on eliminating delays, which is why hardware timestamping on the network interface card (NIC) becomes crucial.

A key troubleshooting moment shows the limits of assumptions: GPS reception failed when the antenna sat inside the server room, producing “not locking onto any satellites” behavior and even a system time that appeared stuck in 1970. Moving the antenna outside restored satellite data, and after a few minutes the system clock synchronized correctly. Later, PTP client synchronization initially stalled due to firewall rules blocking required PTP traffic (UDP ports 319 and 320), and enabling those flows allowed the system to converge from millisecond accuracy into nanosecond territory.

Once deployed, the monitoring stack (ElasticSearch plus Grafana via a Kubernetes Helm chart) tracks offset trending downward toward nanosecond precision, with the transcript citing a measured accuracy around 0.18 nanoseconds. The build closes by noting where such precision is needed—financial trading, NASA, and tightly synchronized audio/video broadcast—and by referencing Meta’s open-source TAP project, which supports time synchronization at scale. Finally, it adds an NTP fallback for devices that can’t do PTP, including a self-hosted Stratum one time source for Windows systems.

Cornell Notes

A GPS-disciplined “open time card” built on a Raspberry Pi Compute Module 4 can synchronize a home lab network to nanosecond accuracy using Precision Time Protocol (PTP) instead of NTP. The GPS module supplies a UTC-aligned reference via pulse-per-second (PPS), and TimeBeat software turns that into a PTP grand master that other servers can follow. Achieving nanosecond precision depends on hardware timestamping support in NICs and on network conditions like firewall rules that must allow PTP traffic (UDP 319/320). The builder also had to troubleshoot GPS signal reception—antenna placement inside the server room prevented satellite lock until the antenna was moved outside. Monitoring with ElasticSearch and Grafana shows offset improving from millisecond range toward sub-nanosecond levels.

Why does a local time server matter more than relying on public NTP sources?

The transcript frames drift as the core problem with typical RTC-based timekeeping: quartz oscillators can drift about 1–2 seconds per day (temperature, aging, power, and interference all contribute). Over days, that drift can reach seconds, which can disrupt software behavior and security assumptions. Public NTP can correct clocks, but it’s usually millisecond-grade and depends on internet paths and latency. Hosting a local time source lets the lab keep time tightly aligned and avoid reliance on external servers.

What’s the difference between NTP and PTP in this setup?

NTP (Network Time Protocol) is described as delivering time synchronization within roughly 1–10 milliseconds by polling time servers over UDP. PTP (Precision Time Protocol) is used here to push accuracy from millisecond into microsecond/nanosecond territory. The transcript ties that leap to PTP’s LAN-focused design and, critically, to hardware timestamping that captures packet send/receive times at the NIC level rather than relying on software timing.

How does the GPS module contribute to nanosecond synchronization?

GPS satellites carry atomic clocks, and the time card’s GPS module receives those signals and outputs a pulse-per-second (PPS) aligned to UTC. TimeBeat treats PPS as the primary clock reference for the PTP grand master. That means the network’s time distribution is anchored to an atomic-clock-derived source rather than to a drifting quartz RTC.

What role do PTP “clock types” play in a network?

The transcript describes a hierarchy: the grand master (most accurate source) distributes time; clients follow it. It also mentions boundary clocks (switch-like intermediaries that forward time while reducing load on the grand master) and transparent clocks (switches that measure packet processing time and adjust packets accordingly). These roles help maintain precision by compensating for network-induced delays.

What were the two biggest practical obstacles during the build?

First, GPS signal lock failed when the antenna was inside the server room, leading to missing satellite data and even system time appearing stuck around 1970. Moving the antenna outside restored satellite reception. Second, PTP client synchronization initially didn’t progress due to firewall blocking PTP traffic; allowing UDP ports 319 and 320 fixed the issue and allowed convergence from millisecond to nanosecond accuracy.

Why is hardware timestamping on NICs emphasized?

At nanosecond precision, software timing overhead and variable delays become significant. Hardware timestamping stamps the exact time a packet is sent or received at the NIC hardware level, bypassing software delays. The transcript notes that the Raspberry Pi CM4 supports hardware timestamping, while the Raspberry Pi 4 does not, and that NIC support is especially important for the PTP grand master.

Review Questions

  1. What drift mechanisms affect quartz RTC clocks, and how does that translate into real-world failures over multiple days?
  2. How do PPS and UTC fit together in the time card’s architecture, and why does that matter for PTP accuracy?
  3. Which network and hardware requirements (NIC hardware timestamping, firewall ports) most directly determine whether PTP reaches nanosecond-level sync?

Key Points

  1. 1

    Use a GPS-disciplined time reference (atomic-clock-derived via satellites) to anchor local time rather than relying solely on drifting RTCs.

  2. 2

    Prefer PTP over NTP when you need microsecond or nanosecond synchronization on a LAN.

  3. 3

    Hardware timestamping on NICs is a make-or-break requirement for nanosecond accuracy; software-only timing won’t reliably achieve it.

  4. 4

    PTP deployments require correct network plumbing—firewalls must allow PTP traffic (UDP 319/320) or clients won’t converge.

  5. 5

    A GPS antenna’s physical placement can determine whether the system locks to satellites; indoor server-room placement may fail without line-of-sight.

  6. 6

    Use monitoring (ElasticSearch + Grafana) to track offset and verify convergence from millisecond range toward sub-nanosecond precision.

  7. 7

    Keep an NTP fallback for devices that can’t do PTP, and consider self-hosting a Stratum one source for consistency.

Highlights

Nanosecond sync comes from combining GPS-derived PPS (UTC-aligned) with PTP distribution plus NIC hardware timestamping—each piece is necessary.
A firewall misconfiguration can stall PTP convergence; allowing UDP 319/320 was the turning point for client synchronization.
Antenna placement determined GPS lock: inside the server room the system showed no satellite lock until the antenna was moved outside.
The build’s monitoring showed offset trending down into the nanosecond range (including a reported ~0.18 ns accuracy).
Meta’s TAP open-source effort is referenced as part of the broader push to keep large messaging systems time-aligned.

Topics

  • Precision Time Protocol
  • GPS PPS
  • TimeBeat
  • Hardware Timestamping
  • Network Timekeeping

Mentioned

  • PTP
  • NTP
  • RTC
  • UTC
  • PPS
  • NIC
  • PHC
  • UDP
  • TLS
  • NIST
  • CMOS
  • RTC
  • PHC