Introduction
ptp4lis a linux open-source implementation of the Precision Time Protocol (PTP) according to IEEE standard 1588 for Linux. It implements Boundary Clock (BC), Ordinary Clock (OC), and Transparent Clock (TC).
ptp4lsynchronizes the PTP hardware clock to the master clock.
Installing linuxptp will install ptp4l.
CentOS/RedHat:
sudo yum install linuxptp
Ubuntu/ Debian:
sudo apt-get install linuxptp
Fedora:
dnf install linuxptp
wget https://deac-fra.dl.sourceforge.net/project/linuxptp/v3.1/linuxptp-3.1.1.tgz
tar xf linuxptp-3.1
.1
.tgz
cd linuxptp-3.1
.1
/
make -j
# optionally, if
you want to install it:
# (the binaries will be available under /usr/local/sbin/)
sudo make install DESTDIR=/
A follower clock attempts to automatically detect a leader clock in the tree and then proceeds to synchronize to that clock by disciplining the local PHC. An example configuration file of a follower clock is included below. The various configuration values may be adjusted to fit the requirements of different PTP profiles as needed.
SC file config file:
# cat /etc/ptp4l-follower.conf
[global]
verbose 1
tx_timestamp_timeout 30
delay_filter moving_median
delay_filter_length 32
clientOnly 1
network_transport L2
#replace with system network interface
to use
[ens6f0np0]
logAnnounceInterval -3
announceReceiptTimeout 3
logSyncInterval -4
logMinDelayReqInterval -3
Use the following command to run the ptp4l in a follower mode:
![error.png](https://docscontent.nvidia.com/dims4/default/028e294/2147483647/strip/true/crop/28x30+0+0/resize/28x30!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fconfluence%2F00000188-48d0-d97f-a9f9-d8f0111a0000%2Fimages%2Fnetworking%2Fplugins%2Fservlet%2Fconfluence%2Fplaceholder%2Ferror.png)
com.atlassian.confluence.content.render.xhtml.XhtmlException: Missing required attribute: {http://atlassian.com/resource/identifier}value
A grandmaster or a leader clock serves as a source of synchronization for the nodes which attempt to follow it (boundary clocks and ordinary clocks). It is assumed that the grandmaster/leader clock itself maintains its local clock, e.g. by disciplining it with a GNSS reference or applying holdover algorithms in case of reference loss. The quality of time information offered by the grandmaster/leader clock should be accurately reflected in the clockClass and clockAccuracy setting. For definition of these parameters as well as an enumeration of the values to be used, please refer to IEEE 1588 sections 7.6.2.4 and 7.6.2.5, respectively.
GM file config file (/etc/ gm2.conf):
# cat /etc/gm2.conf
[global]
verbose 1
tx_timestamp_timeout 30
delay_filter moving_median
delay_filter_length 32
#replace with correct clockClass
clockClass 6
#replace with correct clockAccuracy
clockAccuracy 22
network_transport L2
#replace with system network interface
to use
[ens4f0np0]
logAnnounceInterval -3
announceReceiptTimeout 3
logSyncInterval -4
logMinDelayReqInterval -3
clockClass and clockAccuracy are dynamic values that determined by the reference clock been used – refer to the IEEE 1588 for more details.
CMD:
![worddavc035b139236383b3cc51049776c0b41c.png](https://docscontent.nvidia.com/dims4/default/8f15e50/2147483647/strip/true/crop/900x217+0+0/resize/900x217!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fconfluence%2F00000188-48d0-d97f-a9f9-d8f0111a0000%2Fimages%2Fnetworking%2Fdownload%2Fattachments%2F89130398%2Fworddavc035b139236383b3cc51049776c0b41c.png)
A boundary clock operates on multiple network ports. It attempts to automatically detect a grandmaster/leader clock on one of the ports and disciplines its local PHC to follow the grandmaster/leader clock. It then acts as a leader to nodes which attempt to synchronize to it on the remaining ports. Provided that the realtime clock mode is enabled \[refer to the correct section here\], all the ports in a network adapter are synchronized with respect to each other. If a boundary clock is to be used with ports belonging to multiple network adapters, these network adapters must be synchronized to each other externally.
BC file config file (/etc/ptp4l-bc.conf):
\[global\]
verbose 1
tx_timestamp_timeout 30
delay_filter moving_median
delay_filter_length 32
boundary_clock_jbod 1
network_transport L2
#replace with system network interface
to use
\[ens6f0np0\]
logAnnounceInterval -3
announceReceiptTimeout 3
logSyncInterval -4
logMinDelayReqInterval -3
#replace with system network interface
to use
\[ens6f1np1\]
logAnnounceInterval -3
announceReceiptTimeout 3
logSyncInterval -4
logMinDelayReqInterval -3
Unless external synchronization of adapters is implemented, all ports listed in the config file must belong to the same adapter.
CMD:
![worddav7aa655ddfb9be9de05208df9ba4c38e3.png](https://docscontent.nvidia.com/dims4/default/7b71317/2147483647/strip/true/crop/900x412+0+0/resize/900x412!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fconfluence%2F00000188-48d0-d97f-a9f9-d8f0111a0000%2Fimages%2Fnetworking%2Fdownload%2Fattachments%2F89130398%2Fworddav7aa655ddfb9be9de05208df9ba4c38e3.png)