Configuring chronyd to use a PTP hardware clock

Published (last updated )

Red Hat Enterprise Linux 7.5 and later provide a virtual PTP hardware clock, which enables the guests to synchronize to the host with a sub-microsecond accuracy, see:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/chap-kvm_guest_timing_management#sect-KVM_guest_timing_management-Host-guest-time-sync (subscription-wall?)

To enable the PHC device, do the following inside a virtual machine:

  1. Set the ptp_kvm module to load after reboot: echo ptp_kvm > /etc/modules-load.d/ptp_kvm.conf
  2. Add the /dev/ptp0 clock as a reference to the chrony configuration: echo "refclock PHC /dev/ptp0 poll 2" >> /etc/chrony.conf
  3. Restart the chrony daemon: systemctl restart chronyd
  4. To verify the host-guest time synchronization has been configured correctly, you can use the chronyc sources command on a guest: chronyc sources