Support Support Downloads Knowledge Base Apex Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Junos] Precision Timing Protocol negotiation overview

0

0

Article ID: KB36531 KB Last Updated: 28 Apr 2021Version: 1.0
Summary:

This article provides information on how PTP (Precision Timing Protocol) is negotiated in Junos. For more information on this topic please refer to the technical documentation on Precision Time Protocol Overview.

Solution:

Precision Time Protocol (PTP), also known as IEEE 1588v. This clock synchronization standard is a highly precise protocol for time synchronization that synchronizes clocks in a distributed system. The time synchronization is achieved through packets that are transmitted and received in a session between a primary clock and a client clock. It works on the principle of phase synchronization and frequency synchronization—it synchronizes both frequency and phase, including time of day.

The system clocks can be categorized based on the role of the node in the network:

  1. Primary clock

    • The primary clock transmits the messages to the PTP clients (also called client node or boundary node). 
    • This allows the clients to establish their relative time distance and offset from the primary clock (which is the reference point) for phase synchronization. 
    • The delivery mechanism to the clients is either unicast or multicast packets over Ethernet or UDP, UDP uses port 319/320.​​
  2. Client clock

    • Located in the PTP client (also called client node), the client clock performs clock and time recovery operations based on the received and requested timestamps from the primary clock.
  3. Boundary clock

    • The boundary clock operates as a combination of the primary and client clocks. 
    • The boundary clock endpoint acts as a client clock to the primary clock, and also acts as the primary to all the clients reporting to the boundary endpoint.
    • The Ports act as Client or Primary. 
  4. Transparent Clock

    • Transparent clock acts as a relay agent.
    • It adds resident time to the correction field (i.e. the time it took to accept the packet and egress the packet out). 

PTP Negotiation:

  

  1. A client clock initiates unicast discovery by sending a Signaling message to one of its configured primary clocks requesting the primary send unicast Announce messages to the client. 
  2. If the primary can support the request, it replies with a Signaling message indicating the session for unicast Announce messages has been granted. From this point on, the primary sends unicast Announce messages to the client at the rate requested (1PPS, rate negotiated).  
  3. The client then uses the Announce messages it receives from all primaries to determine which primary clock is the best source for information. 
  4. Announce messages are used for BMCA (Best Master Clock Algorithm).
  5. The selected primary becomes the reference clock to the client. 
  6. The client then sends additional Signaling messages to the reference clock to request unicast delivery of Sync and Delay Response messages. 
  7. Assuming the reference clock has sufficient resources, the request is granted and unicast Sync and Delay Response messages are sent from the reference clock to the client
  8. PTP Synchronization (Phase and Frequency) is the last step for the client.
BMCA (Best Master Clock Algorithm)
  • BMCA is the algorithm used to select the primary clock on each link, and ultimately used to select the reference clock for the whole PTP domain. 
  • It runs locally on each port of the ordinary and boundary clocks to compare the local data sets with the received data from Announce messages to select the best clock on the link. 
  • BMCA compares the following attributes from Announce messages with the precedence described here:
  1. Priority: A user-configurable variable from 0 to 255; lower values takes precedence
  2. Clock Class: Defines the traceability of the time or frequency from the reference clock
  3. Clock Accuracy: Defines the accuracy of a clock; lower values take precedence
  4. Offset Scaled Log Variance: Defines the stability of a clock
  5. Clock Identity: An 8-byte number typically in IEEE-EUI64 format to uniquely identify a clock. (the tiebreaker if all other attributes are equal)
  • There is another part to BMCA. The above part only determines which is the Best Clock in the network. However, the BMCA also checks other values to determine the network topology 
  1. StepsRemoved: over how many hops the frame came
  2. SenderPortIdentity: a port’s unique identifier (the first tie-breaker if all other attributes are equal)
  3. ReceiverPortIdentity: a port’s unique identifier (the tie-breaker if all other attributes are equal)
  • This is needed in a multiport PTP device that receives Announce frames over multiple ports, which one is the one to synchronize to.
PTP Synchronization
 
  • PTP Client uses Sync and Delay Response for PTP Synchronization. It includes 2 phases:​ 
1) Offset correction (Difference between primary clock and client clock)
  • SYNC messages are used for this purpose (64PPS, rate negotiated).
    • Is used to calculate the time difference between the primary and the client, this process is called the offset correction
    • Sender (primary) marks Timestamp at which message leaves.
    • Client clock marks Timestamp at which message received. 
    • The client clock is then corrected by this much offset value
  • If the transmission line does not have a delay, both clocks would be synchronized.
  • Multicast addresses for PTP messages 224.0.0.107/ FF0x::181
2) Delay measurement (transmission delay)
  • 2 messages are used for this.
  1. Delay request (64PPS, rate negotiated)
  2. Delay response (in response to every Delay-Request)
  • The above two messages are used to determine the run time between client and primary.
  • The delay can be symmetrical delay between primary and client. Only if there are direct link and the length of cable is appropriate
  • As the length and the link quality may differ so routers and switches can have an asymmetric delay. Because of this, the concept of Boundary Clock was defined for router and switches
  • Multicast addresses for PTP delay messages 224.0.0.107/FF02::6B
States in PTP:
  1. FREERUN: Not connected to any remote GM, uses local oscillator.
  2. HOLDOVER: Lost connection to a remote GM, attempt to recover it, and try to keep the previous clock. During the HOLDOVER state, the clock can start drifting, and if drifting outside of specifications, it goes back to FREERUN mode.
  3. ACQUIRING: Started negotiation with GM, and exchange messages with the GM to determine the delay induced by the network and try to sync with the GM clock.
  4. FREQ_LOCKED: The client device is locked to the primary with respect to frequency, but not phase aligned.
  5. PHASE_ALIGNED: Locked to the primary with respect to frequency and phase.
Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search