PTP Configuration on Asterfusion Enterprise SONiC Distribution Switch
1 Overview of PTP
The Precision Time Protocol (PTP) is used to synchronize clocks across network devices with sub-microsecond accuracy. Unlike NTP, which relies on software timestamps, PTP uses hardware timestamping to achieve much higher precision, making it widely adopted in applications such as broadcasting, financial trading, industrial automation, and 5G transport networks.
In a PTP system, devices can be either PTP-aware (Ordinary Clocks, Boundary Clocks, and Transparent Clocks) or non-PTP network elements such as switches and routers.
PTP works as a distributed protocol where clocks exchange synchronization messages and form a master-slave hierarchy. At the top of this hierarchy is the Grandmaster Clock, which provides the reference time for the entire domain. Other clocks adjust their local time based on synchronization messages from their upstream master. All synchronization takes place within a logical scope called a PTP domain.
2 Clock Type
Nodes within a PTP domain are referred to as clock nodes, and the interfaces on these nodes that run the PTP protocol are called PTP interfaces. The PTP protocol defines the following three basic types of clock nodes:
- OC (Ordinary Clock)
An Ordinary Clock has only one PTP interface participating in time synchronization within a PTP domain. This interface typically acts as a Slave, synchronizing time from an upstream clock node. When the OC acts as a time source, the same interface can also function as a Master, distributing time to downstream clock nodes.
- BC (Boundary Clock)
A Boundary Clock has multiple PTP interfaces participating in time synchronization within the same PTP domain. One interface acts as a Slave, synchronizing time from an upstream clock node. The remaining interfaces act as Master interfaces, distributing the synchronized time to downstream clock nodes. When serving as a time source, a BC can distribute time simultaneously through multiple Master interfaces.
- TC (Transparent Clock)
A Transparent Clock also has multiple PTP interfaces, but unlike OCs and BCs, it does not synchronize its own time through any interface. Each interface neither acts as a Master nor a Slave; they simply forward PTP messages while correcting for the residence time (the delay introduced by the device itself).
3 PTP Process
The Precision Time Protocol (PTP) synchronization process consists of two main phases:
- Master-Slave Hierarchy Establishment
Within a PTP domain, all clock nodes are organized in a hierarchical structure. The reference time for the entire domain is provided by the Grandmaster Clock (GM), which represents the highest-level clock in the hierarchy.
Clock nodes exchange Announce messages containing information such as clock priority, clock class, and time accuracy. Based on this information, the nodes collectively elect one clock as the Grandmaster for the domain. Through this process, the master-slave relationships between nodes are established, and the master or slave role of each interface on the nodes is determined.
- Clock Synchronization
Once the hierarchy is established, synchronization between the master and slave clocks is performed as follows:
-
- The master sends a Sync message to the slave and records the send timestamp.
- The slave receives the Sync message and records the receive timestamp.
- The slave sends a Delay_Request message to the master and records the send timestamp.
- The master receives the Delay_Request message and records the receive timestamp.
- The master sends a Delay_Response message to the slave.
- The slave calculates the path delay and offsets using all collected timestamps and adjusts its local clock to align with the master clock.

4 Configuring PTP
4.1 Configuring a PTP Domain
|
4.2 Configuring PTP Message
|
4.3 Configuring PTP Ports
|
4.4 Configuring PTP SM-TLV
SM-TLV (SMPTE Management TLV) is a set of management information extended by SMPTE for PTP (IEEE 1588v2), used for time synchronization and status monitoring in broadcast media networks.
|
4.5 Display PTP information
|
5 PTP Configuration Example
5.1 Configuring Layer 2 IEEE 1588v2 PTP
5.1.1 Network Topology

