Synchronize a Virtualized Domain Controller with External Time Servers

In: Active Directory|VirtualBox|Windows
Written by: Taylor Gerring


19 Aug 2008

Sitting on my couch one night, I noticed that the time on my laptop was about 10 minutes slow compared to every other time source in my house (mobile phone, cable box, etc.)… Since I’m running a domain environment, I knew that most of my OS installations would be syncing to the domain controller, so I was a bit baffled by the prospect that things were not syncing. After a quick RDC to my PDC, I noticed that it was the culprit of the slowed time. First, a quick Google on how to synchronize with an external time source. With that figured out, time to pick out a reliable time source. Now let’s run it:

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL
w32tm /config /update
w32tm /resync

Well that was easy… Oops, the time just re-sync’d back. After a little digging, it dawned upon me that by installing VirtualBox Guest Additions, VirtualBox was attempting to synchronize the guest OS time to the host OS. From the manual:

Time synchronization
With the Guest Additions installed, VirtualBox can ensure that the guest’s system time is better synchronized. This fixes the problem that an operating system normally expects to have 100% of a computer’s time for itself without interference, which is no longer the case when your VM runs together with your host operating system and possibly other applications on your host. As a result, your guest operating system’s timing will soon be off significantly. The Guest Additions will re-synchronize the time regularly.

Unfortunately, this is causing my time synchronization headaches. The solution for the time being was to re-run the re-sync detailed above, but also adding in this snippet:

w32tm /resync /computer:HOSTCOMPUTERIP

This forced the host computer to synchronize to its time source (the domain controller) and all is well. You can use the above snippet to force other computers to manually update in case of access problems related to time desyncronization. But most computers should start updating almost immediately.

Update: After some more digging, I found a way to disable time synchronization from guest to host. Run the following command on your host, replacing <vmname> with the target Virtual Machine:

VBoxManage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"

3 Responses to Synchronize a Virtualized Domain Controller with External Time Servers

Avatar

cboese

January 5th, 2010 at 8:30 am

Check the xml file of the machine if its not working, because it gets corrupted when being manipulated from the command line very easily.

Avatar

Paul

July 20th, 2010 at 11:43 pm

Hi :) Any ideas on how to fix this when PDC is a guest on Hyper-V server 2008 R2?
Got my brain cracked tonight when it repeatedly goes off-sync with a local radio-clock NTP…

Avatar

Taylor Gerring

July 21st, 2010 at 10:19 am

If the issue is the guest sync’ing to the host, can’t you just force time sync the host if you can’t disable syncing between host/guest?

Comment Form

@TaylorGerring


Unless specified otherwise, this website is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.
Stop SOPA
Unless specified otherwise, this website is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.