Setting Up NTP server using Chrony on CentOS 8

What is Chrony

Chrony is the default NTP server/client on RHEL/CentOS 8 operating system. basically, Chrony is an implementation of the NTP (Network Time Protocol) and it performs well in a wide range of conditions. Chrony can be used to synchronize the system date and time with NTP servers.

Install Chrony on CentOS 8

Chrony is installed by default on RHEL derivatives, but you can verify this by running the following command:

rpm -qa chrony

by the way if somehow you didn’t get the correct output you can install it using:

yum install chrony

You can start Chrony service using “systemctl” command:

systemctl start chrony

To make Chrony service run at the system startup execute:

systemctl enable chrony

Configure Chrony as NTP server

Chrony can act as both an NTP server or an NTP client. to turn Chrony into an NTP server you need to add the following line to the main config file.

allow 192.168.1.0/24

This will allow requests from 192.168.1.0/24 network, make sure to replace the subnet with your own value.

After that you need to restart the Chrony service to take effect:

systemctl restart chronyd

Allow NTP requests to your system with the following command:

firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload

Configure Chrony as NTP client

Now you can configure your clients to sync the time with your NTP server, for doing that you need to open the Chrony configuration file:

vim /etc/chrony.conf

And type the following line in the configuration file, make sure that the IP address is the primary IP address of your NTP server:

server 192.168.1.10 #Your NTP IP Address

Execute the following command to enable NTP on your server:

timedatectl set-ntp true

And then restart Chrony service to take effect:

systemctl restart chronyd

Verify that everything is working with:

chronyc sources

You should see an output like below:


210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- 192.168.1.10      2   8   377   282  +3634us[+3641us] +/-  101ms

Leave a Reply

Your email address will not be published. Required fields are marked *