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!
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
Simple answer VMware doesn't support linuxptp emulating ptp devices. Closest thing is find this on this website
FYI Running linuxptp on qemu-kvm
Run two virtual machines for GM and Slave and use recent Fedora, RHEL 6.5 7.0 Use virtual NIC emulationg e10000 (supports software timestamping) don't forget to define appropriate firewall rules to allow multi-cast dont' expect high precision and accuracy
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
© 2022 - 2024 — McMap. All rights reserved.