I'm trying to run software which needs to get hardware timestamps using ptp. Therefore, I need to have /dev/ptp0 available. I'm running Linux/Ubuntu on a VMWare.
Is there a way to make this work on a VM?
Thanks!
I'm trying to run software which needs to get hardware timestamps using ptp. Therefore, I need to have /dev/ptp0 available. I'm running Linux/Ubuntu on a VMWare.
Is there a way to make this work on a VM?
Thanks!
On
in short: ptp_kvm.ko
# modprobe ptp_kvm
# ls /dev/ptp*
/dev/ptp0 /dev/ptp_kvm
in long:
Red Hat Enterprise Linux 7.5 and later provide a virtual PTP hardware clock (PHC), which enables the guests to synchronize to the host with a sub-microsecond accuracy.
To enable the PHC device, do the following inside a virtual machine:
Set the ptp_kvm module to load after reboot.
# echo ptp_kvm > /etc/modules-load.d/ptp_kvm.conf
Add the /dev/ptp0 clock as a reference to the chrony configuration:
# echo "refclock PHC /dev/ptp0 poll 2" >> /etc/chrony.conf
Restart the chrony daemon:
# systemctl restart chronyd
To verify the host-guest time synchronization has been configured correctly, use the chronyc sources command on a guest.
# chronyc sources
#* PHC0 0 2 377 4 -6ns[ -6ns] +/- 726ns
On
It's now 2021, and I found out that if you're able to compile your own Linux Kernel, there is a built-in driver already. Enable it with make menuconfig:
Device Drivers --> PTP clock support --> KVM virtual PTP clock
Inside a KVM guest, a new /dev/ptp0 device will appear, as well as the following Kernel boot log:
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
PTP clock support registered
Simple answer VMware doesn't support linuxptp emulating ptp devices. Closest thing is find this on this website