Enable VMWare time sync from command line

Virtual machines and NTP do not go easily well together. Machines paused for extended periods tend to loose the ntp sync since the difference grows too much.

 

Also from VMware Docs the following info might be clarificatory:

  • Do not configure the virtual machine to synchronize to its own (virtual) hardware clock, not even as a fallback with a high stratum number. Some sample ntpd.conf files contain a section specifying the local clock as a potential time server, often marked with the comment “undisciplined local clock.” Delete any such server specification from your ntpd.conf file.
  • Include the option tinker panic 0 at the top of your ntp.conf file. By default, the NTP daemon sometimes panics and exits if the underlying clock appears to be behaving erratically. This option causes the daemon to keep running instead of panicking.
  • Follow standard best practices for NTP: Choose a set of servers to synchronize to that have accurate time and adequate redundancy. If you have many virtual or physical client machines to synchronize, set up some internal servers for them to use, so hat all your clients are not directly accessing an external low-stratum NTP server and overloading it with requests

And :

In ESX, the ESX NTP daemon runs in the service console. Because the service console is partially virtualized, with the VMkernel in direct control of the hardware, NTP running on the service console provides less precise time than in configurations where it runs directly on a host operating system. Therefore, if you are using native synchronization software in your virtual machines, it is somewhat preferable to synchronize them over the network from an NTP server that is running directly on its host kernel, not to the NTP server in the service console. In ESXi, there is no service console and the NTP daemon runs directly on the VMkernel, so it works well as a NTP server for virtual machines.

Quoted from : http://www.vmware.com/files/pdf/techpaper/Timekeeping-In-VirtualMachines.pdf

Easy way (And I think best solution is)

  1. Setup NTP client to ESX
  2. Install VMWARE tools on the Guests ( recommended anyways).
  3. In Linux ( cause that’s what we care about ) run vmware-toolbox-cmd timesync enable

To force a sync run hwclock command.

nJoy 🙂 !

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *