Virtual guest: NTP sync with host

Duncan Innes asked:

Is there any way to get a virtual guest to only query it’s current host for NTP?

I’m not talking about configuring ntp.conf with the host’s IP here either as VLAN’s & firewalls may block that traffic. Also migration to a different host would require ntp reconfig & restart. A direct (intercepted?) query from the guest to the host.

I’ve tried various NTP solutions and it seems to me (theoretically) that it might be best for a guest to query only it’s current host for an NTP sync (notwithstanding the VMware advice not to use their sync-with-host option).

It might/would require a version of NTP that is virt-aware.

Only one NTP source would be required as the guest wouldn’t be running if the host wasn’t available.

My answer:

You can’t really use NTP here because you can’t know where the “host” is on the network.

Some hypervisors provide a way to synchronize time with the host. For instance, VMware provides a userspace tool in VMware Tools for this purpose. KVM has a paravirtualized RTC. And so on.

Though in my experience these are all less than perfect, and trusting the host to have the correct time is a bad idea, necessitating running NTP in every VM (and having it use reliable servers) anyway.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.