In 5G ORAN (Open Radio Access Network), the fronthaul network requires sub-microsecond time synchronization to ensure strict alignment of RU (Radio Unit), DU (Distributed Unit), and CU (Central Unit) in radio scheduling and waveform processing.
In this scenario, switches typically operate in Layer 2 IEEE 1588v2 Transparent Clock (BC) mode and adopts a two-step time synchronization mechanism to ensure high-precision timing.
5.1.2 Configuration Step
1 Create a VLAN for PTP
sonic# configure
sonic(config)# vlan 10
sonic(config)# interface ethernet 1
sonic(config-if-1) switchport trunk vlan 10
sonic(config)# interface ethernet 25
sonic(config-if-25)# switchport trunk vlan 10
2 Configuring PTP domain
sonic(config)# ptp enable
sonic(config)# ptp instance 0
sonic(config-ptp-0)# ptp profile 1588v2
sonic(config-ptp-0)# ptp clock-type bc
sonic(config-ptp-0)# ptp clock-step two_step
sonic(config-ptp-0)# ptp transport-mode ethernet
sonic(config-ptp-0)# ptp delay-mode p2p
sonic(config-ptp-0)# exit
3 Configuring interface
sonic(config)# interface ethernet 1
sonic(config-if-1)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 25
sonic(config-if-25)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
Display PTP Configuration information
Use the show ptp clock to verify the time-properties.
sonic# show ptp clock
Domain: 0
Profile: smpte-2059-2
PTP Version: 2.1
Clock Type: BC
Clock Step: two_step
Delay Mode: P2P
Transport Mode: ethernet
Local Clock Identity: 000000.0000.00000
Local Clock Accuracy: 0xFE
Local Clock Class: 248
Local Clock Priority1: 128
Local Clock Priority2: 128
ports: Ethernet1,Ethernet25
Grandmaster Clock Identity: 000000.0000.001549
Grandmaster Clock Accuracy: 0xfe
Grandmaster Clock Class: 248
Grandmaster Clock Priority1: 128
Grandmaster Clock Priority2: 128
Parent Port Identity: 3
Servo State: locked
Offset To Master: -6
Path Delay: 260
Max Steps Removed: 255
Local Time: 85526343602446
5.2 Configuring SMPTE PTP in Multicast Mode
5.2.1 Network Topology

This network supports IP-based transmission of multiple high-definition video, audio, and ancillary data streams, requiring precise audio-video synchronization, low latency, and high timing accuracy. PTP (Precision Time Protocol) provides a unified clock to achieve end-to-end synchronization in accordance with the SMPTE 2110 standard. The network is configured with both primary and backup clock sources, allowing automatic switchover to the backup clock in the event of a primary clock failure, ensuring continuous and stable synchronization.
5.2.1 Configuration Step
As an example, the following configuration illustrates two Spine switches. The Leaf switch configuration follows the same pattern.
Configuring Spine A
1 Specify the PTP Profile
sonic(config)# ptp enable
sonic(config)# ptp instance 0
sonic(config-ptp-0)# ptp profile smpte-2059-2
sonic(config-ptp-0)# ptp clock-type bc
sonic(config-ptp-0)# ptp delay-mode e2e
# Configure the source IP address for multicast PTP transport
sonic(config-ptp-0)# ptp transport-mode udpv4 multicast
sonic(config-ptp-0)# ptp source ip 10.10.1.1/32
sonic(config-ptp-0)# exit
# Modify the PTP priority
sonic(config-ptp-0)# ptp clock-source local priority1 10
2 Enable PTP on interface
sonic(config)# interface ethernet 1
sonic(config-if-1)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 2
sonic(config-if-2)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 3
sonic(config-if-3)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 5
sonic(config-if-5)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
Configuring Spine B
1 Specify the PTP Profile
sonic(config)# ptp enable
sonic(config)# ptp instance 0
sonic(config-ptp-0)# ptp profile smpte-2059-2
sonic(config-ptp-0)# ptp clock-type bc
sonic(config-ptp-0)# ptp delay-mode e2e
# Configure the source IP address for multicast PTP transport
sonic(config-ptp-0)# ptp transport-mode udpv4 multicast
sonic(config-ptp-0)# ptp source ip 10.10.1.4/32
sonic(config-ptp-0)# exit
# Modify the PTP priority
sonic(config-ptp-0)# ptp clock-source local priority1 20
sonic(config-ptp-0)# exit
2 Enable PTP on the interface
sonic(config)# interface ethernet 1
sonic(config-if-1)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 2
sonic(config-if-2)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 3
sonic(config-if-3)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
sonic(config)# interface ethernet 5
sonic(config-if-5)# ptp instance 0
sonic(config-if-ptp-0)# ptp enable
Display PTP Configuration information
Use the show ptp interface command to display brief information about PTP interfaces:
# Spine A
sonic# show ptp interface
Ethernet: Ethernet1
Enable: true
Domain: 0
Index: 2
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: slave
Delay Mode: E2E
Ethernet: Ethernet2
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: master
Delay Mode: E2E
Ethernet: Ethernet3
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: master
Delay Mode: E2E
Ethernet: Ethernet5
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: master
Delay Mode: E2E
# Spine B
sonic# show ptp interface
Ethernet: Ethernet1
Enable: true
Domain: 0
Index: 2
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: passive
Delay Mode: E2E
Ethernet: Ethernet2
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: master
Delay Mode: E2E
Ethernet: Ethernet3
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: master
Delay Mode: E2E
Ethernet: Ethernet5
Enable: true
Domain: 0
Index: 3
Dscp: 56
Source IP Address: 0.0.0.0
Announce Interval: 0
Announce Receipt Timeout: 3
Delay Req Interval: -3
Pdelay Req Interval: -3
Sync Interval: -3
Mode: slave
Delay Mode: E2E