NTP configuration in Linux

How to Configure NTP Server and Clients on RHEL 8 Using Chrony

Keeping system clocks in sync is critical for a wide range of IT operations, from logging accuracy to time-sensitive applications and security mechanisms. One of the most reliable and widely adopted protocols for time synchronization is NTP (Network Time Protocol). In modern versions of Red Hat Enterprise Linux (RHEL), time synchronization is handled by Chrony, a versatile and efficient NTP implementation.

What is NTP and Chrony?

NTP is a well-established protocol that synchronizes the clocks of computers across networks. Traditionally, this was handled by the ntpd daemon. However, in RHEL 8, the ntp package has been deprecated and replaced by Chrony, which is both more accurate and lightweight.

Chrony consists of:

i) chronyd: A daemon that runs in the background and adjusts the system clock.

ii) chronyc: A command-line tool for interacting with chronyd.

Chrony can function as both an NTP server and NTP client, allowing it to synchronize time from external servers or provide time to other systems.

Server-Side Configuration (RHEL 8)

Step 1: Ensure Yum Repository is Configured

dnf repolist   `

Step 2: Install Chrony

dnf install chrony* -y   `

Step 3: Start the Chrony Daemon

systemctl start chronyd   `

Step 4: Enable Chrony to Start on Boot

systemctl enable chronyd   `

Step 5: Check the Service Status

systemctl status chronyd   `

Step 6: Configure Chrony to Allow Client Connections

Edit the Chrony configuration file:

vim /etc/chrony.conf   `

Add this line to allow clients on your network (adjust subnet as needed):


allow 192.168.1.0/24   `

Step 7: Restart the Chrony Service

systemctl restart chronyd   `

Step 8: Allow NTP Through the Firewall

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

Step 9: Verify Connected Clients

chronyc clients   `

Client-Side Configuration (RHEL 7 or RHEL 8)

Step 1: Verify Yum Repository

yum repolist   `

Step 2: Install Chrony

yum install chrony* -y   `

Or if Yum is not configured:

rpm -ivh chrony   `

Step 3: Start the Chrony Daemon

systemctl start chronyd   `

Step 4: Enable Chrony on Boot

systemctl enable chronyd   `

Step 5: Check Service Status

systemctl status chronyd   `

Step 6: Point to Your NTP Server

Edit the configuration file:

vim /etc/chrony.conf   `

Add the following line with your server’s IP:

server 192.168.1.107   `

Step 7: Restart Chrony

systemctl restart chronyd   `

Step 8: Verify Time Source

chronyc sources   `

Verifying Synchronization

To verify that everything is working:

On the NTP Server

Check which clients are connected:

chronyc clients   `

On the Client

Test synchronization by changing the system time and forcing a resync:

date # View current time  chronyc makestep # Force immediate time sync   `

Then return to the server and confirm the time was corrected.

Conclusion

Chrony provides a robust and efficient way to synchronize time across systems on RHEL 8. With just a few configuration steps, you can ensure your server and clients remain in sync, which is critical for distributed systems, authentication services, and accurate logging.

By leveraging Chrony, you’re not just using a modern NTP solution—you’re ensuring your infrastructure runs on time, every time.