[SOLVED] chrony / Time Sync between 2 nodes

dodup

New Member
Sep 20, 2023
3
0
1
Hello guys, I'm new to the forum.

I have a cluster with 2 proxmox 7.2-3 nodes.

I'm trying to achieve time synchronisation between the 2 nodes using chrony. It doesn't need to be the exact "real" time, but time between the 2 must be the same.

Node 1: Acting as the "NTP Server" 192.168.0.5.
In chrony.conf I added "allow 192.168.0.0/24"
Running chronyc clients, I can see the client connected, which is my node #2 that I want it to sync with this node #1.
Output:
Code:
Hostname                      NTP   Drop Int IntL Last     Cmd   Drop Int  Last
===============================================================================
192.168.0.2                    35      0   7   -    34       0      0   -     -

Node 2: Acting as the "NTP Client" 192.168.0.2.
In chrony.conf I added "allow 192.168.0.0/24"
I added the server source using echo 'server 192.168.0.5 iburst' > /etc/chrony/sources.d/local-ntp-server.sources

Running systemctl status chrony.service, the output is:
Code:
● chrony.service - chrony, an NTP client/server
     Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-09-20 08:18:42 EDT; 8min ago
       Docs: man:chronyd(8)
             man:chronyc(1)
             man:chrony.conf(5)
    Process: 451170 ExecStart=/usr/sbin/chronyd $DAEMON_OPTS (code=exited, status=0/SUCCESS)
   Main PID: 451172 (chronyd)
      Tasks: 2 (limit: 38294)
     Memory: 1.2M
        CPU: 30ms
     CGroup: /system.slice/chrony.service
             ├─451172 /usr/sbin/chronyd -F 1
             └─451173 /usr/sbin/chronyd -F 1

Sep 20 08:18:42 hypervisor systemd[1]: Starting chrony, an NTP client/server...
Sep 20 08:18:42 hypervisor chronyd[451172]: chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG)
Sep 20 08:18:42 hypervisor chronyd[451172]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/chrony.drift
Sep 20 08:18:42 hypervisor chronyd[451172]: Using right/UTC timezone to obtain leap second data
Sep 20 08:18:42 hypervisor chronyd[451172]: Loaded seccomp filter
Sep 20 08:18:42 hypervisor systemd[1]: Started chrony, an NTP client/server.

Using chronyc tracking, I get:
Code:
Reference ID    : 00000000 ()
Stratum         : 0
Ref time (UTC)  : Thu Jan 01 00:00:00 1970
System time     : 0.000000000 seconds fast of NTP time
Last offset     : +0.000000000 seconds
RMS offset      : 0.000000000 seconds
Frequency       : 0.000 ppm slow
Residual freq   : +0.000 ppm
Skew            : 0.000 ppm
Root delay      : 1.000000000 seconds
Root dispersion : 1.000000000 seconds
Update interval : 0.0 seconds
Leap status     : Not synchronised

Running chronyc sources, I get:
Code:
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? 192.168.0.5                   0   7     0     -     +0ns[   +0ns] +/-    0ns

Running chronyc activity, I get:
Code:
200 OK
1 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
8 sources with unknown address

Seems they are connected, but doesn't sync over chrony. I think I'm missing something, but don't know what.

Note that in both case I've ran the command systemctl restart chronyd and on the "client" node, also the command chronyc reload sources.

Thanks for your help !
 
You have no reference clock and aren't synced to an Internet time source, correct? By default that situation means that the server reports itself as not synchronized so the clients won't use it. There is a directive "local" that you can use on the server side to work around this for cases where you don't care about the actual time. See "man crony.conf" for details.
 
Hi BobhWasatch,
Thanks for the reply!
I'm not too familiar with the directives, but I found what you are referring too in the manual of the chrony.conf.
I added local stratum 10 orphan distance 0.1 in my chrony.conf file, but it doesn't seems to have changed anything.
Is there a way to know if I'm synchronized to the clients?
Thanks,
 
The output of "chronyc sources" on the client will tell you if the client is synchronized. "chronyc sources -v" will explain the meaning of each field. In paticular you want to look at the S column and the Reach column. Reach is in octal and sets one bit each time the client gets a response. It should eventually reach 377. If not something might be blocking packets like a firewall.

Also be sure to restart chrony on the server after changing the config file.
 
Last edited:
Hi BobhWasatch,
Thank you so much, seems to my Synchronizing now with the local directive, I needed to restart the service on the client side. Now if I manually change the time on the server, the client will follow within a couple of seconds.
Running chronyc sources on the client show that it's synced.
Code:
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.0.5                  10  10   377   130  -3274ns[-2957ns] +/-   62us
Thanks again!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!