Chapter 31. Using Chrony
The following sections describe how to install, start, and stop
chronyd, and how to check if
chrony is synchronized. Sections also describe how to manually adjust System Clock.
31.1. Managing chrony
The following procedure describes how to install, start, stop, and check the status of
The chrony suite is installed by default on Red Hat Enterprise Linux. To ensure that it is, run the following command as
# yum install chrony
The default location for the chrony daemon is
/usr/sbin/chronyd. The command line utility will be installed to
To check the status of
chronyd, issue the following command:
systemctl status chronydchronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled) Active: active (running) since Wed 2013-06-12 22:23:16 CEST; 11h ago
chronyd, issue the following command as
# systemctl start chronyd
chronydstarts automatically at system start, issue the following command as
# systemctl enable chronyd
chronyd, issue the following command as
# systemctl stop chronyd
chronydfrom starting automatically at system start, issue the following command as
# systemctl disable chronyd
31.2. Checking if chrony is synchronized
The following procedure describes how to check if chrony is synchronized with the use of the
To check chrony tracking, issue the following command:
chronyc trackingReference ID : CB00710F (foo.example.net) Stratum : 3 Ref time (UTC) : Fri Jan 27 09:49:17 2017 System time : 0.000006523 seconds slow of NTP time Last offset : -0.000006747 seconds RMS offset : 0.000035822 seconds Frequency : 3.225 ppm slow Residual freq : 0.000 ppm Skew : 0.129 ppm Root delay : 0.013639022 seconds Root dispersion : 0.001100737 seconds Update interval : 64.2 seconds Leap status : Normal
The sources command displays information about the current time sources that
chronydis accessing. To check chrony sources, issue the following command:
$ chronyc sources 210 Number of sources = 3 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== #* GPS0 0 4 377 11 -479ns[ -621ns] /- 134ns ^? a.b.c 2 6 377 23 -923us[ -924us] +/- 43ms ^ d.e.f 1 6 377 21 -2629us[-2619us] +/- 86ms
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.
sourcestatscommand displays information about the drift rate and offset estimation process for each of the sources currently being examined by
chronyd. To check chrony source statistics, issue the following command:
chronyc sourcestats210 Number of sources = 1 Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev =============================================================================== abc.def.ghi 11 5 46m -0.001 0.045 1us 25us
The optional argument
-vcan be specified, meaning verbose. In this case, extra caption lines are shown as a reminder of the meanings of the columns.
31.3. Manually adjusting the System Clock
The following procedure describes how to manually adjust the System Clock.
To step the system clock immediately, bypassing any adjustments in progress by slewing, issue the following command as
# chronyc makestep
rtcfile directive is used, the real-time clock should not be manually adjusted. Random adjustments would interfere with chrony's need to measure the rate at which the real-time clock drifts.
31.4. Setting up chrony for a system in an isolated network
For a network that is never connected to the Internet, one computer is selected to be the master timeserver. The other computers are either direct clients of the master, or clients of clients. On the master, the drift file must be manually set with the average rate of drift of the system clock. If the master is rebooted, it will obtain the time from surrounding systems and calculate an average to set its system clock. Thereafter it resumes applying adjustments based on the drift file. The drift file will be updated automatically when the
settime command is used.
The following procedure describes how to set up chrony for asystem in an isolated network.
On the system selected to be the master, using a text editor running as
driftfile /var/lib/chrony/drift commandkey 1 keyfile /etc/chrony.keys initstepslew 10 client1 client3 client6 local stratum 8 manual allow 192.0.2.0
192.0.2.0is the network or subnet address from which the clients are allowed to connect.
On the systems selected to be direct clients of the master, using a text editor running as
root, edit the
server master driftfile /var/lib/chrony/drift logdir /var/log/chrony log measurements statistics tracking keyfile /etc/chrony.keys commandkey 24 local stratum 10 initstepslew 20 master allow 192.0.2.123
192.0.2.123is the address of the master, and
masteris the host name of the master. Clients with this configuration will resynchronize the master if it restarts.
On the client systems which are not to be direct clients of the master, the
/etc/chrony.conf file should be the same except that the
allow directives should be omitted.
In an isolated network, you can also use the
local directive that enables a local reference mode, which allows
chronyd operating as an
NTP server to appear synchronized to real time, even when it was never synchronized or the last update of the clock happened a long time ago.
To allow multiple servers in the network to use the same local configuration and to be synchronized to one another, without confusing clients that poll more than one server, use the
orphan option of the
local directive which enables the orphan mode. Each server needs to be configured to poll all other servers with
local. This ensures that only the server with the smallest reference ID has the local reference active and other servers are synchronized to it. When the server fails, another one will take over.
31.5. Additional resources
- Frequently Asked Questions