Chapter 3. Chrony with hardware timestamping


Hardware (HW) timestamping in some Network Interface Controller (NICs) provides accurate timestamping of incoming and outgoing packets. NTP timestamps are usually created by the kernel and chronyd with the use of the system clock. However, when HW timestamping is enabled, the NIC uses its own clock to generate the timestamps when packets are entering or leaving the link layer or the physical layer. When used with NTP, hardware timestamping can significantly improve the accuracy of synchronization. For best accuracy, both NTP servers and NTP clients need to use hardware timestamping. Under ideal conditions, a sub-microsecond accuracy might be possible.

Another protocol for time synchronization that uses hardware timestamping is PTP.

Unlike NTP, PTP relies on assistance in network switches and routers. If you want to achieve the best accuracy of synchronization, use PTP on networks that have switches and routers with PTP support, and prefer NTP on networks that do not have such switches and routers.

3.1. Verifying support for hardware timestamping

To verify that hardware timestamping with NTP is supported by an interface, use the ethtool -T command. An interface can be used for hardware timestamping with NTP if ethtool lists the SOF_TIMESTAMPING_TX_HARDWARE and SOF_TIMESTAMPING_TX_SOFTWARE capabilities and also the HWTSTAMP_FILTER_ALL filter mode.

Procedure

  • Display a device’s time stamping capabilities and associated PTP hardware clock:
# ethtool -T enp1s0
Copy to Clipboard Toggle word wrap

3.2. Enabling hardware timestamping

You can enable the hardware timestamping on one or multiple interfaces by using the hwtimestamp directive in the /etc/chrony.conf file. The directive can either specify a single interface, or a wildcard character can be used to enable hardware timestamping on all interfaces that support it.

Procedure

  1. Edit the /etc/chrony.conf file and make the following changes:

    1. Add the hwtimestamp setting for interfaces which support hardware timestamping. For example:

      hwtimestamp enp1s0
      hwtimestamp eno*
      Copy to Clipboard Toggle word wrap

      You can use the * wildcard if no other application, such as ptp4l uses hardware timestamping.

    2. Configure a short client polling interval by appending the minpoll and maxpoll options to the server setting, for example:

      server ntp.example.comlocal minpoll 0 maxpoll 0
      Copy to Clipboard Toggle word wrap

      For hardware timestamping, you must configure a shorter polling interval than the default range (64-1024 seconds) to minimize the offset of the system clock.

    3. Enable the NTP interleaved mode by appending the xleave option to the server setting:

      server ntp.example.comlocal minpoll 0 maxpoll 0 xleave
      Copy to Clipboard Toggle word wrap

      With this setting, chrony gets the hardware transmit timestamp only after sending a packet. This behavior prevents the serever from saving the timestamp in packets to which it responds. With the xleave option, chrony can receive transmit timestamps that were generated after the transmission.

    4. Optional: Increase the maximum size of memory allocated for logging of client’s access on the server, for example:

      clientloglimit 100000000
      Copy to Clipboard Toggle word wrap

      The default server configuration allows a few thousands of clients to use the interleaved mode concurrently. By increasing the value of the clientloglimit setting, you can configure the server for a large number of clients.

  2. Restart the chronyd service:

    # systemctl restart chronyd
    Copy to Clipboard Toggle word wrap

Verification

  1. Optional: Verify in the /var/log/messages log file that hardware timesamping is enabled:

    chronyd[4081]: Enabled HW timestamping on enp1s0
    chronyd[4081]: Enabled HW timestamping on eno1
    Copy to Clipboard Toggle word wrap
  2. If chronyd is configured as an NTP client or peer, display the transmit and receive timestamping modes and the interleaved mode:

    # chronyc ntpdata
    
    Remote address  : 203.0.113.15 (CB00710F)
    Remote port     : 123
    Local address   : 203.0.113.74 (CB00714A)
    Leap status     : Normal
    Version         : 4
    Mode            : Server
    Stratum         : 1
    Poll interval   : 0 (1 seconds)
    Precision       : -24 (0.000000060 seconds)
    Root delay      : 0.000015 seconds
    Root dispersion : 0.000015 seconds
    Reference ID    : 47505300 (GPS)
    Reference time  : Wed May 03 13:47:45 2017
    Offset          : -0.000000134 seconds
    Peer delay      : 0.000005396 seconds
    Peer dispersion : 0.000002329 seconds
    Response time   : 0.000152073 seconds
    Jitter asymmetry: +0.00
    NTP tests       : 111 111 1111
    Interleaved     : Yes
    Authenticated   : No
    TX timestamping : Hardware
    RX timestamping : Hardware
    Total TX        : 27
    Total RX        : 27
    Total valid RX  : 27
    Copy to Clipboard Toggle word wrap
  3. Report the stability of NTP measurements:

    # chronyc sourcestats
    ....
    
    210 Number of sources = 1
    Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
    ntp.local                  12   7    11     +0.000      0.019     +0ns    49ns
    ....
    Copy to Clipboard Toggle word wrap

This stability is reported in the Std Dev column. With hardware timestamping enabled, stability of NTP measurements should be in tens or hundreds of nanoseconds, under normal load.

3.3. Configuring PTP-NTP bridge

If a highly accurate Precision Time Protocol (PTP) primary timeserver is available in a network that does not have switches or routers with PTP support, a computer may be dedicated to operate as a PTP client and a stratum-1 NTP server. Such a computer needs to have two or more network interfaces, and be close to the primary timeserver or have a direct connection to it. This will ensure highly accurate synchronization in the network.

Procedure

  1. Configure the ptp4l and phc2sys programs from the linuxptp packages to use one interface to synchronize the system clock by using PTP.
  2. Configure chronyd to provide the system time by using the other interface:

    bindaddress 203.0.113.74
    hwtimestamp enp1s0
    local stratum 1
    Copy to Clipboard Toggle word wrap
  3. Restart the chronyd service:

    # systemctl restart chronyd
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat