This tutorial will help you install and configure NTP server using Chrony on RHEL 8 / CentOS 8. Are you new to RHEL 8?, check out  Red Hat Enterprise Linux 8 (RHEL 8) New Features & Review. NTP (Network Time Protocol) is a network protocol that allows for clock synchronization between computer systems.

Chrony is a versatile implementation of the Network Time Protocol. It has two programs chronyand chronyd.

  • chronyd is a daemon that can be started at boot time
  • chronyc is a command-line interface program which can be used to monitor chronyd’s performance and to change various operating parameters whilst it is running.

Installing Chrony on RHEL 8 / CentOS 8

Set timezone.

sudo timedatectl set-timezone Africa/Nairobi

Chrony can be installed on RHEL 8 / CentOS 8 from package manager.

sudo yum -y install chrony

After the installation, start and enable chronyd service.

sudo systemctl enable --now chronyd

The service status should show running

$ systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-12-31 08:11:50 EAT; 5min ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Main PID: 743 (chronyd)
Tasks: 1 (limit: 5061)
Memory: 1.7M
CGroup: /system.slice/chronyd.service
└─743 /usr/sbin/chronyd

Configuring Chrony on RHEL 8 / CentOS 8

After the installation, you can make the changes on Chrony main configuration file /etc/chrony.conf

One main configuration change you can make is to set the time servers closest to you. Since I’m in Nairobi, I’ll set Africa NTP pool of servers.

sudo vi /etc/chrony.conf

Comment out the first pool line and add a list of NTP servers.

#pool 2.rhel.pool.ntp.org iburst
server 0.africa.pool.ntp.org iburst
server 1.africa.pool.ntp.org iburst
server 2.africa.pool.ntp.org iburst
server 3.africa.pool.ntp.org iburst

You can also add CentOS NTP servers if you don’t have ones close to you.

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

Set NTP synchronization.

sudo timedatectl set-ntp true

Restart chronyd service after making the change.

sudo systemctl restart chronyd

You can also specify IP addresses or network address block that is allowed to access your NTP server.

# Allow NTP client access from local network.
allow 192.168.25.0/24

If you have active firewalld service, allow ntp port.

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

Check if NTP server is working.

$ chronyc sources
210 Number of sources = 3
MS Name/IP address Stratum Poll Reach LastRx Last sample
^+ ntp.dts.mg 2 7 377 127 +2102us[+1979us] +/- 98ms
^* 196.9.24.88 2 7 377 2 -11ms[ -11ms] +/- 103ms
^+ jhb-ntp.mweb.co.za 3 7 377 132 -76us[ +158us] +/- 103ms
[[email protected] ~]#

Configure NTP Client on CentOS 8 / RHEL 8

Now that you have Chrony NTP Server installed and configured, you can configure NTP client.

Set timezone.

sudo timedatectl set-timezone Africa/Nairobi

Install chrony and configure it as NTP client.

sudo yum -y install chrony

Edit the configuration file to set NTP server to point your newly configured NTP server.

$ sudo vi /etc/chrony.conf
server 192.168.25.3

Set NTP synchronization.

sudo timedatectl set-ntp true

Start and enable the service.

sudo systemctl enable --now chronyd

Verify the setting using the following command:

$ chronyc sources
210 Number of sources = 3
MS Name/IP address Stratum Poll Reach LastRx Last sample
^+ 192.168.25.3 2 7 377 61 +12ms[ +12ms] +/- 100ms

That’s all. You now have NTP server working on RHEL 8 server. See how you can use the timedatectl command to synchronize the system clock with NTP server.

How to Set Hostname and Timezone on RHEL 8

Want an easy to administer RHEL / CentOS server from a web UI?, check how to Install Webmin on RHEL 8 / CentOS 8

More guides:

How To Setup a TFTP server on CentOS 8 / RHEL 8

Enable automatic software updates on CentOS 8 / RHEL 8

How To Join CentOS 8 / RHEL 8 System to Active Directory (AD) domain

How To Manage CentOS 8 With Cockpit Web Admin Console