NTP messages can now ride inside PTP packets under RFC 10030

In short

0x010A the new NTP extension field type; About 1/4 ns resolution of the 64-bit correction value; 28 octets size of the field in NTPv4, with 16 of padding; 123 default PTP domain number for NTP over PTP

Two clock protocols, one gap

NTP is the internet's everyday clock protocol: a client and server swap timestamps over UDP and work out the clock error and network delay (our summary). The RFC says NTP does not need hardware timestamping, but implementations can use it when it exists, to avoid software, processing and queueing delays.

PTP was designed for highly accurate synchronisation in local networks. It relies on hardware timestamping in every device involved: network cards, switches and routers. That hardware writes the time at the moment a packet crosses the wire, so software delays drop out of the measurement.

The RFC names two obstacles that keep NTP from using that hardware.

1. Cards that only stamp PTP. Some network interface cards can give receive timestamps only at a limited rate, not at the full rate the link could carry. To avoid missing timestamps under heavy traffic, the card has a filter that captures a time only for packets that need it. The RFC says the filter can usually be set for PTP transports, and sometimes for the PTP message type, "but it typically cannot be configured to timestamp NTP messages sent to the UDP port 123".

2. Switches that do not help. A PTP device in the network can be a boundary clock or a transparent clock. A transparent clock is simple: it measures how long it took to forward a PTP packet and writes that delay into the packet's correction field (one-step mode) or into a later packet (two-step mode). Plain NTP packets get no such treatment.

What RFC 10030 specifies

The fix is a wrapper. The RFC defines a new type-length-value (TLV) block for PTP that holds an NTP message in client, server or symmetric mode. The PTP message must be a unicast event message, because that is the kind that gets hardware timestamps and transparent-clock corrections. NTP broadcast mode is not supported.

Other rules in section 2:

The RFC says NTP over PTP does not need other PTP clocks on the network and does not disrupt them if they are there. A host can use PTP for synchronisation in one domain and carry NTP in another at the same time.

What does the network correction field do?

The server learns the transparent-clock delay of the client's request, but only the client can use it. So section 3 adds an NTP extension field, type 0x010A, that the server puts in its response to say what correction the request collected. The response's own correction is already in its PTP header.

The value is the sum of the PTP corrections from the transparent clocks plus the time to receive the packet, which is packet length including the frame check sequence divided by the link speed. Including the receive time keeps the correction symmetric when the client and server connect at different link speeds. The RFC explains that the receive duration cancels out the shift from the PTP receive timestamp, which marks the start of reception, to the NTP receive timestamp, which marks the end.

The field uses the 64-bit NTP timestamp format, with a resolution of about a quarter of a nanosecond. The PTP header uses a different format, 64-bit nanoseconds plus a 16-bit fraction. In NTPv4 the field is 28 octets: the type, length and 8-byte value, plus 16 octets of padding to satisfy RFC 7822.

With both corrections in hand, the client adjusts what it measured:

Here nc is the network correction of the request (rq) or response (rs), dur is the packet's transmit or receive duration, and freq_tc is the maximum assumed frequency error of transparent clocks. The RFC gives 100 parts per million as an example. The corrected values must not be accepted if the corrected delay or either correction is negative.

In plain terms (ours): the switches tell the client how much of the round trip was spent inside them, so it can subtract that.

Why not just use PTP?

Section 1.1 argues that NTP in client-server mode keeps real advantages even over a PTP transport: its existing security (such as Network Time Security) still works, a client can use several servers so one failure does not disrupt a whole domain, it copes better with networks lacking full PTP support, and it gives clients an estimate of the maximum clock error. The RFC says PTP unicast "allows an almost-infinite traffic amplification".

It also states the cost: a server's transmit timestamping rate grows with the number of clients, so a server limited by its hardware cannot serve as many clients at high accuracy as PTP multicast can. The RFC says that with one-step end-to-end transparent clocks, NTP clients can reach "the same or better accuracy" than PTP clocks. It does not back that with measurements.

Security limits

The corrections written by transparent clocks cannot be authenticated, and an on-path attacker can alter them. The RFC says clients accept only corrections smaller than the measured delay, so the impact is "comparable to the impact of delaying unmodified NTP messages". It also notes that PTP transport stops NTP clients from randomising their source port (RFC 9109), because requests and responses must use the PTP port to get hardware timestamps and corrections.

Terms in plain English

Where things stand

RFC 10030 is a Standards Track document, which the RFC says represents IETF consensus and was approved by the Internet Engineering Steering Group. IANA has already created the new registry and the 0x010A field entry. We did not read any implementation or test results, so how much accuracy real networks gain is not shown here.

Sources

Sources

Related stories

More from Wi-Fi Wizards

All stories from Wi-Fi Wizards