|
Configuring Time on ESX Virtual Machines Ever had the problem of clocks wandering in windows hosts and not staying in synch. Well if you disable the windows time service in your vm's and tell them to synch with the host then it should all be good. You can tell them to synch with the host by clicking on the VMWare tools icon in the start bar near the clock and checking the box in the options.
You then need to make sure that the host is getting the correct time from an atomic clock or a verifed time service. The section below will teach you how to configure that. When the server is back up, configure the time service. This is the process I use with my VM's to stop the time wandering, so it should work for you as well. This information was taken from the VMWare.com website a long time ago and is a cut and paste. To configure NTP on the Service Console, follow these steps: 1. Log on to the console as the root user. 2. Edit the file /etc/ntp.conf. The comments in ntp.conf explain the purpose of each section. 3. Find the section titled # --- OUR TIMESERVERS ----- o Copy the existing restrict and server example lines: # restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery # server mytrustedtimeserverip o Remove the # character from the two newly copied lines so they are no longer treated as comments. Use yourservername.domain.com o Update both the new lines with the FQDN address of the NTP server. Repeat this section to add more time servers, if needed. Note: There must be both a restrict and a server line in this section for each NTP server. 4. Save the file. 5. Edit the file /etc/ntp/step-tickers. In this file, list the host name of the NTP servers entered above. 6. Add each NTP server to /etc/hosts to minimize the impact of DNS lookup failures during NTP sychronization. 7. To see the offset (in seconds) between the local clock and the source clock, run: ntpdate -q time_server_name_or_ip_address Note: If the correction resulting from synchronizing the local clock with the time server is large enough, it could affect the operating systems or applications running in virtual machines when they synchronize their clocks with the ESX Server they are running on. 8. To enable the ntp daemon to autostart when the server is rebooted, run: chkconfig --level 345 ntpd on 9. To (re)start it now without rebooting, run: service ntpd restart 10. To set the local hardware clock to the NTP synchronized local system time, run: hwclock --systohc 11. To watch the status of the ntpd process, run: watch ntpq -p Press Ctrl-c to stop watching the process. Note the information in the following columns: o The character in the first column indicates the quality of the source. * indicates the source is the current reference. o remote lists the IP address or host name of the source. o when indicates how many seconds have passed since the source was polled. o poll indicates the polling interval. This value increases depending on the accuracy of the local clock. o reach is an octal number that indicates reachability of the source. A value of 377 indicates the source has answered the last eight consecutive polls. o offset is the time difference between the source and the local clock in milliseconds. polls. Configure a cron job to schedule an hourly ntpd restart This means that the time service (ntpd) will restart every hour and upon restart resync with the time source. You will need to putty into the virtual host to configure this. Creating the cronjob - [root@<machine name> root]# cd .. (enter)
- [root@<machine name> /]# (note the prompt has changed, the root has gone)
- [root@<machine name> /]# crontab -e (enter)
- This will open up the editor vi and you will be looking at a file.
- press i , then press right arrow once
- Add the following (NOTE there is a space on each side of all the * characters)
0 * * * * /sbin/service ntpd restart - Press ESC key twice
- Type :wq! (including the : ) Then ENTER
|