Classic NTP is replaced by Chrony and CentOS / RHEL7 is no longer use it, instead it’s default is Chrony. The Chrony is a different implementation of the network time protocol (NTP) than the network time protocol daemon (ntpd) that is able to synchronize the system clock faster and with better accuracy than ntpd. Here is little comparison between Chronyd and NTPd
Things chrony can do better than ntp:
- chrony can perform usefully in an environment where access to the time reference is intermittent. ntp needs regular polling of the reference to work well.
- chrony can usually synchronise the clock faster and with better time accuracy.
- chrony quickly adapts to sudden changes in the rate of the clock (e.g. due to changes in the temperature of the crystal oscillator). ntp may need a long time to settle down again.
- chrony can perform well even when the network is congested for longer periods of time.
- chrony in the default configuration never steps the time to not upset other running programs. ntp can be configured to never step the time too, but in that case it has to use a different means of adjusting the clock (daemon loop instead of kernel discipline), which may have a negative effect on accuracy of the clock.
- chrony can adjust the rate of the clock in a larger range, which allows it to operate even on machines with broken or unstable clock (e.g. in some virtual machines).
- chrony is smaller, it uses less memory and it wakes up the CPU only when necessary, which is better for power saving.
Things chrony can do that ntp can’t:
- chrony provides support for isolated networks whether the only method of time correction is manual entry (e.g. by the administrator looking at a clock). chrony can look at the errors corrected at different updates to work out the rate at which the computer gains or loses time, and use this estimate to trim the computer clock subsequently.
- chrony provides support to work out the gain or loss rate of the real-time clock, i.e. the clock that maintains the time when the computer is turned off. It can use this data when the system boots to set the system time from a corrected version of the real-time clock. These real-time clock facilities are only available on Linux, so far.
Things ntp can do that chrony can’t:
- ntp supports all operating modes from RFC 5905, including broadcast, multicast, and manycast server/client. However, the broadcast and multicast modes are inherently less accurate and less secure (even with authentication) than the ordinary server/client mode and should generally be avoided.
- ntp supports the Autokey protocol (RFC 5906) to authenticate servers with public-key cryptography. Note that the protocol has been shown to be insecure and it will be probably replaced with an implementation of the Network Time Security (NTS) specification.
- ntp has been ported to more operating systems.
- ntp includes a large number of reference clock drivers. chrony relies on other programs (e.g. gpsd) to access the timing data via the SHM or SOCK driver.
So let’s look at how to Configure NTP server (Chrony) on CentOS / RHEL7
1) Install Chrony
1 |
[root@localhost ~]# yum -y install chrony |
2) Change servers for synchronization
this step is optional, you can skip if do not want to customize NTP servers
1 |
[root@localhost ~]#vim /etc/chrony.conf |
then commented out default servers and add your own NTP servers .
1 2 3 4 |
#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 |
3) Disable NTP server and start chronyd
1 2 3 |
[root@localhost ~]#systemctl mask ntpd [root@localhost ~]#systemctl start chronyd [root@localhost ~]#systemctl enable chronyd |
4) Verify NTP sources
1 |
[root@localhost ~]# chronyc sources -v |
5) Verify NTP time synchronization
1 2 3 4 5 6 7 8 9 10 |
[root@localhost ~]# timedatectl Local time: Fri 2016-12-23 08:18:49 IST Universal time: Fri 2016-12-23 02:48:49 UTC RTC time: Fri 2016-12-23 02:48:48 Time zone: Asia/Colombo (IST, +0530) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a [root@localhost ~]# |
Have a Nice day 😀