The chronyd service is the default service to synchronise time on RHEL 7.
We have two RHEL 7.0 servers available in our lab:
- srv1.rhce.local (10.8.8.71)
- srv2.rhce.local (10.8.8.72)
We are going to configure both servers srv1 and srv2 to synchronise time with our central NTP server ipa.rhce.local as well as use peer synchronisation as a backup.
SELinux set to enforcing mode.
Install package on both servers srv1 and srv2:
[ALL]# yum install -y chrony
On the server srv1, open
/etc/chrony.conf and add the line pointing to an NTP server, in our case ipa.rhce.local:
server ipa.rhce.local iburst peer srv2.rhce.local local stratum 10
The server should use peer synchronisation with the server srv2 as a backup.
The last line enables the server to fall back on the internal local hardware clock if external servers cannot be reached. Using local to say that the local clock is stratum 10 makes chrony use the local clock when no timeservers are available. This is good because it makes sure we can disconnect your server from the Internet without getting our clock screwed.
Do the same on the server srv2, but replace the peer address with the server srv1.
Enable and start the chronyd service on both servers:
[ALL]# systemctl enable chronyd && systemctl start chronyd
Ensure that an NTP based network time synchronisation is enabled:
[ALL]# timedatectl set-ntp true
[srv1]# chronyc sources 210 Number of sources = 2 MS Name/IP address Stratum Poll Reach LastRx Last sample ========================================================================== ^* ipa.rhce.local 3 6 17 3 +252us[ +335us] +/- 1523ms =? srv2.rhce.local 0 6 0 10y +0ns[ +0ns] +/- 0ns