Our development team has just recently started using virtual machines to develop on and one issue we are having is keeping the clocks sync'd. I remember in the past there was an issue with ntpd not working on virtual machines. I also recall it not being a good idea to put ntpdate in as a cron. So my question is, is there another solution to this? Or am i stuck putting in ntpdate into the crontab?
NTP won't work in virtual machines. Period. The virtual machine clock is, well... virtual. It does not behave like the clock of a real machine, and NTP depends on that to work properly.
But the guest drivers you should install in the VM should take care of clock synchronization. At least it is with VirtualBox, and IIRC, VMWare works in the same way. Did you install the guest machine drivers?
Install VMWare tools and set
tools.syncTime = "TRUE"
in your *.vmx file, this lives in your vm install dir
Time is a little more complicated in virtual environments. I would suggest reading the vmware whitepaper on timekeeping.
They have thought this issue through quite thoroughly, including recommended options for ntp and using the vmware tools time support.
We have had very good results with VMware's best practices for timekeeping in Linux Guests on RHEL 4.6
Basically there are a few recommendations:
- Install VMware Tools
- Per your distribution, modify some kernel parameters
- Enable and use NTP
There is also a list of Timekeeping knowledgebase entries.