<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC5905 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5905.xml">
<!ENTITY RFC8915 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8915.xml">
<!ENTITY RFC9109 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9109.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="std" docName="draft-ietf-ntp-over-ptp-00" ipr="trust200902">
  <front>
    <title>NTP Over PTP</title>

    <author fullname="Miroslav Lichvar" initials="M." surname="Lichvar">
      <organization>Red Hat</organization>
      <address>
        <postal>
          <street>Purkynova 115</street>
          <city>Brno</city>
          <region></region>
          <code>612 00</code>
          <country>Czech Republic</country>
        </postal>
        <email>mlichvar@redhat.com</email>
      </address>
    </author>

    <date year="2023" month="Jun" day="22"/>

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>NTP</keyword>

    <abstract>
      <t>This document specifies a transport for the Network Time Protocol
        (NTP) client-server and symmetric modes using the Precision Time
        Protocol (PTP) to enable hardware timestamping on hardware that can
        timestamp PTP messages but not NTP messages.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The <xref target="IEEE1588">Precision Time Protocol (PTP)</xref> was
        designed for highly accurate synchronization of clocks in a network. It
        relies on hardware timestamping supported in network devices (e.g.
        interface controllers, switches, and routers) to eliminate the impact
        of processing and queueing delays on PTP measurements.</t>

      <t>PTP was originally designed for multicast communication. Later was
        added a unicast mode, which can be used in larger networks with partial
        on-path PTP support (e.g. telecom profiles G.8265.1 and G.8275.2).</t>

      <t>The <xref target="RFC5905">Network Time Protocol</xref> does not rely
        on hardware timestamping support, but implementations can use it if it
        is available to avoid the impact of processing and queueing delays,
        similarly to PTP. The client-server mode of NTP is functionally similar
        to the PTP unicast mode.</t>

      <t>An issue for NTP is hardware that can specifically timestamp only PTP
        packets. This limitation comes from a hardware design which can provide
        receive timestamps only at a limited rate and not the maximum rate
        supported by the network interface. To avoid missing receive timestamps
        when the interface is receiving other traffic at a high rate, a filter
        needs to be implemented in the hardware to inspect each received packet
        and capture a timestamp only for packets that need it.</t>

      <t>The hardware filter can be usually configured for specific PTP
        transport (e.g. UDPv4, UDPv6, 802.3) and sometimes even the PTP message
        type (e.g. sync message or delay request) to further reduce the rate of
        timestamps on the server or client side, but it cannot be configured to
        timestamp NTP messages on the UDP port 123.</t>

      <t>This document specifies a new transport for NTP to enable the
        PTP-specific timestamping support. It adds a new extension field (TLV)
        for PTP to contain NTP messages.</t>

      <t>NTP over PTP does not require any PTP clocks to be present in the
        network. It does not disrupt their operation if they are present. Hosts
        in the network can operate as PTP clocks and NTP servers, clients, or
        peers using NTP over PTP at the same time.</t>

      <t>The specification does not take advantage of the PTP correctionField
        modified by PTP transparent clocks as their support for the unicast
        mode seems to be rare or nonexistent.</t>

      <t>The client/server mode of NTP, even if using the PTP transport, has
        several advantages when compared to the PTP unicast mode:

        <list style="symbols">
          <t>It is more secure. It can use existing security mechanisms
            specified for NTP like <xref target="RFC8915">Network Time
            Security</xref>, not losing any of its features. The PTP unicast
            mode allows an almost-infinite traffic amplification, which can
            be exploited for denial-of-service attacks and can only be limited
            by security mechanisms requiring client authentication.</t>
          <t>It needs fewer messages and less network bandwith to get the same
            number of timestamps.</t>
          <t>It is better suited for synchronization in networks which do not
            have full on-path support for PTP (as boundary clocks or
            transparent clocks). NTP does not assume the network delay is
            constant and the rate of measurements in opposite directions is
            symmetric. PTP measures the offset and delay separately (sync
            messages and delay requests have independent timing).</t>
        </list>
      </t>

      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
          "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
          document are to be interpreted as described in <xref
            target="RFC2119">RFC 2119</xref>.</t>
      </section>
    </section>

    <section title="PTP transport for NTP">
      <t>A new TLV is defined for PTP to contain NTP messages in the client
        (3), server (4), and symmetric modes (1 and 2). Using other NTP modes in
        the TLV is not specified. Any transport specified for PTP that supports
        unicast messaging can be used for NTP over PTP, e.g. UDP on IPv4 and
        IPv6.</t>

      <t>The type value of the NTP TLV is TBD. The TLV contains the whole NTP
        message as would normally be the UDP payload, without any
        modifications. The TLV does not propagate through boundary clocks.</t>

      <t>If the UDP transport is used for PTP, the UDP source and destination
        port numbers MUST be the PTP event port (319). If the client
        implemented <xref target="RFC9109">port randomization</xref>, requests
        and/or responses would not get a hardware receive timestamp due to the
        filter matching only the PTP port.</t>

      <t>The NTP TLV MUST be included in a PTP delay request message. The
        originTimestamp field and all fields of the header SHOULD be zero,
        except:

        <list style="symbols">
          <t>messageType is 1 (delay request)</t>
          <t>versionPTP is 2</t>
          <t>messageLength is the length of the PTP message including the NTP
            TLV</t>
          <t>domainNumber is 123</t>
          <t>flagField has the unicastFlag (0x4) bit set</t>
          <t>sequenceId is increased by one with each transmitted PTP
            message</t>
        </list>
      </t>

      <t>An NTP client or peer using the PTP transport sends NTP requests
        contained in PTP delay requests as the NTP TLV.</t>

      <t>An NTP server or peer receiving NTP requests over the PTP transport
        MUST check for the domainNumber of 123 and the NTP TLV. Its responses
        to these requests MUST be contained in PTP delay requests as the NTP
        TLV. It MUST NOT respond with PTP delay responses, or any other PTP
        messages.</t>

      <t>If a PTP clock receives an NTP-over-PTP request, it will not recognize
        the domain number and ignore the message. If it responded to messages
        in the domain (e.g. due to misconfiguration), it would send a delay
        response (to port 320 if using the UDP transport), which would be
        ignored by the client.</t>

      <t>Any authenticator fields included in the NTP messages MUST be
        calculated only over the NTP message following the header of the NTP
        TLV.</t>

      <t>Receive and transmit timestamps contained in the NTP messages SHOULD
        NOT be adjusted for the beginning of the NTP data in the PTP message.
        They SHOULD still correspond to the ending of the reception and
        beginning of the transmission of the whole frame (e.g. start frame
        delimiter in an Ethernet frame).</t>

      <t>Any modifications of the correctionField made by potential one-step
        end-to-end transparent clocks in the network SHOULD be ignored by the
        server and client.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The author would like to thank Martin Langer for his useful
        comments.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>
    </section>

    <section title="Implementation Status - RFC EDITOR: REMOVE BEFORE PUBLICATION">
      <t>This section records the status of known implementations of the
        protocol defined by this specification at the time of posting of this
        Internet-Draft, and is based on a proposal described in RFC 7942. The
        description of implementations in this section is intended to assist
        the IETF in its decision processes in progressing drafts to RFCs.
        Please note that the listing of any individual implementation here does
        not imply endorsement by the IETF. Furthermore, no effort has been
        spent to verify the information presented here that was supplied by
        IETF contributors. This is not intended as, and must not be construed
        to be, a catalog of available implementations or their features.
        Readers are advised to note that other implementations may exist.</t>

      <t>According to RFC 7942, "this will allow reviewers and working groups
        to assign due consideration to documents that have the benefit of
        running code, which may serve as evidence of valuable experimentation
        and feedback that have made the implemented protocols more mature. It
        is up to the individual working groups to use this information as they
        see fit".</t>

      <section title="chrony">
        <t>chrony (https://chrony.tuxfamily.org) has experimental support for
          PTP-over-NTP in its development branch. As the type of the NTP TLV,
          it uses 0x2023 from the experimental "do not propagate" range.</t>

        <t>It was tested on Linux with the following network controllers, which
          have hardware timestamping limited to PTP packets:</t>

        <t><list>
          <t>Intel XL710 (i40e driver) - works</t>
          <t>Intel X540-AT2 (ixgbe driver) - works</t>
          <t>Intel 82576 (igb driver) - works</t>
          <t>Broadcom BCM5720 (tg3 driver) - works</t>
          <t>Broadcom BCM57810 (bnx2x driver) - does not timestamp unicast PTP
            packets</t>
        </list></t>

      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The PTP transport prevents NTP clients from randomizing their source
        port. It has no other impact on security of NTP.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;

      &RFC5905;

      <reference anchor="IEEE1588" target="https://www.ieee.org">
        <front>
          <title>
            IEEE std. 1588-2019, "IEEE Standard for a Precision Clock
            Synchronization for Networked Measurement and Control
            Systems."
          </title>
          <author>
            <organization>
              Institute of Electrical and Electronics Engineers
            </organization>
          </author>
          <date month="11" year="2019" />
        </front>
      </reference>
    </references>

    <references title="Informative References">
      &RFC8915;

      &RFC9109;
    </references>
  </back>
</rfc>
