Chrony is an implementation of the Network Time Protocol (NTP). You can use Chrony:
# systemctl status chronyd ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) Active: active (running) since do 2020-11-12 14:44:58 CET; 1h 4min ago ....
If don't see the above then install chrony.
Installed by minimal installation.
The configuration is put in the file /etc/chrony.conf.
Open chrony.conf.
Edit it that it looks like below.
Change the server *.centos.pool.ntp.org for your area. In my case I use nl (0.nl.pool.ntp.org). Use min 4 servers and maximal 7.
[root@server4 etc]# cat chrony.conf # These servers were defined in the installation: server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst # Use public servers from the pool.ntp.org project. # Please consider joining the pool (https://www.ntppool.org/join.html). # Record the rate at which the system clock gains/losses time. driftfile /var/lib/chrony/drift # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC). rtcsync # Enable hardware timestamping on all interfaces that support it. #hwtimestamp * # Increase the minimum number of selectable sources required to adjust # the system clock. #minsources 2 # Allow NTP client access from local network. #allow 192.168.0.0/16 # Serve time even if not synchronized to a time source. #local stratum 10 # Specify file containing keys for NTP authentication. #keyfile /etc/chrony.keys # Specify directory for log files. logdir /var/log/chrony # Select which information is logged. #log measurements statistics tracking
# systemctl start chronyd # systemctl enable chronyd
To check if chrony is synchronized, make use of the tracking, sources, and sourcestats commands.
To check chrony tracking, issue the following command:
# chronyc tracking
The sources command displays information about the current time sources that chronyd is accessing.
The optional argument -v can be specified, meaning verbose. In this case, extra caption lines are shown as a reminder of the meanings of the columns.
# chronyc sources
The sourcestats command displays information about the drift rate and offset estimation process for each of the sources currently being examined by chronyd.
The optional argument -v can be specified, meaning verbose. In this case, extra caption lines are shown as a reminder of the meanings of the columns.
# chronyc sourcestats
If you want to see who is using your ntp server use:
# chronyc clients
There will be a stream of ip adresses. If you see nothing then you server is not used.
Add to the firewall rules.
# firewall-cmd --permanent --zone=public --add-port=123/udp # firewall-cmd --reload
For global acces forward port 123 udp in your modem/router to your NTP-server.