RHCSA - Part16 - ntp client: chrony
Install chrony:
# yum install -y chrony
Configure chrony to synchronize time with a local ntp server (local stratum 10
is used to serve time even if it is not synchronized to a time source):
# vi /etc/chrony.conf [...] #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 server ntp.example.local iburst local stratum 10 [...]
Configure ntp peer:
# vi /etc/chrony.conf [...] peer srv1.example.local [...]
Allow ntp on the firewall (to allow peers to synchronize):
# firewall-cmd --permanent --add-service=ntp
# firewall-cmd --reload
or
# firewall-cmd --permanent --add-port=123/udp
# firewall-cmd --reload
Restart chronyd:
# systemctl restart chronyd
Check:
# chronyc sources
# timedatectl
If timedatectl displays NTP enabled: no
, then, enable it manually:
# timedatectl set-ntp true