How to keep a VMWare VM's clock in sync?

后端 未结 11 1168
無奈伤痛
無奈伤痛 2020-12-13 02:05

I have noticed that our VMWare VMs often have the incorrect time on them. No matter how many times I reset the time they keep on desyncing.

Has anyone else noticed t

相关标签:
11条回答
  • 2020-12-13 02:51

    In Active Directory environment, it's important to know:

    • All member machines synchronizes with any domain controller.

    • In a domain, all domain controllers synchronize from the PDC Emulator (PDCe) of that domain.

    • The PDC Emulator of a domain should synchronize with local or NTP.

    It's important to consider this when setting the time in vmware or configuring the time sync.

    Extracted from: http://www.sysadmit.com/2016/12/vmware-esxi-configurar-hora.html

    0 讨论(0)
  • 2020-12-13 02:53

    If your host time is correct, you can set the following .vmx configuration file option to enable periodic synchronization:

    tools.syncTime = true
    

    By default, this synchronizes the time every minute. To change the periodic rate, set the following option to the desired synch time in seconds:

    tools.syncTime.period = 60
    

    For this to work you need to have VMWare tools installed in your guest OS.

    See http://www.vmware.com/pdf/vmware_timekeeping.pdf for more information

    0 讨论(0)
  • 2020-12-13 02:53

    When installing VMware Tools on a Windows Guest, “Time Synchronisation” is not enabled by default. However – “best practise” is to enable time synch on Windows Guests.

    There a several ways to do this from outside the VM, but I wanted to find a way to enable time sync from within the guest itself either on or after tools install.

    Surprisingly, this wasn’t quite as straightforward as I expected. (I assumed it would be posible to set this as a parameter / config option during tools install)

    After a bit of searching I found a way to do this in a VMware article called “Using the VMware Tools Command-Line Interface“.

    So, if time sync is disabled, you can enable it by running the following command line in the guest:

          VMwareService.exe –cmd “vmx.set_option synctime 0 1″
    

    Additional Notes

    For some (IMHO stupid) reason, this utility requires you to specify the current as well as the new value

    0 = disabled 1 = enabled

    So – if you run this command on a machine which has this already set, you will get an error saying – “Invalid old value“. Obviously you can “ignore” this error when run (so not a huge deal) but the current design seems a bit dumb. IMHO it would be much more sensible if you could simply specify the value you want to set and not require the current value to be specified.

    i.e. VMwareService.exe –cmd “vmx.set_option synctime <0|1>”

    0 讨论(0)
  • 2020-12-13 02:58

    I added the following job to crontab. It is hacky but i think should work.

    */5 * * * * service ntpd stop && ntpdate pool.ntp.org && service ntpd start

    It stops ntpd service updates from service and starts ntpd again

    0 讨论(0)
  • 2020-12-13 02:59

    VMware experiences a lot of clock drift. This Google search for 'vmware clock drift' links to several articles.

    The first hit may be the most useful for you: http://www.fjc.net/linux/linux-and-vmware-related-issues/linux-2-6-kernels-and-vmware-clock-drift-issues

    0 讨论(0)
提交回复
热议问题