Linux on VMware Time Sync

It is a common problem on virtual machines to loose time synchronization with the hardware clock. This can lead to serious problems regarding services operations as well as log consolidation. VMware’ s knowledge base has lot of information regarding the issue. We choose to implement NTP time synchronization on our Datacenter, thus the only option for our virtual machines is to configure NTP to work with VMware Virtual Machines. Below we are going to demonstrate the required configuration on a CentOS 5 server running on VMware VSphere 4.0 infrastructure. 

First we configure the file /etc/ntp.conf with the following content:

tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server swisstime.ethz.ch
server ntp.grnet.gr
driftfile /var/lib/ntp/drift

We also configure the file /etc/ntp/step-tickers .

swisstime.ethz.ch
ntp.grnet.gr

The last, and probably most important step, is to configure the kernel in order to cooperate with VMware kernel and NTP server. BE VERY CAREFULL with the following procedure as you may turn your system unable to boot!!! So, edit the file /etc/grub.conf and on the appropriate line of your running kernel add the option “notsc divider=10“. For example you’ll end up with a line in your grub.conf similar to the following:

kernel /vmlinuz-2.6.18 ro root=/dev/hda2 notsc divider=10

Finally install the new grub config with the grub-install command:

[[email protected] ~]# grub-install /dev/hda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
# this device map was generated by anaconda
(hd0)     /dev/hda
[email protected]!

Leave a Comment

Your email address will not be published.