Setting Up and Configuring NTP in RHEL Systems

4

NTP, or Network Time Protocol, is a protocol that allows computers to synchronize time over networks for accurate system time. Over time, a computer’s internal clocks can drift, leading to inconsistent time on servers and client logs. This tutorial will guide you on installing and configuring NTP (chrony) server on a RHEL-based distribution to automatically synchronize time with peers closest to your server’s geographical location, using the NTP Public Pool Time Servers list.

To install Chrony in Linux, use the following dnf or yum command:

“`bash
sudo dnf install chrony
OR
sudo yum install chrony
“`

After installation, go to the official NTP Public Pool Time Servers, choose your Continent and Country, then select a list of NTP servers. Open the NTP daemon main configuration file (/etc/chrony.conf) for editing, comment on the default list of Public Servers from the pool.ntp.org project, and replace it with the list provided for your country.

To allow clients from your networks to synchronize time with this server, add the following line to the NTP configuration file:

“`bash
restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap
“`

Add a log file statement to record all NTP server issues into one dedicated log file /var/log/chrony.

NTP service uses UDP port 123 on the OSI transport layer. If the firewall is enabled, allow Chrony to communicate through it and restart the Chrony server to enable it system-wide.

After starting the NTP daemon, wait a few minutes for the server to synchronize time with its pool list servers, then run the following command to verify the NTP peers’ synchronization status and your system time:

“`bash
chronyc sources
“`

Setting up a local NTP chrony on your network ensures that all your servers and clients have the same time in case of an Internet connectivity failure, and they are all synchronized with each other.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More