Site icon CentLinux

How to install Chrony Server on CentOS 8

Share on Social Media

Chrony is the default NTP client / server software in Linux. In this article, you will learn how to install chrony on CentOS 8. #centlinux #linux #ntp

What is NTP?

Network Time Protocol (NTP) is a networking protocol used to synchronize the clocks of computers and devices over a network. It ensures that the time across all systems in a network is accurate and consistent. Here are some key points about NTP:

Overall, NTP plays a fundamental role in ensuring that the time is synchronized across all devices in a network, which is essential for reliable and secure operations.

What is NTP Server?

An NTP server is a networked device that uses the Network Time Protocol (NTP) to provide precise time information to other devices within a network. It acts as a reference point for the accurate time and enables clients to synchronize their clocks. Here are the key aspects of an NTP server:

Function: The primary function of an NTP server is to distribute accurate time to clients (other devices) on the network. Clients query the NTP server for the current time, which they then use to adjust their own clocks.

Time Sources: NTP servers typically obtain accurate time from higher-level time sources:

Synchronization Process: The synchronization process involves the client requesting time data from the NTP server, receiving the time, and then adjusting its clock accordingly. This helps ensure that all devices on the network have consistent time.

Deployment: NTP servers can be deployed in various ways:

Accuracy and Reliability: NTP servers are designed to provide highly accurate time, often within milliseconds of the true time. They also include mechanisms to maintain reliability, such as adjusting for network delays and correcting for clock drift.

Security Considerations: Secure NTP servers implement measures to protect against malicious attacks and ensure the integrity of time data. This includes using authenticated NTP (NTPsec) and firewall rules to control access.

Applications: NTP servers are crucial in various applications, including:

Overall, an NTP server is essential for maintaining consistent and accurate time across devices in a network, ensuring synchronized operations, and supporting time-sensitive applications.

How to install Chrony Server on CentOS 8

Chrony vs NTP

Chrony and NTP (Network Time Protocol) are both tools used for time synchronization in computer networks, but they have some differences in terms of features, performance, and use cases. Here’s a comparison:

NTP (Network Time Protocol)

Established Protocol:

Software Implementations:

Features:

Use Cases:

Chrony

Modern Alternative:

Performance:

Features:

Use Cases:

Summary

Read Also: Setup Chrony NTP Server on Rocky Linux 8

Both tools can achieve highly accurate time synchronization, but Chrony offers advantages in modern and dynamic environments where conditions are less predictable. Choosing between the two depends on your specific use case and network conditions.

Recommended Training: Linux Administration: The Complete Linux Bootcamp in 2025 from Andrei Dumitrescu, Crystal Mind Academy

Environment Specification

We are using a minimal CentOS 8 virtual machine with following specifications.

Install Chrony Server on CentOS 8

By using a SSH client, connect with ntp-server.centlinux.com as root user.

By default, Chrony works as a NTP client and synchronize the clock of your Linux server with network time servers or network time peers.

You can enable Chrony NTP service to make it a full fledge network time server / peer.

First of all, you need to install Chrony software package on your Linux operating system.

Execute dnf command to install chrony software package..

# dnf install -y chrony

Enable and start chronyd service.

# systemctl enable --now chronyd.service

Configure Chrony as NTP Client

The NTP client is started with default configurations and synchronizing your Linux server clock with available network time servers / peers.

To get a list of available network time servers / peers, we can execute following Linux command.

# chronyc sources -v
210 Number of sources = 4

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                     |          |  zzzz = estimated error.
||                                 |    |           
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* time.cloudflare.com           3   6    17    54  +6607us[  -33ms] +/-  104ms
^- 119.159.246.253               2   6    17    53    +30ms[  +30ms] +/-  102ms
^? time.cloudflare.com           0   6     0     -     +0ns[   +0ns] +/-    0ns
^+ cdns-khi-02.ptcl.net.pk       2   6    17    54    +12ms[  +12ms] +/-  113ms

Check the CentOS / Red Hat Linux server time.

# date
Sun Oct 11 22:16:26 PKT 2020

Configure Chrony as NTP Server

To configure your NTP server, you will need to allow your network address in Chrony configuration file.

# vi /etc/chrony.conf

Search for the “allow” directives and add following line beneath it.

allow 192.168.116.0/24

Restart chronyd NTP service to apply changes.

# systemctl restart chronyd.service

Verify that the chronyd service is listening on the default NTP port.

# ss -tulpn | grep 123
udp     UNCONN   0        0                0.0.0.0:123           0.0.0.0:*       users:(("chronyd",pid=10011,fd=9))

The Chrony NTP service is running fine. To make it usable by the network clients, you are only required to allow incoming traffic to this port through Linux firewall.

Firewalld is the default firewall software in CentOS 8. It has a predefined service for NTP service ports. Therefore, to allow incoming traffic, you are only required to enable NTP service in Linux firewall as follows.

# firewall-cmd --permanent --add-service=ntp
success
# firewall-cmd --reload
success

Your Chrony based NTP server has been configured successfully and ready to use.

Final Thoughts

Installing a Chrony server on CentOS 8 is an excellent choice for ensuring precise and reliable time synchronization across your network. Chrony offers several advantages, including fast synchronization, robustness in dynamic environments, and efficient resource usage, making it suitable for both traditional servers and modern, mobile, or virtualized systems.

From setting up scalable AWS solutions to managing complex Linux environments, I’ve got you covered. Visit my Fiverr profile to get started.

Achieve accurate time synchronization with ease by leveraging my expertise!

What is an NTP Server in Linux?
An NTP server synchronizes system time across networked devices using the Network Time Protocol.

Which package provides NTP services in Linux?
Traditional NTP service is provided by ntp, while newer systems use chrony.

How do I check if NTP is running?
Use ntpq -p for ntpd or chronyc tracking for chronyd.

Why is time synchronization important?
It ensures accurate timestamps, prevents clock drift, and maintains security and consistency in networks.

What port does NTP use?
NTP operates on UDP port 123.

Exit mobile version