HON’s Wiki # Precision Time Protocol (PTP)

Home / Services

Contents

Theory

Basics

Clock Types

Versions and Amendments

PTPv1 (IEEE 1588-2002)

PTPv2 (IEEE 1588-2008)

PTPv2.1 (IEEE 1588-2019)

IEEE 1588g-2022 (IEEE Std 1588-2019 Amendment)

IEEE 1588e-2024 (IEEE Std 1588-2019 Amendment)

PTPv2 Profiles

Default (IEEE 1588-2008)

Power (IEEE C37.238)

Generalized PTP (gPTP) (802.1AS-2011)

Telecom (ITU-T G.8275.1)

Media (AES67-2015)

SMPTE (SMPTE 2059-2)

Implementations

Linux PTP

Setup: Grandmaster Mode with Chrony Source (Debian)

Configure LinuxPTP as a GM using the default PTPv2 profile, with Chrony as the local time source.

For this setup, Chrony is the one updating the system time, so phc2sys is not used. TODO

For testing purposes only, using NTP as the source for PTP is not recommended.

TODO: NTP to PTP: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l#sec-Serving_NTP_Time_with_PTP TODO: Sync PTP HW clock to system clock TODO: Use NTP server directly without Chrony? TODO: clockClass?

  1. Check if your NIC supports hardware timestamping: ethtool -T <interface>
    • Software mode is fine for testing stuff.
  2. Install:
    1. git clone --depth=1 --branch=v4.1 http://git.code.sf.net/p/linuxptp/code linuxptp
    2. cd linuxptp
    3. If you need PTPv2 instead of v2.1: In msg.h, change PTP_MINOR_VERSION from 1 to 0.
    4. make
    5. sudo make install
    6. cd ..
  3. Create the config file (default profile):
    1. Copy the example config the the default profile: sudo cp linuxptp/configs/default.cfg /etc/ptp4l.conf
    2. Reduce the logging interval by setting summary_interval 6 (2^N seconds). The default is 0 (each second).
    3. Set the first priority to avoid losing the GM role by setting priority1 1.
    4. If you have multiple clocks and want to assign some priority between then (after pri1 and class), set priority2 to some appropriate value.
  4. Create the service config below, using the correct interface: sudo vim /etc/systemd/system/ptp4l.service
    • If you plan on running multiple PTP profiles on the same computer, you may want to structure the service a bit differently and use different configs.
    • -i <interface> for each interface to use with the provided config.
    • -4 for IPv4.
    • -S for SW timestamping, if no HW support available.
  5. Enable and start the service: sudo systemctl daemon-reload && sudo systemctl enable --now ptp4l.service
  6. Check the system journal to make sure it started correctly: sudo journalctl -u ptp4l.service -f
    • See the usage notes for more info.
  7. Validate that PTP messages are sent: sudo tcpdump -nn -i <interface> host 224.0.1.129

Service config (/etc/systemd/system/ptp4l.service):

[Unit]
Description=LinuxPTP daemon
After=network.target

[Service]
ExecStart=ptp4l -f /etc/ptp4l.conf -i eth0 -4

[Install]
WantedBy=multi-user.target

Usage

Cisco

Support Overview

Catalyst 9000 Series

General
Configuration

Cat 9300 BC example:

ip access-list extended ptpv2-4
 10 permit udp any eq 319 host 224.0.1.129 eq 319
 20 permit udp any eq 320 host 224.0.1.129 eq 320

int Te1/1/1
 desc ptp-only-uplink
 ip address 10.0.1.0 255.255.255.0
 no switchport
 ip access-group ptpv2-4 in
 ip access-group ptpv2-4 out

int Te1/1/8
 desc downlink
 no switchport
 ip address 10.0.2.0 255.255.255.0
 ptp role primary

ptp transport ipv4 udp
ptp mode boundary delay-req
ptp priority1 255
Troubleshooting

ACI

General
Configuration
Troubleshooting

hon.one | HON95/wiki | Edit page