To configure time synchronization via PTP in CentOS:
dnf list installed
sudo dnf install linuxptp
sudo systemctl enable ptp4l
sudo systemctl start ptp4l
sudo mcedit /etc/ptp4l.conf
1
for the slaveOnly
parameter.sudo mcedit /etc/sysconfig/ptp4l
OPTIONS
string, specify the parameters as follows:OPTIONS="-f <configuration file> -i <interface name> -S -s"
where:
-f <configuration file> –
default name and full path of the configuration file.-i <interface name> –
name of the network interface that is used for time synchronization.-S
– enables use of software-based timestamps. You can skip this parameter if you want to use hardware-based timestamps. However, first make sure that the equipment supports this capability.-s
– enables subordinate time synchronization.Example OPTIONS
string:
OPTIONS="-f /etc/ptp4l.conf -i eth0 -S -s"
sudo firewall-cmd --permanent --add-port=319/udp
sudo firewall-cmd --permanent --add-port=320/udp
sudo systemctl restart firewalld
sudo systemctl restart ptp4l