In this tutorial we will learn:
- How To Install NTP Server On CentOS 8 / CentOS 7 (CHRONY SUITE)
- How to configure Chrony as NTP server
Introduction to the Chrony Suite
Chrony is an implementation of the Network Time Protocol (NTP). You can use Chrony:
to synchronize the system clock with NTP servers,
to synchronize the system clock with a reference clock, for example a GPS receiver,
to synchronize the system clock with a manual time input
chronyd can usually synchronize the clock faster and with better accuracy.
chronyd can work well in an environment where access to the time reference is intermittent, whereas ntpd needs regular polling of time reference to work well, also chronyd can perform well even when the network is congested for longer periods of time.
Install Chrony On CentOS 8 / CentOS 7 / RHEL
To install Chrony Suite execute DNF package manager:
# dnf install chrony
Example output:
After Chrony Suite successful install lets start Chrony and Enable Chrony NTP daemon to start after boot:
# systemctl start chronyd
# systemctl enable chronyd
To check Chrony status use:
# systemctl status chronyd
Configure Chrony as NTP server
By default, chronyd does not operate as an NTP server. So, we need to add an allow directive to the chrony.conf file in order for chronyd to open the server NTP port and respond to client requests.
Edit chrony.conf with any editor
# nano /etc/chrony.conf
Find out allow configuration directive and uncomment it. Then network address from which the clients are allowed to connect to the NTP server.
Save and close config file, and then restart Chrony NTP daemon:
# systemctl start chronyd
If you want to Allow access to NTP server from multiple networks your chrony.conf ALLOW section should be like:
allow aaa.aaa.aaa.aaa/16
allow bbb.bbb.bbb.bbb/21
allow ccc.ccc.ccc.ccc/32
NTP Port Firewall Rule
Finlay don’t forget open NTP port on Linux firewall.
NTP protocol uses UDP port. So you need open UDP port 123 network address from which the clients are allowed to connect to the NTP server.
How To Check Chrony NTP Server
Check Chrony NTP server functionality
To check new installed NTP server functionality from client machine you can execute ntpdate command:
# ntpdate -u Your_ChronyNTP_Server
If everything is correct you will receive message like this:
26 Jun 00:03:16 ntpdate[15685]: adjust time server ntpserver.loc offset 0.005344 sec
Show the Chrony Server Current Time Sources
To check the Chrony NTP Server Current Time Sources run:
# chronyc sources
Example output:
Congrats! We just learn How to Install NTP Server CentOS 8 /RHEL, Configure and test NTP server