Chrony is a default NTP client as well as an NTP server on RHEL 8 / CentOS 8. This article will provide you with an information on how to perform an installation and basic configuration of an NTP server or client on RHEL 8.

In this tutorial you will learn:
  • How to install NTP server on RHEL 8 / CentOS 8.
  • How to install NTP client on RHEL 8 / CentOS 8.
  • How to open firewall to incoming NTP requests.
  • How to configure Chrony as NTP server.
  • How to configure Chrony as NTP client.
Chrony - NTP server source list on Red Hat Enterprise Linux 8.
Chrony - NTP server source list on Red Hat Enterprise Linux 8.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software chronyc (chrony) version 3.3
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How to configure NTP server on RHEL 8 / CentOS 8 Linux step by step instructions


$$$ Looking for LINUX ADMINISTRATOR ! $$$

BLUE SKY STUDIOS are looking for Linux Administrator to maintain and support the Studio's 450+ production Linux workstations, including daily interactions with the Studio’s digital animation artists.
LOCATION: Greenwich, Connecticut, USA

APPLY NOW

The chances are that Chrony is already installed on your RHEL 8 and currently configured as a client. If this is the case then simply jump directly into Step 3. Let's first setup an NTP server for network eg. 192.168.1.0/24.

  1. install package Chrony NTP:
    # dnf install chrony
    
  2. Enable chrony to start after boot:
    # systemctl enable chronyd
    
  3. Set Chrony to act as an NTP server for a local network.

    As already mentioned before the Chrony NTP daemon can act as both, NTP server or as NTP client. To turn Chrony into an NTP server add the following line into the main Chrony /etc/chrony.conf configuration file:
    allow 192.168.1.0/24
    
    Feel free to add more allow lines for additional networks or host IP addresses.
  4. Restart Chrony NTP daemon to apply the changes:
    # systemctl restart chronyd
    
  5. Open firewall port to allow for incoming NTP requests:
    # firewall-cmd --permanent --add-service=ntp
    # firewall-cmd --reload
    
  6. Confirm your NTP server configuration by manual time sync from any host located on the allowed network. Any NTP client should be able to sync against the new Chrony NTP server.

    In our case we will use the ntpdate command to sync which our Chrony NTP server locate on 192.168.1.150 IP address:
    # ntpdate 192.168.1.150
    13 Dec 11:59:44 ntpdate[9279]: adjust time server 192.168.1.150 offset -0.031915 sec
    

How to configure an NTP client on RHEL 8 / CentOS 8 Linux step by step instructions



In this section we will configure an NTP client to time sync with our new Chrony NTP server located on the 192.168.1.150 IP address:

  1. Install Chrony NTP package:
    # dnf install chrony
    
  2. Enable Chrony to start after boot:
    # systemctl enable chronyd
    
  3. Set Chrony to act as an NTP client

    To turn Chrony into the NTP cleint add the following line into the main Chrony /etc/chrony.conf configuration file. Change the IP address accordingly to point to your local Chrony NTP server:
    Server 192.168.1.150
    
  4. Restart Chrony NTP daemon to apply the changes:
    # systemctl restart chronyd
    
  5. Check for NTP server sources. Your local NTP server should be listed:
    # chronyc sources 
    210 Number of sources = 9
    MS Name/IP address         Stratum Poll Reach LastRx Last sample               
    ===============================================================================
    ^* rhel8.localdomain             3   6     7    36  -8235ns[-1042us] +/- 5523us
    
    By default the Chrony NTP client will perform a time synchronization in every 64 seconds.
  6. Check NTP client list on the NTP server:
    # chronyc clients
    Hostname                      NTP   Drop Int IntL Last     Cmd   Drop Int  Last
    ===============================================================================
    ntp-client.localdomain       7      0  10   -    48       0      0   -     -
    
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.