chrony
chrony is NTP server and client.
Install
$ sudo dnf install chrony
Check the version:
$ chronyd --version
chronyd (chrony) version 4.1 (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG)
$ chronyc --version
chronyc (chrony) version 4.1 (+READLINE +SECHASH +IPV6 +DEBUG)
$ sudo apt install chrony
This will remove the original systemd-timesyncd.
Check the version:
$ chronyd --version
chronyd (chrony) version 4.2 (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG)
ubuntu@las0:~$ chronyc --version
chronyc (chrony) version 4.2 (+READLINE +SECHASH +IPV6 -DEBUG)
Configure
Server
Edit file /etc/chrony.conf:
#minsources 2
# Allow NTP client access from local network.
-#allow 192.168.0.0/16
+allow 172.20.0.0/16
# Serve time even if not synchronized to a time source.
#local stratum 10
Edit file /etc/chrony/chrony.conf:
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usable directives.
+
+allow 10.225.4.0/24
# Include configuration files found in /etc/chrony/conf.d.
confdir /etc/chrony/conf.d
Client
Edit file /etc/chrony.conf:
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
-pool 2.centos.pool.ntp.org iburst
+#pool 2.centos.pool.ntp.org iburst
+Server las0
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
Enable the service on both servers and clients:
$ sudo systemctl enable chronyd --now
Usage
List servers:
$ chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* las0 2 10 377 709 -58us[ -79us] +/- 9075us
List clients:
$ sudo chronyc clients
Hostname NTP Drop Int IntL Last Cmd Drop Int Last
===============================================================================
las1 52 0 10 - 810 0 0 - -
las2 64 0 10 - 958 0 0 - -
localhost 0 0 - - - 6 0 5 14