为什么Win 2012R2虚拟机与hyper-v主机时间不同步?

为什么Win 2012R2虚拟机与hyper-v主机时间不同步?

我们有一台 Win 2012R2 服务器,运行(使用 hyper-v)3 个 Windows 2012R2 VM。

配置

  • Hyper-V 主机配置为使用 NTP 同步其时间be.pool.ntp.org,见左侧屏幕截图
  • 这 3 台虚拟机都启用了时间集成服务,并且我们在 3 台虚拟机中禁用了 NTP 同步(因为这在使用 hyper-v 时间集成服务时会发生这种情况),请参见右侧屏幕截图

Hyper-v 主机 - 时间设置 VM billy - 通过 hyper-v 进行 tim 同步

观察/问题

然而,我们注意到时间同步确实很不稳定。无论是在 Hyper-V 主机上,还是在虚拟机上(虚拟机与主机之间存在偏差)。

以下摘录自hyper-v 主机,昨天 (2016-02-24) 我们设法将时间同步到大约 250 毫秒的增量。然而,今天早上 (2016-02-25 8:40) 增量已经达到 878 毫秒。

C:\Users\Administrator>hostname
hyper-v

C:\Users\Administrator>w32tm /stripchart /computer:be.pool.ntp.org /samples:5 /dataonly
Tracking be.pool.ntp.org [85.88.55.5:123].
Collecting 5 samples.
The current time is 2016-02-24 4:55:41 PM.
16:55:41, +00.2644602s
16:55:43, +00.2594171s
16:55:45, +00.2623687s
16:55:47, +00.2591022s
16:55:49, +00.2590253s

C:\Users\Administrator>w32tm /stripchart /computer:be.pool.ntp.org /samples:5 /dataonly
Tracking be.pool.ntp.org [85.88.55.5:123].
Collecting 5 samples.
The current time is 2016-02-25 8:40:18 AM.
08:40:18, +00.8786692s
08:40:20, +00.8781148s
08:40:22, +00.8855366s
08:40:24, +00.8782784s
08:40:26, +00.8779754s

比利,昨天(2016-02-24)我们设法获得与 hyper-v 主机相同的增量(即 250 毫秒)通过重新启动虚拟机。但是今天早上,增量与 hyper-v 主机不同步,即增量 = 12900 毫秒。其他 2 台虚拟机也存在同样的情况。

C:\Users\Administrator>hostname
billy

C:\Users\Administrator>w32tm /stripchart /computer:be.pool.ntp.org /samples:5 /dataonly
Tracking be.pool.ntp.org [85.88.55.5:123].
Collecting 5 samples.
The current time is 25/02/2016 8:53:13.
08:53:13, +01.2901306s
08:53:15, +01.2903196s
08:53:17, +01.2898293s
08:53:19, +01.2901677s
08:53:21, +01.2904303s

问题

我们做错了什么?为什么这个“简单”的 NTP 同步不起作用?更具体地说:

  1. 为什么 hyper-v 主机的增量高达 800 毫秒?我们真的需要第三部分时间同步才能获得合理的增量吗,正如这里建议的那样https://serverfault.com/a/394980/25073
  2. 为什么尽管打开了时间集成服务(并且关闭了 ntp 同步),虚拟机仍不与 hyper-v 同步?

相关内容