8

I have a domain controller running in VM on Hyper-V, the time seems to be steadily getting faster, over the X-mas period it's 5 faster, which seems odd!

I know how to change the time and I belive we setup an NTP server on the DC and ensured time-sync was turned off on Hyper-V.

I don't really want to keep setting the time. Is there a reason why the time is fast?

3
  • I have already asked a similar question once before (see below) serverfault.com/questions/92617/… What I would like to know is why it's fast again?
    – stead1984
    Dec 29, 2009 at 10:08
  • 1
    5 what faster? 5x? 5 days? 5 seconds? Dec 29, 2009 at 10:23
  • Ha ha, yes sorry, 5 minutes faster
    – stead1984
    Dec 29, 2009 at 10:36

6 Answers 6

12
+50

I know how to change the time and I belive we setup an NTP server on the DC and ensured time-sync was turned off on Hyper-V.

Virtual Machines can't track time. You may want to try setting up the DC up as an NTP client. This blog might be useful.

http://www.aperture.ro/index.php/2009/01/windows-time-sync-hyper-v-enabled-domain-controller-dilemma/

The guy waffles for a bit, but scroll down and you will get the necessary registry entries. This KB article seems a bit more authorative.

http://support.microsoft.com/kb/223184

There is also a Technet article on configuring a DC to use NTP:

http://technet.microsoft.com/en-us/library/cc784553(WS.10).aspx

As for why this happens, VMware has a writeup about timekeeping with VMs (not HyperV, but the concepts still apply).

http://www.vmware.com/pdf/vmware_timekeeping.pdf

7
  • I followed the steps in the links and it worked lovely, however it seems to be drifting again. It appears that it isn't polling regularly or at all anymore. Any idea's? I am also using time.windows.com! Should I use a stratum 2 server on ntp pool?
    – stead1984
    Feb 4, 2010 at 15:54
  • How much is it drifting? Feb 4, 2010 at 22:46
  • It's 5 minutes slow now. Don't know how much it's drifting by each day as I haven't been in the office for a while.
    – stead1984
    Feb 5, 2010 at 11:08
  • Is the VM server under heavy load? Feb 5, 2010 at 12:02
  • Not really the host is running maximum at any time 4 VM's; 1x File Server, 1x DC (70 users, 40 computers, Routing & Remote Access) 1x Messaging Server and 1x Server hosting our bespoke software which is hardly doing anything. I'm considering syncing time from the host and having the host get time from an external NTP server? How do I go about removing the NTP client setup from your answer from my VM'ed DC?
    – stead1984
    Feb 5, 2010 at 12:41
4

With VM's you always want the host to sync the guests, it's the only reliable way.

I realise this can create an infinite loop if the hosts are member servers of the domain, but every workaround I've tried (VMware server in my case) doesn't actually solve the problem.

If you run a good monitoring system (eg, Nagios) consider checking clock skew against the global NTP pool, or a reliable *nix based system (that's not a VM itself) running the NTPD package.

4
  • I've been advised not to sync the guests with the hosts. I take it you use the local clock of the hosts or do you use an NTP server on the hosts? My hosts aren't domain members.
    – stead1984
    Dec 29, 2009 at 14:50
  • NTP server on the hosts which sets the local clock.
    – LapTop006
    Dec 29, 2009 at 23:05
  • 1
    I think you or your advisor is confusing the local clock within the vm to the clock of the hardware server. You only want to not sync with the parent OS if you are syncing with an external non vm source.
    – JamesRyan
    Jan 5, 2010 at 15:22
  • This answer may have been appropriate when written, but it is not best practice today. VMware recommends using ntp in guests, as does Red Hat for KVM guests. Dunno about hyper-v though.
    – Dan Pritts
    Nov 18, 2013 at 22:43
3

VMs never keep accurate time (meaning they always have bad virtual CPU stats too), the only way to make sure they're accurate enough is to have them sync with a physical clock. This can be done either by syncing with the host and having all the hosts time correct via NTP or via having the VMs get their time via NTP with frequent checks - either method works but the former is probably the easiest.

3

All the prior answers seem reasonable, but let me add this.

Indeed, timekeeping inside a VM is a problematic issue, which brings up multiple possible solutions.

  1. Set up another DC on an iron box, and have that be the authoritative time source
  2. Set your VM DC to sync time from an external source more frequently - say every 10 minutes. Registry reference in this KB: 816042
  3. Even simpler, use something like an Atomic Clock sync tool on the DC, and set its frequency to 10-15 minutes
  4. Another question on Serverfault had a similar problem, and ruled out the hardware clock by running the same VM in VMware Server, and found that the problem lies with Hyper-V.
1

Is there a reason you can't sync to an external source, such as one of the Internet time services? If you're having such a problem with drift just sync hourly, or whatever other period you feel might be suitable.

0

Globally we have the same problem under VMWare, it's due to the CPU Time synchronisation. In fact you need to set up your Guess parameters under Hyper-V to be sync with your Host CPU clock frequency.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .