Setting Up a Chrony NTP Server and Client
What is Chrony
Chrony is a versatile Network Time Protocol (NTP) implementation used to synchronize system clocks over a network. It is lightweight, accurate, and ideal for servers, clusters, or any system where precise timekeeping is crucial. Chrony works well even on systems with intermittent network connections, making it perfect for HPC clusters, lab setups, or home networks.
1. Install Chrony on Server
Install Chrony on the server machine:
sudo pacman -S chrony2. Configure the Chrony Server
Edit /etc/chrony/chrony.conf on the server:
server time.google.com iburst
allow 192.168.144.0/24
driftfile /var/lib/chrony/drift
local stratum 10- server time.google.com iburst: Synchronizes the server’s clock with an external NTP source.
iburstspeeds up initial synchronization. - allow 192.168.144.0/24: Permits clients from this subnet to query the server for time.
- driftfile /var/lib/chrony/drift: Stores the system clock’s drift rate to improve accuracy across reboots.
- local stratum 10: Declares this server as a local time source if external servers are unreachable, with low priority (stratum 10).
3. Start Chrony Services on Server
Enable and start Chrony on the server:
sudo systemctl enable chronyd
sudo systemctl start chronyd4. Verify Server Synchronization
Check that the server is correctly synchronized with external time sources:
chronyc tracking
chronyc sources -v
timedatectl status- chronyc tracking: Shows server’s clock offset, stratum, and estimated error.
- chronyc sources -v: Lists all external NTP sources and their status.
*marks the active source. - timedatectl status: Confirms the system clock is synchronized (look for
NTP synchronized: yes).
5. Install Chrony on Client
Before configuring the client, install Chrony on the client machine:
sudo pacman -S chrony6. Configure the Chrony Client
Edit /etc/chrony/chrony.conf on the client:
server 192.168.144.1 iburst
driftfile /var/lib/chrony/drift
makestep 1 3- server 192.168.144.1 iburst: Points the client to the local Chrony server for time synchronization.
iburstensures faster initial sync. - driftfile /var/lib/chrony/drift: Keeps the local clock’s drift rate for precise adjustments.
- makestep 1 3: Allows Chrony to immediately correct the clock if it is off by more than 1 second during the first 3 updates.
7. Start Chrony on Client
Enable and start the Chrony service on the client machine:
sudo systemctl enable chronyd
sudo systemctl start chronyd8. Verify Client Synchronization
Check that the client is receiving time from the server and synchronized:
chronyc tracking
chronyc sources -v
timedatectl status- chronyc tracking: Confirms the client’s clock offset, stratum, and synchronization status.
- chronyc sources -v: Shows the server as the active source with a
*. - timedatectl status: Ensures
NTP synchronized: yesand displays the accurate current time.
9. Optional: Quick Sync Check
To quickly verify synchronization without verbose output:
chronyc -n trackingSample output:
Reference ID : D8EF230C (216.239.35.12)
Stratum : 2
System time : 0.001029140 seconds slow of NTP time
Last offset : -0.000090224 seconds
Frequency : 10.089 ppm fast
Leap status : Normal
Here client is synchronized with the NTP server. Stratum 2 indicates one hop away from a primary source. The system time is very close to the correct time (only ~1 ms off). Frequency shows a minor adjustment being applied. Leap status normal means there are no leap second issues.
If the output shows Stratum 16, large offsets, or Leap status: Alarm, it indicates the client is not synchronized, there is a network/server problem, or the local clock has a large error.