2 About PTP
Use PTP to synchronize system clocks on a LAN more accurately than NTP. If network drivers support either hardware or software time stamping, a PTP clock can use the time stamps in PTP messages to resolve propagation delays across a network. With software time stamping, PTP synchronizes systems to within a few tens of microseconds. With hardware time stamping, PTP can synchronize systems to within a few tenths of a microsecond. If you require high-precision time synchronization of systems, use hardware time stamping.
A typical PTP configuration on an enterprise local area network consists of:
-
One or more grandmaster clock systems.
A grandmaster clock is typically implemented as specialized hardware that can use high-accuracy GPS signals or lower-accuracy code division several access (CDMA) signals, radio clock signals, or NTP as a time reference source. If several grandmaster clocks are available, the best master clock (BMC) algorithm selects the grandmaster clock based on the settings of their
priority1
,clockClass
,clockAccuracy
,offsetScaledLogVariance
, andpriority2
parameters and their unique identifier, in that order. -
Several boundary clock systems.
Each boundary clock is backed up to a grandmaster clock on one subnetwork and relays PTP messages to one or more added subnetworks. A boundary clock is usually implemented as a function of a network switch.
-
Several secondary clock systems.
Each secondary clock on a subnetwork is backed up to a boundary clock, which acts as the master clock for that secondary clock.
For a basic configuration, set up a single grandmaster clock and several secondary clocks on the same network segment and thus eliminates any need for an intermediate layer of boundary clocks.
Grandmaster and secondary clock systems that use only one network interface for PTP are termed ordinary clocks.
Boundary clocks require at least two network interfaces for PTP: one interface acts a secondary to a grandmaster clock or a higher-level boundary clock; the other interfaces act as masters to secondary clocks or lower-level boundary clocks.
Synchronization of boundary and secondary clock systems is achieved by sending time stamps in PTP messages. By default, PTP messages are sent in UDPv4 datagrams. You can also configure PTP to use UDPv6 datagrams or Ethernet frames as its transport mechanism.
To use PTP on a system, the driver for at least one of the system's network interfaces must support either software or hardware time stamping. To find out whether the driver for a network interface supports time stamping, use the ethtool command:
sudo ethtool -T eno1
Time stamping parameters for eno1:
Capabilities:
hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
...
The output in the example shows that the eno1
interface supports both hardware and software time stamping capabilities.
With software time stamping, ptp4l
synchronizes the system clock to an external grandmaster clock.
If hardware time stamping is available, ptp4l
can synchronize the PTP hardware clock to an external grandmaster clock. In this case, you use the phc2sys
daemon to synchronize the system clock with the PTP hardware clock.