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
.
- install package Chrony NTP:
# dnf install chrony - Enable chrony to start after boot:
# systemctl enable chronyd - 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 moreallow
lines for additional networks or host IP addresses. - Restart Chrony NTP daemon to apply the changes:
# systemctl restart chronyd - Open firewall port to allow for incoming NTP requests:
# firewall-cmd –permanent –add-service=ntp
# firewall-cmd –reload - 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 thentpdate
command to sync which our Chrony NTP server locate on192.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:
- Install Chrony NTP package:
# dnf install chrony - Enable Chrony to start after boot:
# systemctl enable chronyd - 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 - Restart Chrony NTP daemon to apply the changes:
# systemctl restart chronyd - 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. - 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