I have a project that wishes to force the times of a set of private NTP servers to demonstrate how NTP (and our software) reacts to various time changes and differences, network lag, etc.
Normally, we'd set up a virtual network of VMs to demonstrate our software, but I can't seem to find one that will allow NTP to run independently in each VM. For this we'd need a software clock.
So far, I've looked at:
-
Docker – ties their clock to the hardware clock of the host, privileges are one issue, but the main issue is that if the clock is changed all clocks running in all VMs on that host are changed.
-
VirtualBox – This answer suggests that even with guest-additions, the lack of a high-resolution clock would make this impossible.
Is there any software that can virtualize a hardware clock for NTP, or otherwise run independent clocks on the same machine at the same time?
Best Answer
It is not clear if you are interested in
how ntp behaves under some set of circumstances.
how your software behaves due to time changes and you have decided the best way to introduce these time changes is fiddling with ntp.
If you are simply interested in the former check out ntpdsim. It is part of the ntp reference implementation:
If you are interested in the later, use ntpdsim to see how your ntp servers will react to the changes. Then take this information and use a cronjob or something similar to modify the clocks on your vms according to the information you learned from the ntpdsim runs...
https://www.eecis.udel.edu/~mills/ntp/html/ntpdsim_new.html