How to Setup Network Time Protocol (NTP) on a GNU/Linux Client
Overview: Network Time Protocol (NTP) is used for clock synchronization across multiple devices on a network. If done correctly, all devices tied to an NTP server will be synchronized within one (1) millisecond, which is useful if precision is needed for system operations.
One can provision a server or a client, though in the case of the former, numerous NTP servers already exist. New York University (NYU), for example maintains:
This document covers configuring an NTP client. You can use either or both of the NTP servers.
Package installation: Depending on the OS, install:
Configuration (Debian based OSs):
Sync system time with NTP server: sudo ntpdate tick.nyu.edu
Disable Ubuntu’s default timesyncd service: sudo timedatectl set-ntp off
Add line to /etc/ntp.conf file:
sudo bash -c "echo server tick.nyu.edu prefer iburst >> /etc/ntp.conf"
Restart NTP daemon: sudo systemctl restart ntp
List the NTP time synchronization queue (for confirmation): ntpq -p
Configuration (Red Hat-based OSs):
Edit line 3 of chrony.conf: pool tock.nyu.edu iburst
Enable chrony daemon: systemctl enable --now chronyd
Verify status: chronyc sources
Display time synchronization status: ntpstat