Install Chrony NTP Server on CentOS / RHEL 8 - CentLinux

Latest

Sunday, 11 October 2020

Install Chrony NTP Server on CentOS / RHEL 8

Install Chrony NTP Server on CentOS 8

Chrony is the default NTP client / server software in Linux. In this article, you will learn how to install and configure a NTP server on CentOS / RHEL 8.

 

Table of Contents:

 

What is NTP Server? :

NTP stands for Network Time Protocol. It is an Internet protocol used to synchronize the clocks of computer systems to some reference time.

A Time Server is a computer system that provides the time synchronization service to network devices by means of the NTP protocol.

 

What is Chrony? :

Chrony is the new NTP client / server software in CentOS / RHEL 7 or later. It replaces the legacy NTP software.

Chrony is very simple to configure and its client component is worked without any custom configurations on most situations. Whereas, the time server configurations are also simple and straight forward.

 

Environment Specification:

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

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 1 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.2
  • Hostname – ntp-server.centlinux.com
  • IP Address - 192.168.116.206 /24

 

Installing Chrony Software Package 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 / RHEL 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.

 

Conclusion:

In this article, you have learned about installation and configuration of Chrony based NTP server on CentOS / RHEL 8.

No comments:

Post a Comment