Tuesday, August 15, 2023

Enable server time sync in ubuntu with chrony

Chrony is an implementation of the Network Time Protocol (NTP). It is an alternative to ntpd, a reference implementation of NTP. It runs on Unix-like operating systems (including Linux and macOS) and is released under the GNU GPL v2. It is the default NTP client and server in Red Hat Enterprise Linux 8 and SUSE Linux Enterprise Server 15, and available in many Linux distributions.


To enable chrony in ubuntu, we can install it first
$ sudo apt update && sudo apt install chrony -y
Start chrony once it is installed
$ sudo systemctl start chrony
Enable chrony on boot
$ sudo systemctl enable chrony
We can change the server that chrony sync from, by editing /etc/chrony/chrony.conf. By default, chrony in ubuntu will use ntp.ubuntu.com







To check the status of time sync
$ sudo chronyc sources -v

We can see that from the above example, the current best source of time is 144.126.242.176.

Make sure there is at least one server with ^* status.

If the time is skewed, we can force resync using below command 
$ sudo chronyc makestep
To install and configure chrony in redhat based linux, please refer to this article

No comments: