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:

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:

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:
