5.2. Client

Attention

We define the local server as only available time server. A wrong system time can cause many problems. So make sure, the local NTP server is available.

5.2.1. Setting Up Chrony

$ sudo apt install chrony

Note

Besides from the highlighted lines, the following configuration for chrony should be equivalent to the default configuration.

Listing 5.2 /etc/chrony/chrony.conf
 1# Welcome to the chrony configuration file. See chrony.conf(5) for more
 2# information about usable directives.
 3
 4confdir /etc/chrony/conf.d
 5
 6# Use time sources from DHCP.
 7sourcedir /run/chrony-dhcp
 8
 9# Use NTP sources found in /etc/chrony/sources.d.
10sourcedir /etc/chrony/sources.d
11
12# This directive specify the location of the file containing ID/key pairs for
13# NTP authentication.
14keyfile /etc/chrony/chrony.keys
15
16# This directive specify the file into which chronyd will store the rate
17# information.
18driftfile /var/lib/chrony/chrony.drift
19
20# Save NTS keys and cookies.
21ntsdumpdir /var/lib/chrony
22
23# Log files location.
24logdir /var/log/chrony
25
26# Stop bad estimates upsetting machine clock.
27maxupdateskew 100.0
28
29# This directive enables kernel synchronisation (every 11 minutes) of the
30# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
31rtcsync
32
33# Step the system clock instead of slewing it if the adjustment is larger than
34# one second, but only in the first three clock updates.
35makestep 1 3
36
37# Get TAI-UTC offset and leap seconds from the system tz database.
38# This directive must be commented out when using time sources serving
39# leap-smeared time.
40leapsectz right/UTC
41
42server 192.168.0.115 iburst
$ sudo systemctl restart chrony

5.2.2. Check Clock Offset

$ chronyc tracking
Reference ID    : C0A80073 (192.168.0.115)
Stratum         : 3
Ref time (UTC)  : Wed Jan 24 11:53:55 2024
System time     : 0.000000034 seconds fast of NTP time
Last offset     : -0.000031117 seconds
RMS offset      : 0.000035274 seconds
Frequency       : 11.621 ppm fast
Residual freq   : -0.023 ppm
Skew            : 0.543 ppm
Root delay      : 0.016247051 seconds
Root dispersion : 0.000187333 seconds
Update interval : 64.8 seconds
Leap status     : Normal