How to configure NTP server on RHEL 8 / CentOS 8 Linux

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
Jan D.
Jan D.

"The only real security that a man will have in this world is a reserve of knowledge, experience, and ability."

Articles: 669

Leave a Reply

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *