The Network Time Protocol or NTP is essential for synchronizing system clocks across your environment. Having a reliable and accurate time service is not only important for many different applications but for logging and auditing as well. In RHEL 8, Chrony is used for implementing NTP. In Part 1, we will review setting this service up as a client and look at the basic functionality of the chronyc command to interact with the chrony daemon, chronyd.
Client Setup
Install the Chrony package
# dnf install chrony
Enable and start the chrony daemon
# systemctl enable chronyd # systemctl start chronyd
Verify NTP is working by using the chronyc command to display the current time sources. You can use the -v verbose flag to display a description for each column
# chronyc sources 210 Number of sources = 4 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^+ voipmonitor.wci.com 2 6 17 1 -2428us[-3365us] +/- 85ms ^* clock.trit.net 2 6 17 1 -362us[-1299us] +/- 94ms ^- radio-sunshine.org 2 6 17 1 -5644us[-5644us] +/- 177ms ^* time.cloudflare.com 2 6 17 0 +12ms[ +12ms] +/- 205ms
As you can see, Chrony is already configured to a pool of NTP sources. This is enabled by default within the configuration file /etc/chrony.conf.
# grep ^server /etc/chrony.conf server 0.rhel.pool.ntp.org server 1.rhel.pool.ntp.org server 2.rhel.pool.ntp.org server 3.rhel.pool.ntp.org
Add your own NTP Server
Edit the /etc/chrony.conf configuration file to add your own local time server. You can specify the ip or dns name. (See Part 2 for Server setup)
# vi /etc/chrony.conf server t1.networklogician.com
Restart the Chrony daemon and verify the new source
# systemctl restart chronyd # chronyc sources 210 Number of sources = 5 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? t1.networklogician.com 1 6 1 27 -3350us[-1785us] +/- 53ms ^- voipmonitor.wci.com 2 6 17 21 +2542us[+2542us] +/- 68ms ^- clock.trit.net 3 6 17 22 -6294us[-9084us] +/- 147ms ^+ radio-sunshine.org 2 6 17 21 -3355us[-6145us] +/- 75ms ^* time.cloudflare.com 3 6 17 21 +1421us[-1369us] +/- 36ms
Other monitoring options that are useful to keep in mind when using the chronyc command are – rtcdata, smoothing, sources, sourcestats and tracking. You can review the manpage for a complete list or run help from the interactive terminal you get by running chronyc without options.
# chronyc chronyc> help
In Part 2, we will cover the steps to setup the Chrony server and some of the main configuration options available within /etc/chrony.conf.