VM Time Sync Failing With NTP Server — Fix It Fast
Your VM clock drifts even after setting NTP. We'll walk from a quick restart to deeper fixes.
Quick Fix — Restart the Time Service (30 seconds)
Half the time, this is all you need. The time service just stopped talking to the NTP server. Don't skip this.
On a Windows VM (Server 2016, 2019, 2022 — same steps):
- Open Command Prompt as Administrator. Right-click the Start button, pick Command Prompt (Admin) or PowerShell (Admin).
- Type
net stop w32timeand press Enter. You'll see: "The Windows Time service is stopping." Wait 3 seconds. - Then type
net start w32time. You'll see: "The Windows Time service is starting." - Now force an immediate sync:
w32tm /resync. If it works, you'll see: "The command completed successfully."
On a Linux VM (Ubuntu 20.04/22.04, Debian 11/12, CentOS 7/8):
- Run
sudo systemctl restart chronyif you use Chrony, orsudo systemctl restart ntpif you use the older NTP daemon. - Check status:
sudo chronyc trackingorsudo ntpq -p. Look for a line with an asterisk (*) next to the server. That means it's syncing.
What to expect after this fix: Your VM clock should snap to the correct time within 10 seconds. If it doesn't, move to the moderate fix.
Moderate Fix — Check Integration Services (5 minutes)
If the time keeps drifting back after a few hours, the host is fighting with the guest over time control. This is the classic Hyper-V or VMware problem. The host tells the VM what time it is, and the guest says "no, I'm using NTP," so they argue and the clock goes crazy.
For Hyper-V (Windows Server hosts):
- On the HOST (not the VM), open Hyper-V Manager.
- Right-click the VM, go to Settings.
- Find "Integration Services" in the left panel. Click it.
- Uncheck "Time synchronization." Click OK. This stops the host from messing with the guest's time.
- Now go back inside the VM and re-run the quick fix above. The guest now has full control.
For VMware (vSphere 7 or 8):
- Right-click the VM in vSphere Client, pick Edit Settings.
- Go to VM Options > VMware Tools > Time Synchronization.
- Uncheck "Synchronize guest time with host." Click OK.
- Inside the VM, restart the time service again.
Why this works: The host's time sync tools override NTP settings. I've seen VMs drift 5 minutes in an hour because of this conflict. Disable the host-side sync and let NTP do its job.
Advanced Fix — Manual Registry Edit (15+ minutes)
If you're still reading, something is broken deeper. On Windows VMs, the time service can get stuck with bad configuration. We'll fix it from scratch.
Step 1: Reset the Time Service
- Open Command Prompt as Administrator.
- Type
w32tm /unregister. You'll see: "The service has been unregistered." - Type
w32tm /register. You'll see: "The service has been registered." - Restart the service:
net start w32time.
Step 2: Edit the Registry to Force NTP Server
- Press Windows+R, type
regedit, hit Enter. - Go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters. - Find the string value named
NtpServer. Double-click it. Change the value totime.windows.com,0x9or your own internal NTP server address likentp.yourcompany.com,0x9. The0x9part tells Windows to sync every 300 seconds and use client mode. Don't leave it out. - Click OK.
Step 3: Set It as Reliable Time Source
- Still in Registry Editor, go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config. - Find
AnnounceFlags. Double-click and change it to5. This marks your VM as a reliable time client (not a server). For a server that acts as NTP server, use10, but keep it5here. - Click OK and close Registry Editor.
Step 4: Apply Changes
- Back in Command Prompt, type
net stop w32time && net start w32time. - Then
w32tm /resync. - Verify:
w32tm /query /status. Look for "Source: time.windows.com" and "Stratum: 2" or "3". Stratum 1 means directly from atomic clock — rare for a VM.
On Linux, skip registry. Do this instead:
- Edit the config:
sudo nano /etc/chrony/chrony.conf. Remove anyserverlines and addpool time.google.com iburstor your internal NTP pool. Theiburstmakes it sync fast on first try. - Save (Ctrl+O, then Ctrl+X).
- Restart:
sudo systemctl restart chrony. - Check:
chronyc sources -v. You should see^*next to a server after about 30 seconds. If you see^?, it's not connected — check firewall rules (UDP port 123 outbound).
One more thing — firewall check: Both Windows and Linux need UDP port 123 open outbound to your NTP server. If your VM is on a locked-down network segment (like an enterprise DMZ), the firewall team might block it. Test with
telnet your-ntp-server 123on Windows ornc -u your-ntp-server 123on Linux. If it fails, talk to the network admin.
By now you should have a VM that stays on time. If not, the NTP server itself may be unreachable or misconfigured — that's a different article. The steps above fix 95% of VM time sync issues with NTP.
Was this solution helpful?