How to sync time on Linux servers with Chrony

Hi everyone, in this article we will show you how to synchronize time on Linux servers with Chrony. A Linux server is a server based on the Linux open source operating system. It provides businesses with a cost-effective option for delivering content, applications and services to their customers. Because Linux is an open source operating system, users also benefit from a strong community of resources and supporters.

An accurate date and time are essential in Linux systems, as some services such as job schedulers (cron jobs) and scripts rely on the exact time to deliver the expected output. The network time protocol, commonly known as NTP, is used to maintain accurate time in Linux systems. NTP is an Internet protocol that plays an important role in synchronizing the date and time in Linux systems with NTP servers available online.

Most old Linux systems used the ntpd daemon to synchronize date and time, but it has been deprecated in some modern operating systems. For the implementation of ntpd in modern operating systems we have chrony. In this article we will learn how to install and use chrony on a Linux system to synchronize date and time.

How to sync time on Linux servers with Chrony

Install Chrony on CentOS / RHEL / Fedora System

Step 1: To Install Chrony on CentOS, RHEL and Fedora System, execute the following yum or dnf command

~]# yum install chrony -yOr~]# dnf install chrony -y

Install Chrony on Debian / Ubuntu System

Step 1: To install Chrony on Debian and Ubuntu Systems, run the following apt command,

~]$ sudo apt install chrony -y

Step 2: Once the chrony is installed on Linux server then it offers two programs,

  • chronyc : It is command line interface of chrony
  • chronyd : It is daemon for chrony which start and enable chrony service across the reboot.

Configuration File of Chrony

Step 1: Configuration file for Chrony is “/etc/chrony.conf” , sample chrony.conf file is listed below,

~]# cat /etc/chrony.conf

Testing Chrony

Step 1: Just like ntpdate command in NTP distribution, we can use chronyd to sync time of our Linux server with remote NTP server manually,

~]# chronyd -q ‘server 0.europe.pool.ntp.org iburst’

Start and Enabled Chronyd Service

Step 1: Run the following commands to start and enable chronyd daemon so that it will be available across the reboots.

~]# systemctl start chronyd

~]# systemctl enable chronyd

Step 2: Run the beneath command to verify the chronys service status

Verify and Track Chrony Synchronization

Step 1: To verify whether your system’s time is synchronized using chrony, issue the following command,

[root@ceph-admin ~]# chronyc trackingReference ID : 904C13DD (its.no-fun.de)Stratum : 3Ref time (UTC) : Sun Jan 12 06:23:26 2020System time : 0.000174314 seconds slow of NTP timeLast offset : -0.000199483 secondsRMS offset : 0.000199483 secondsFrequency : 0.301 ppm fastResidual freq : -40.403 ppmSkew : 0.541 ppmRoot delay : 0.172664896 secondsRoot dispersion : 0.047364954 secondsUpdate interval : 64.8 secondsLeap status : Normal[root@ceph-admin ~]#

Where:

  • Reference ID is the ID and name of server to which your system’s time currently synced.
  • Stratum , it indicates the number of hops away from the server with an attached reference clock we are.

Check Chrony Sources

Step 1: To list information about the current time sources that the chronyd is using, run the following command,

~]# chronyc sources

Step 2: To list more detailed information about sources then run the following command

~]# chronyc sources -v

Check Chrony Source Statistics

Step 1: To list the information about drift speed and offset estimation of each source that the chronyd is using, run the following command

~]# chronyc sourcestats -v

Configure Chrony NTP Server

Step 1: Let’s assume you want to configure your Linux Server as a Chrony NTP server for all internal systems. To accomplish this, we need to uncomment two lines from configuration file “/etc/chrony.conf”

  • local stratum 10
  • allow 192.168.0.0/16

Step 2: Execute the following commands

~]# sed -i “s/#local stratum 10/local stratum 10/g” /etc/chrony.conf~]# sed -i “s/#allow 192.168.0.0/16/allow 192.168.0.0/16/” /etc/chrony.conf

Step 3: When we uncomment the line “local stratum 10″ then makes our Linux Server as chrony NTP server and continue to work normally even if it is disconnected from network. Whereas “allow 192.168.0.0/26” indicates that clients from this network is allowed to make connection to our Chrony NTP server for time syncing.

Step 4: After making changes restart chrony service and track chrony

~]# systemctl restart chronyd ; watch chronyc tracking

Step 5: Allow NTP Service in firewall using following command,

~]# firewall-cmd –add-service=ntp –permanent~]# firewall-cmd –reload

Final Words

We hope you enjoy our article about synchronizing time on Linux servers with Chrony. Linux servers are among the most widely used servers in the world for several reasons. Unlike Windows and other proprietary software, Linux is much cheaper and gives you more control over the configuration of your servers to get started. So if you like our article, please share it with others.

I hope you understand this article, How to sync time on Linux servers with Chrony.

Editorial Staff
Editorial Staffhttps://www.bollyinside.com
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...