Configuring NTP

We all know how important time keeping is in a Virtual environment and understand the concept of time drift,  so we know it is important to configure your ESX host time source.  We all know that with ESX 3.5 it can now be done via the VI client, however what about earlier versions.

Well to enable your ESX host’s clock to synchronize with the authoritative time source in your environment, the NTP daemon should be configured. To enable this, two files need to be modified and the NTPD server has to be set to start automatically on server reboot.

The easiest approach is to configure this from the command line by echoing the settings into the files, rather than editing the files directly. Use the commands shown below as root or root equivalent:

echo “restrict mask nomodify notrap noquery” >> /etc/ntp.conf
echo “server” >> /etc/ntp.conf

The following line should be added for redundancy

echo “” >> /etc/ntp/step-tickers

Obviously you could just edit the files, but echoing these lines into the files is quick and painless. After doing this we would recommend you ‘cat’ the files to review your changes. This will show the contents of the files in the screen.

cat /etc/ntp.conf

Make sure the entries echoed into the file are correct.
The next step is to open the firewall on the server to allow NTP traffic:

esxcfg-firewall --enableService ntpClient

Set the NTP service to auto-start when the server is rebooted:

chkconfig --level 345 ntpd on

Restart the NTP daemon:

service ntpd restart

Synchronize your hardware clock to the system clock.

hwclock –systohc