Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 '09 at 10:08
1  
5 what faster? 5x? 5 days? 5 seconds? –  Mark Henderson Dec 29 '09 at 10:23
    
Ha ha, yes sorry, 5 minutes faster –  stead1984 Dec 29 '09 at 10:36
add comment

6 Answers 6

up vote 10 down vote accepted
+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

share|improve this answer
    
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 '10 at 15:54
    
How much is it drifting? –  ta.speot.is Feb 4 '10 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 '10 at 11:08
    
Is the VM server under heavy load? –  ta.speot.is Feb 5 '10 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 '10 at 12:41
show 2 more comments

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.
share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 '09 at 14:50
    
NTP server on the hosts which sets the local clock. –  LapTop006 Dec 29 '09 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 '10 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 '13 at 22:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.