ntp: update NTP-over-PTP support

Update the support for NTP over PTP to the latest specification
(currently in the RFC editor queue). Switch the NTP TLV to the
organization-specific TLV using the IANA OUI and assigned TLV
subtype 0x1. The Network Correction extension field has been
assigned type 0x10A. The extfield option accepts F324 as an alias
for 10A to not break existing configurations. Drop the experimental
status.
This commit is contained in:
Miroslav Lichvar
2025-11-26 12:14:08 +01:00
parent 73f6657dfd
commit 007a1ae4fe
12 changed files with 94 additions and 82 deletions

View File

@@ -352,6 +352,21 @@ This option can be used multiple times to enable multiple extension fields.
+
The following extension fields are supported:
+
_10A_::::
The Network Correction extension field enabling the use of the Precision Time
Protocol (PTP) corrections in NTP-over-PTP messages updated by
one-step end-to-end transparent clocks (e.g. network switches). It can
significantly improve the accuracy and stability of the synchronisation. NTP
over PTP needs to be enabled by the <<ptpport,*ptpport*>> directive and setting
the *port* option to the PTP port. The corrections are applied only to NTP
measurements with HW timestamps (enabled by the <<hwtimestamp,*hwtimestamp*>>
directive).
+
This field should be enabled only for servers known to be running *chronyd*
version 4.9 or later, or other implementations supporting the Network
Correction extension field. *chronyd* versions 4.5-4.8 supported an experimental
version of this extension field (type _F324_), which is no longer supported,
but type _F324_ is accepted as an alias for _10A_.
_F323_::::
An experimental extension field to enable several improvements that were
proposed for the next version of the NTP protocol (NTPv5). The field contains
@@ -359,16 +374,6 @@ root delay and dispersion in higher resolution and a monotonic receive
timestamp, which enables a frequency transfer between the server and client to
significantly improve stability of the synchronisation. This field should be
enabled only for servers known to be running *chronyd* version 4.2 or later.
_F324_::::
An experimental extension field to enable the use of the Precision Time
Protocol (PTP) correction field in NTP-over-PTP messages updated by one-step
end-to-end transparent clocks in network switches and routers to significantly
improve accuracy and stability of the synchronisation. NTP-over-PTP can be
enabled by the <<ptpport,*ptpport*>> directive and setting the *port* option to
the PTP port. The corrections are applied only to NTP measurements with HW
timestamps (enabled by the <<hwtimestamp,*hwtimestamp*>> directive). This
field should be enabled only for servers known to be running *chronyd* version
4.5 or later.
*ipv4*:::
*ipv6*:::
These options force *chronyd* to use only IPv4 or IPv6 addresses respectively
@@ -3000,29 +3005,30 @@ Setting this directive to _/_ disables writing and checking of the PID file.
[[ptpport]]*ptpport* _port_::
The *ptpport* directive enables *chronyd* to send and receive NTP messages
contained in PTP event messages (NTP-over-PTP) to enable hardware timestamping
contained in PTP event messages (NTP over PTP) to enable hardware timestamping
on NICs that cannot timestamp NTP packets, but can timestamp unicast PTP
packets, and also use corrections provided by PTP one-step end-to-end
transparent clocks in network switches and routers. The port recognized by the
NICs and PTP transparent clocks is 319 (PTP event port). The default value is 0
(disabled).
+
The NTP-over-PTP support is experimental. The protocol and configuration can
change in future. It should be used only in local networks.
Support for NTP over PTP was added in *chronyd* version 4.9.
Versions 4.2-4.8 supported an experimental version of the transport, which is
not compatible with the final specification.
+
The PTP port will be open even if *chronyd* is not configured to operate as a
server or client. The directive does not change the default protocol of
specified NTP sources. Each NTP source that should use NTP-over-PTP needs to
specified NTP sources. Each NTP source that should use NTP over PTP needs to
be specified with the *port* option set to the PTP port. To actually enable
hardware timestamping on NICs that can timestamp PTP packets only, the
*rxfilter* option of the *hwtimestamp* directive needs to be set to _ptp_. The
extension field _F324_ needs to be enabled to use the corrections provided by
extension field _10A_ needs to be enabled to use the corrections provided by
the PTP transparent clocks.
+
An example of client configuration is:
+
----
server ntp1.example.net minpoll 0 maxpoll 0 xleave port 319 extfield F324
server ntp1.example.net minpoll 0 maxpoll 0 xleave port 319 extfield 10A
hwtimestamp * rxfilter ptp
ptpport 319
----

View File

@@ -401,11 +401,12 @@ server ntp.local minpoll 0 maxpoll 0 xleave extfield F323
Since version 4.5, `chronyd` can apply corrections from PTP one-step end-to-end
transparent clocks (e.g. network switches) to significantly improve accuracy of
synchronisation in local networks. It requires the PTP transport to be enabled
by the `ptpport` directive, HW timestamping, and the `extfield F324` option.
For example:
by the `ptpport` directive, `port` option, HW timestamping, and the `extfield
F324` option (in versions 4.5-4.8) or `extfield 10A` option (version 4.9 and
later). For example:
----
server ntp.local minpoll -4 maxpoll -4 xleave extfield F323 extfield F324 port 319
server ntp.local minpoll -4 maxpoll -4 xleave extfield F323 extfield 10A port 319
ptpport 319
hwtimestamp eth0 minpoll -4
----
@@ -668,13 +669,15 @@ packets (enabled by the `hwtimestamp` directive) if the NIC can timestamp other
packets than PTP, which is usually the case at least for transmitted packets.
The `ethtool -T` command can be used to verify the timestamping support.
As an experimental feature added in version 4.2, `chrony` can use PTP as a
transport for NTP messages (NTP over PTP) to enable hardware timestamping on
hardware which can timestamp PTP packets only. It can be enabled by the
`ptpport` directive. Since version 4.5, `chrony` can also apply corrections
provided by PTP one-step end-to-end transparent clocks to reach the accuracy of
ordinary PTP clocks. The application of PTP corrections can be enabled by the
`extfield F324` option.
As an experimental feature added in version 4.2, and fully supported since
version 4.9, `chrony` can use PTP as a transport for NTP messages (NTP over
PTP) to enable hardware timestamping on hardware which can timestamp only PTP
packets. NTP over PTP can be enabled by the `ptpport` directive and setting the
`port` option to the PTP port 319. Since version 4.5, `chrony` can also apply
corrections provided by PTP one-step end-to-end transparent clocks (e.g.
network switches) to reach the accuracy of ordinary PTP clocks. The application
of PTP corrections can be enabled by the `extfield F324` option in versions
before 4.9, or `extfield 10A` in later versions.
=== How can I avoid using wrong PHC refclock?