Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my scenario: I run multiple VMs on my workstation to simulate the production environment. At the end of the day I sleep my workstation (with my VMs running in the background) at 6PM. When I return to the office the next morning at 8AM and wake the workstation, all of my VMs are at 6PM.

Tiring of resetting NTP or simply remembering to force an update, I put the following in a 5 minute cron

service ntp stop && ntpd -gq && service ntp start

Here is my /etc/ntp.conf

tinker panic 0

driftfile /var/lib/ntp/ntp.drift

logfile /var/log/ntpd.log

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See for
# more information.

# Use Ubuntu's ntp server as a fallback.

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <>
# might also be helpful.
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict mask notrust

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth

Is there a better way to accomplish this?

share|improve this question
What virtualization technology/suite are you using? VMware? – ewwhite Oct 6 '13 at 12:32
Yes, VMWare Workstation 9. I've not had any luck with their timesync software and they recommend using NTP :x – chrisan Oct 7 '13 at 12:26
I don't understand why you don't suspend the guests. – ewwhite Oct 7 '13 at 12:56

If you are using VMware Workstation (or VMware vSphere), there are specific ways to handle timekeeping on your (Linux) virtual machines. However, that is not enough for your sleeping situation. NTP inside of the guest-only doesn't help here.

You absolutely need to install the VMware guest tools on the guest virtual machines and ensure that NTP running on the host. This will fix the sleeping problem and the drift that occurs when the guest is suspended.


Oh, it's Ubuntu... I find that a lot of Ubuntu users don't install the native VMware tools suite. Here are the steps (and a video) to accomplish this.

share|improve this answer
I have VMware guest tools installed and they are running, didn't realize my host (Win7) needs to have ntp installed. I'll give that a try and report back, thanks – chrisan Oct 7 '13 at 19:15
Well no luck, I used their exact config mentioned. I did not have the server ... and fudge ... lines they said to comment out. I also didnt see where they said NTP has to run on the host (win7) and they list as remote NTP servers to use. Or were you saying to not disable VMware's timesync and use their tool instead of NTP? Currently it is install and timesync is disabled per that doc – chrisan Oct 9 '13 at 12:11
Use timesync, then. I don't really understand what you're doing. Are you shutting your computer down? Putting it hibernate mode? Why not just suspend your VMs? – ewwhite Oct 9 '13 at 12:26
Picture a laptop, close it's lid it goes to sleep, open it's lid it wakes up. I'm not suspending all my VMs for the same reason I'm not closing all my programs. Basically I'm asking if theres a way to have NTP update in large steps automatically instead of my cron that does service ntp stop && ntpd -gq && service ntp start If no, then I'll keep what I have or try VMWare's timesync – chrisan Oct 9 '13 at 17:00

Your ntp.conf should work! I've found that sometimes ntpd will take quite a while to correct a substantial time difference. (I've seen it take upwards of 12 hours to actually make the correction).

You should find that if you leave it overnight (without your cron job) then it will eventually correct itself.

share|improve this answer
Thanks, but that defeats the whole purpose of sleeping the computer. If I leave it on all the time ntp works well enough on it's own. Think of this like my laptop I close and only open again the next day when I want to work again :) – chrisan Oct 7 '13 at 12:28
Yes I know what you mean, I have the exact same problem with my Hyper-V server. I don't like running it overnight, so when I turn it on the next day, all my VM's are back by ~12 hours. Unfortuantely I don't think ntpd is really designed to fix frequent substantial time lapses. – blacklight Oct 7 '13 at 21:55

Using iburst would also help set the clock more quickly, but this is only effective on service start.

Most applications will probably want to specify the iburst option with the server command. With this option a volley of messages is exchanged to groom the data and set the clock in about ten seconds.

You would need to figure out a way to restart the service on APCI resume. (You could try this.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.