Time is not getting synchronized between two nodes with `chrony`

13k views Asked by At

I have set up a local network chrony configuration between two nodes running SLES15 SP2. These nodes are internally connected but do not have external connectivity, I want both nodes to always have same time. I found that 2nd node is not automatically sync'ing the time from first node, it does that only when makestep is done manually. 2nd question I have is what is the time interval in which 2nd node will check 1st node if there is a change in time ?

$ node1: cat /etc/chrony.conf 
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
log measurements statistics tracking
server 127.0.0.1
allow 192.168.10.7 <----------- specific IP of the second node
local stratum 10

$ node2: cat /etc/chrony.conf 
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
log measurements statistics tracking
server 192.168.10.7 iburst

As soon as I start chrony on 2nd node or do a manual makestep, I see that 2nd node gets the time same time as first node.. But if I have chrony running on 2nd node and change 1st nodes time (through date -s command).. 2nd node does detect that there is a time difference in below output of chronic tracking, but still doesn't sync the time... I want to understand why it doesn't sync.

$node2: chronyc tracking
Reference ID : 93B22808 (FILE-1)
Stratum : 11
Ref time (UTC) : Fri Jan 29 06:08:15 2021
System time : 9182.181640625 seconds slow of NTP time
Last offset : +0.000131132 seconds
RMS offset : 305.027038574 seconds
Frequency : 1.395 ppm slow
Residual freq : +0.004 ppm
Skew : 0.061 ppm
Root delay : 0.000979753 seconds
Root dispersion : 0.000705841 seconds
Update interval : 962.1 seconds
Leap status : Normal
1

There are 1 answers

0
GPrathap On

I was able to get acceptable time diff following the below-listed steps:

Steps

  1. Install chrony in both your devices

    sudo apt install chrony
    
  2. Let's assume the server IP address 192.168.1.87 then client configuration (/etc/chrony/chrony.conf) as follows:

    server 192.168.1.87 iburst

    keyfile /etc/chrony/chrony.keys

    driftfile /var/lib/chrony/chrony.drift

    log tracking measurements statistics

    logdir /var/log/chrony

  3. Server configuration (/etc/chrony/chrony.conf), assume your client IP is 192.168.1.14

    keyfile /etc/chrony/chrony.keys

    driftfile /var/lib/chrony/chrony.drift

    log tracking measurements statistics

    logdir /var/log/chrony

    local stratum 8

    manual

    allow 192.0.0.0/24 allow 192.168.1.14

  4. Restart chrony in both computers

    sudo systemctl stop chrony

    sudo systemctl start chrony

5.1 Checking on the client-side,

sudo systemctl status chrony

 `**output**:

            июн 24 13:26:42 op-desktop systemd[1]: Starting chrony, an NTP client/server...

            июн 24 13:26:42 op-desktop chronyd[9420]: chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH +SIGND +ASYNCDNS +IPV6 -DEBUG)

            июн 24 13:26:42 op-desktop chronyd[9420]: Frequency -6.446 +/- 1.678 ppm read from /var/lib/chrony/chrony.drift

            июн 24 13:26:43 op-desktop systemd[1]: Started chrony, an NTP client/server.

            июн 24 13:26:49 op-desktop chronyd[9420]: Selected source 192.168.1.87`

5.1 chronyc tracking output:

        Reference ID    : C0A80157 (192.168.1.87)
        Stratum         : 9
        Ref time (UTC)  : Thu Jun 24 10:50:34 2021
        System time     : 0.000002018 seconds slow of NTP time
        Last offset     : -0.000000115 seconds
        RMS offset      : 0.017948076 seconds
        Frequency       : 5.491 ppm slow
        Residual freq   : +0.000 ppm
        Skew            : 0.726 ppm
        Root delay      : 0.002031475 seconds
        Root dispersion : 0.000664742 seconds
        Update interval : 65.2 seconds
        Leap status     : Normal