Network Time Protocol (NTP) in Rocky Linux 8

What is NTP?

NTP (Network Time Protocol) is a protocol that synchronizes the system clock with reliable external time sources, such as NTP servers available on the internet or within your organization.

Why is NTP Important?

  • Ensures logs have accurate timestamps.
  • Required for authentication protocols like Kerberos.
  • Helps in database transactions and distributed systems.
  • Prevents troubleshooting issues caused by time mismatch.

Step 1: Install NTP or Chrony

Rocky Linux 8 uses chrony instead of the old ntpd package. To install:

sudo dnf install chrony -y

Step 2: Enable and Start the Service

sudo systemctl enable chronyd --now
sudo systemctl status chronyd

Step 3: Verify Synchronization

Check if your system is synced with NTP servers:

chronyc tracking
chronyc sources -v

Step 4: Configure NTP Servers

You can edit the configuration file:

sudo vi /etc/chrony.conf

Example configuration:

 

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst

Step 5: Manual Time Sync (Optional)

sudo chronyc makestep

Best Practices for Production Servers

  • Always use multiple NTP servers for redundancy.
  • Prefer internal NTP servers in corporate environments.
  • Ensure chronyd starts at boot.
  • Monitor logs for sync issues: /var/log/chrony/

Interview Tips for Linux Administrators

  • Be ready to explain the difference between ntpd and chronyd.
  • Know how to check if a system clock is synced.
  • Explain why time sync is important in clusters and authentication.
  • Be able to show basic chrony commands during practical tests.

Conclusion

Time synchronization is an essential part of Linux administration. With Chrony (NTP) in Rocky Linux 8, you can ensure your servers always stay in sync with reliable time sources, keeping applications and logs consistent.

Leave a Reply

Your email address will not be published. Required fields are marked *