Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
chronyd with hardware timestamping
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
widlokm
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2007
Posts: 75
Location: Poland

PostPosted: Tue Mar 21, 2023 5:44 pm    Post subject: chronyd with hardware timestamping Reply with quote

Hello,
I would like to have machines on my local network synchronized with PTP using ptp4l and chrony. Basically the configuration is like this:
Machine 1 - connected to internet, takes time from world servers (pl.pool.ntp.org in my case). I want this one to be PTP master clock for my local network (192.168.70.xxx). It runs chrony, ptp4l, phc2sys:
chrony.conf
Code:
pool pl.pool.ntp.org iburst
driftfile /var/lib/chrony/dift
makestep 1.0 3
rtconutc
hwtimestamp *
allow 192.168.70

ptp4l and phc2sys are started as system services with options:
Code:
ptp4l -i enp0s25
phc2sys -a -r -r -u60


Machine 2 - connected to local network, gets time from machine 1, running chronyd and ptp4l:
chrony.conf:
Code:
server 192.168.70.10 iburst prefer xleave minpoll 0 maxpoll 3
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtconutc
hwtimestamp *

ptp4l options:
Code:
ptp4l -i enp0s25


The problem is that on machine 2 chronyd must be started after all network interfaces and machine 1 is up. If it is started before or if network is down for a while (disconnected cable for few seconds) it never gets full hardware timestamps. For example if I turn all machines off, then on "chronyc ntpdata" on machine 2 shows:
Code:
TX timestamping : Hardware
RX timestamping : Kernel

However just after "rc-service chronyd restart" it is ok:
Code:
TX timestamping : Hardware
RX timestamping : Hardware

Then disconnect network for a second, connect it, and it switches to "RX timestamping : Kernel". Again after "rc-service chronyd restart" I have full hardware timestamping back.

What I am missing here? It seems that chronyd has to be restarted after every network fail, is that a bug?
Thanks in advance,
Michael W.
Back to top
View user's profile Send private message
widlokm
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2007
Posts: 75
Location: Poland

PostPosted: Thu Mar 23, 2023 10:35 am    Post subject: Reply with quote

Seems that I found the problems:

1. Chrony needs to know about network state change. If a server is "offline" then you need to do "chronyc onlie" to restart it.
2. ptp4l and phc2sys are not needed in my setup. Chrony can manage offset in NIC clocks by itself. ptp4l is only needed if you have something that can be a accurate time source over PTP.
3. HW timestamps in chrony and PTP are 2 different things (I did not knew about it). It seems problematic to mix 2 on the same interface.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum