It’s about time to talk about chrony

Chrony is a versatile, lightweight, and high-performance Network Time Protocol (NTP) daemon used to synchronize system clocks in Unix-like operating systems, including Linux. It’s particularly known for being efficient on systems with intermittent network connections or variable latencies, like laptops, virtual machines, or networks with high jitter. It replaces the older ntpd daemon and related commands.

Usually, Chony is installed by default on modern Enterprise Linux systems, but you can always manually install it useing using the command  dnf install chrony -y

By default you don’t need to do much in the config file (/etc/chrony.conf) to make things work as a client.

In the config file, it will use a pool from the public NTP servers. This is the pool directive in the config file.

Pool Configuration
Pool Configuration

But you can also override this, but either setting a new pool, or swapping the pool with a server parameter. You can also have multiple servers set.

Individual custom servers
Individual custom servers

To make it a server, simply define the range of IPs that they system will be allowed to server to, with the allow parameter.

Server Allowable subnet
Server Allowable subnet

You also need to open  up the firewall, with he following commands;

sudo firewall-cmd –add-service=ntp –permanent

sudo firewall-cmd –reload

You should also make sure the service is running

sudo systemctl start chronyd

sudo systemctl enable chronyd

Then, check to make sure the service is running with the sudo systemctl status chronyd command.

Chrony Status
Chrony Status

You can see what your sources are for time, using the command chronyc sources

chronyc sources
chronyc sources

The columns are as follows:

M

This indicates the source’s mode. “^” means a server, “=” denotes a peer, and “#” signifies a locally connected reference clock.

S

This column shows the status of the time sources. Here are the symbols used:

“*” indicates the source to which chronyd is currently synchronized.

“+” signifies acceptable sources that are combined with the selected source.

“-” represents acceptable sources that are excluded by the combining algorithm.

“?” denotes sources that have lost connectivity or whose packets do not pass all tests.

“x” indicates a clock that chronyd considers a falseticker, meaning its time is inconsistent with the majority of other sources.

“~” marks a source whose time shows too much variability.

Note that the “?” condition is also displayed at startup, until at least three samples have been gathered from the source.

Name/IP address

This shows the name or the IP address of the source, or reference ID for reference clocks.

Stratum

This text explains the stratum of a source as reported in its most recent sample. A stratum 1 computer has a locally attached reference clock. A computer that synchronizes with a stratum 1 computer is classified as stratum 2. Similarly, a computer synchronized to a stratum 2 computer is designated as stratum 3, and this pattern continues onward.

Poll

This indicates the frequency at which the source is being polled, presented as a base-2 logarithm of the interval in seconds. For example, a value of 6 signifies that a measurement occurs every 64 seconds. The chronyd system automatically adjusts the polling rate based on current conditions.

Reach

The text displays the source’s reach register, which is represented as an octal number. This register consists of 8 bits and is updated with each packet received or missed from the source.

LastRx

This column displays the time elapsed since the last sample was received from the source, typically measured in seconds. Units are indicated by the letters m, h, d, or y, which stand for minutes, hours, days, or years, respectively. A value of 10 years means that no samples have been received from this source during that time.

Last sample

This column displays the offset between the local clock and the source at the time of the last measurement. The number in square brackets indicates the actual measured offset, which may be suffixed with ns (nanoseconds), us (microseconds), ms (milliseconds), or s (seconds). The number to the left of the square brackets represents the original measurement, adjusted for any changes applied to the local clock since that time. The number following the +/- indicator denotes the margin of error in the measurement. A positive offset indicates that the local clock is ahead of the source.

If you want to track the offset from local time, and the NTP servers, you can use the command chronyc tracking

chronyc tracking
chronyc tracking

Reference ID

This text refers to the reference ID and name (or IP address) of the server to which the computer is currently synchronized. If the IP address is shown as 127.127.1.1, it indicates that the computer is not synchronized with any external source and is operating in “local” mode. This local mode can be activated through the local command in chronyc or by using the local directive in the /etc/chrony.conf file (see the section on local mode).

Stratum

The stratum level shows how many hops away a computer is from a reference clock. A computer that has an attached reference clock is classified as a stratum-1 computer. For instance, if a computer is two hops away from a stratum-1 computer, it is categorized as stratum-2, meaning it synchronizes its time from the stratum-1 source.

Ref time

This is the UTC time when the last measurement from the reference source was processed.

System time

In normal operation, chronyd does not adjust the system clock by large jumps, as this can negatively impact certain application programs. Instead, it corrects any errors in the system clock by gradually speeding up or slowing down the clock until the error is eliminated. After this adjustment, it returns to the clock’s normal speed.

As a result, there can be a period where the system clock—when accessed by other programs using the gettimeofday() system call or by the date command in the shell—differs from chronyd‘s estimate of the current true time. This estimate is what it reports to NTP clients when running in server mode. The value indicated in this situation reflects the difference caused by this adjustment method.

Last offset

This is the estimated local offset from the most recent clock update.

RMS offset

This is the long-term average of the offset value.

Frequency

The “frequency” refers to how much the system’s clock would deviate over time if chronyd were not making corrections. It is measured in parts per million (ppm). For instance, a frequency of 1 ppm means that when the system’s clock believes it has advanced by 1 second, it has actually advanced by 1.000001 seconds relative to the true time.

Residual freq

This displays the “residual frequency” for the currently selected reference source. The residual frequency indicates any difference between the frequency measurements from the reference source and the frequency that is currently being used. This value may not always be zero because a smoothing procedure is applied to the frequency. Each time a measurement from the reference source is obtained, a new residual frequency is calculated. The estimated accuracy of this residual is then compared to the estimated accuracy of the existing frequency value (see the section on skew next). A weighted average is computed for the new frequency, with weights determined by these accuracies. If the measurements from the reference source follow a consistent trend, the residual frequency will gradually approach zero over time.

Skew

This text provides the estimated error limit for the frequency.

Root delay

The value represents the total network path delays to the stratum-1 computer responsible for synchronization. In some rare cases, this value may be negative. This can occur in symmetric peer arrangements where the computers’ frequencies are not aligned, and the network delay is very short compared to the turnaround time at each computer.

Root dispersion

This represents the total dispersion accumulated from all computers back to the stratum-1 computer for synchronization. Dispersion arises from factors such as system clock resolution and variations in statistical measurements.

Leap status

This is the leap status, which can be Normal, Insert second, Delete second or Not synchronized.

Hopefully this gives you a start in using this “new way” of keeping all of your servers on the same time. Questions? Please drop a note in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.