NTP
The Network Time Protocol is usable in a virtual machine with proper configuration of the NTP daemon. The
following points are important:
• 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 that all your clients are not directly accessing an external
low†stratum NTP server and overloading it with requests.
VMware ESX and ESXi also include an NTP daemon. You can enable and configure NTP from the Virtual
Infrastructure Client. 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
www.certifyme.com
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 VMware ESXi, there is no service console and the NTP daemon runs directly on the
VMkernel.
Lab Scenario
As part of implementing VMware Vsphere 4, you have decided to configure NTP on ESX hosts that you have
created. However, you haven’t installed VMware Vsphere client to configure NTP on ESX hosts using graphical
mode. You need to configure NTP using CLI based console in ESX 4.0.
Lab Objectives
Using your personal lab, configure NTP on an ESX Host
Lab Solution
To configure NTP on an ESX host, follow the steps given below:
Enter the console by pressing ALT+F2.
Login using the root administrator password.
certifyme.com
First we need to edit /etc/ntp.conf file and then the /etc/ntp/step-tickers. But before doing that we need to make
a backup copy of /etc/ntp.conf file using the following command:
cp /etc/ntp.conf /etc/ntp.conf.bk
Now you need to edit /etc/ntp.conf file to include the following lines:
www.certifyme.com
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
server 2.vmware.pool.ntp.org
driftfile /etc/ntp/drift
To edit the file, type nano /etc/ntp.conf
You will enter the write modification mode. Type the lines mentioned above.
www.certifyme.com
Now save the file by pressing CTRL+X and save the file by pressing ‘Y’
www.certifyme.com
Do not write the filename. Just press ‘Enter’
www.certifyme.com
Now we have to edit /etc/ntp/step-tickers file. To do that first we need to back up the existing file. At the
command prompt type:
cp /etc/ntp/step-tickers /etc/ntp/step-tickers.bk
Now edit /etc/ntp/step-tickers file by typing:
nano /etc/ntp/step-tickers
www.certifyme.com
And include the following in the file:
0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
2.vmware.pool.ntp.org
www.certifyme.com
Now exit the file by pressing CTRL+X. Then press ‘Y’ and on the file write prompting, press ‘Enter’
Edit the third file /etc/hosts. By adding the NTP server list in this file, you actually minimize the impact of DNS
lookup failures during NTP synchronization
Edit /etc/hosts by typing nano /etc/hosts and press ‘Enter’
Now add these lines to the file:
0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
www.certifyme.com
2.vmware.pool.ntp.org
Save the file by pressing CTRL+X and then ‘Y’ and then ‘Enter’
www.certifyme.com
After these tasks, we need to enable NTP client for firewall. This opens appropriate ports and enables NTP
daemon to talk to external server.
Enable NTP client for firewall by typing esxcfg-firewall –enableService ntpClient at the command prompt.