Time

Pages 57-59 of the Bitsmasher Lab Operations Manual (62 pages)

Network Time (NTP)

Overview

Time synchronization is one of the most critical and least-visible aspects of network management. All lab services -- Kerberos authentication, TLS certificate validation, log correlation, distributed databases, and filesystem consistency -- depend on time accuracy. The lab uses a two-tier NTP architecture:

  1. <strong>Stratum 1 source</strong>: GPS-referenced clock on the \texttt{time} host (10.10.12.2) provides the lab's authoritative time reference.
  2. <strong>Stratum 2+ clients</strong>: All other hosts sync to \texttt{time.lab.bitsmasher.net}.

The Time Host

The time host has a GPS unit connected (serial/tty interface) providing UTC discipline. Its ntpd is configured via ntpsec to serve the lab subnet and use the GPS PPS signal as the primary time reference.

Configuration on Client Hosts

The NTP configuration is managed by Ansible via the ntp} role in the lab-franklin collection. Here is what a typical client configuration looks like (as seen on stargate):

\begin{lstlisting}[style=mystyle]

# /etc/ntpsec/ntp.conf -- managed by Ansible

driftfile /var/lib/ntp/ntp.drift

leapfile /usr/share/zoneinfo/leap-seconds.list

statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats

filegen loopstats file loopstats type day enable

filegen peerstats file peerstats type day enable

filegen clockstats file clockstats type day enable

server time.lab.bitsmasher.net

restrict 10.10.8.0/21

restrict -4 default

\end{lstlisting}

Key points:

Installation and Setup Steps

For a new host that needs NTP:

  1. Install ntpsec packages:
  2.     \begin{lstlisting}[style=mystyle]

    apt update && apt install -y ntpsec

        \end{lstlisting}
  3. Configure /etc/ntpsec/ntp.conf (either manually or via Ansible ntp role):
    1. Set \texttt{server time.lab.bitsmasher.net} as the upstream reference.
    2. Set timezone: \texttt{timedatectl set-timezone America/Denver} (or appropriate TZ).
    3. Create the log directory if it doesn't exist: \texttt{mkdir -p /var/log/ntpstats}.
  4. Start and enable the service:
  5.     \begin{lstlisting}[style=mystyle]

    systemctl enable --now ntpsec.service

    timedatectl # verify "System clock synchronized: yes"

        \end{lstlisting}

Verification on Clients

Check synchronization status with these commands:

\begin{lstlisting}[style=mystyle]

# Check if the system clock is synchronized

timedatectl | grep "System clock synchronized"

# Check NTP peer status (if ntpq is available)

ntpq -p

# View recent sync logs

journalctl -u ntpsec --since today

    \end{lstlisting}

Notes for Deployment