VMware ESXi 5.5无法与Windows 2012 NTP Server同步时间
这次笔者需要面对的环境对时间的同步有比较高的要求, 而虚拟化的环境中时间是比较容易出问题的, 您可以参考上一篇博文为什么Domain controller上的time synchronization非常重要? 笔者的环境里, 经过亲自观察, 如果没有时间同步, 虚拟机与标准时间差距在短短的两个小时之内竟然就偏差了近半个小时!
按照VMware KB 1003063的说法, ESXi 5.5只要在vCenter的vSphere里配好NTP client就可以了.
Note: For ESX 3.5 and above, NTP can be configured from vSphere Client and no longer requires manual configuration.
然而, 这不是真的.
问题描述
===============================================
先介绍笔者的环境:
- 一台安装了Windows 2012的实体机, 它并不是Domain Controller.
- 三台ESXi 5.5.
- 一台安装了vCenter 5.5的Windows 2008 R2虚拟机, 运行在上面的一台ESXi上.
按照文档Configuring Windows Time service to use an internal hardware clock的步骤,我将Windows 2012实体机配置成了使用内部硬件时钟的NTP server. 注意, 微软的文章如何在 Windows Server 中配置权威时间服务器是不work的.
按照VMware KB 1003736的步骤, 将三台ESXi 5.5 配置成了与Windows 实体机NTP server 同步时间.
结果如图:
NTP Server的时间

一台ESXi的时间

懂行的你一定会说, ESXi上只存UTC的时间, 你在vCenter vSphere中看到的时间是convert过了的. 那我就补充一句, 我的vSphere所在的机器的时区已经被设置为与NTP server一样的时区, 而且时间是一样的.
其结论就是, 这个ESXi的NTP有问题, 时间没有同步.
问题排查
==============================================
首先, 需要verify我们的NTP server是否是好的.
于是笔者挑选了一台安装在其中一台ESXi上的虚拟机. 注意, 默认情况下只要安装了VMware Tools, 那么即使你没有开启VMware tools的timesync, 虚拟机也会在某些情况下和其宿主去sync时间的, 详见Configure Time Synchronization Between Guest and Host Operating Systems.
这台ESXi的虚拟机的时间是错误的, 因为ESXi的时间是错误的. –_-||
笔者运行了如下的命令, 使这台虚拟机的时间正确了.
net start w32tm
w32tm /config /manualpeerlist:10.110.69.124 /syncfromflags:manual /reliable:yes /update
w32tm /resync /rediscover
由此, 我们证明了NTP server是正常工作的. 笔者把NTP Server的时间设置的与标准时间相差了几分钟, 所以, 可以避免混淆.
下一步, 笔者在vSphere里尝试了界面能操作的所有相关东西, 都没能让NTP client正常工作.
笔者按照文章Troubleshooting NTP on ESX and ESXi 4.x / 5.x (1005092)所讲的去排查, 没有结果. 直到, 笔者找到这篇文章.
详细步骤不介绍了, 大家可以自己去看, 我只简单说一下:
1. 在/etc/ntp.conf的最后一行添加一行tos maxdist 30.
2. 修改/etc/likewise/lsassd.conf文件, 取消掉#sync-system-time的注释, 显式地设置sync-system-time = yes
3. 重启lsassd服务和ntpd服务.
困扰了笔者好几天的问题终于解决了!
另外, 文章ntpd - Network Time Protocol (NTP) daemon有如下的介绍:
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. When the machine is booted, the chip is used to initialize the operating system time. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. This causes ntpd to exit with a panic message to the system log. The -g option overrides this check and the clock will be set to the server time regardless of the chip time. However, and to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set, an error greater than 1000s will causentpd to exit anyway.
注意粗体的部分, 说如果NTP client的时间与server的时间相差超过1000秒, 那么NTPD就会假设发生了严重的错误, 从而只能手动进行时间调整. 笔者在测试时, 时间差超过了1000秒, 也成功同步了.
命令列表
==============================
cp /etc/ntp.conf /etc/ntp.conf.bak
vi /etc/ntp.conf
“tos maxdist 30”
cp /etc/likewise/lsassd.conf /etc/likewise/lsassd.conf.bak
chmod +w /etc/likewise/lsassd.conf
vi /etc/likewise/lsassd.conf
“sync-system-time = yes”
/sbin/auto-backup.sh./etc/init.d/lsassd restart
./etc/init.d/ntpd restart
参考资料
==============================
Configuring Windows Time service to use an internal hardware clock
http://www.denningelectronics.com/wp-content/uploads/2010/04/TimeService.pdf
VMware ESXi 5.1 will not sync time with Windows 2008 R2 NTP Domain Controller
Guide to configure NTP on ESX servers (1003063)
Configuring the Windows Time Service
http://blogs.msmvps.com/acefekay/2014/04/26/configuring-the-windows-time-service/
Verifying time synchronization across an ESX/ESXi host environment(1003736)
Troubleshooting NTP on ESX and ESXi 4.x / 5.x (1005092)
W32tm
http://technet.microsoft.com/en-us/library/w32tm.aspx
Windows Time Service Tools and Settings
http://technet.microsoft.com/en-us/library/cc773263(v=ws.10).aspx
VMware ESXi 5.5无法与Windows 2012 NTP Server同步时间的更多相关文章
- 创建一个Windows的NTP Server
搭建一个VMware vRealize Suite的时候遇见了不少时间同步的问题, 实验室里网络与外界隔绝, 不能使用公网的NTP服务器, 所以使用文中的方法自己搭建了一个. 蛮好用的. Creati ...
- 体验vSphere 6之1-安装VMware ESXi 6 RC版(转载)
体验vSphere 6之1-安装VMware ESXi 6 RC版 在2015年,各个公司都会发布一系列新的产品,例如Microsoft会发布Windows 10,VMware会发布vSphere 6 ...
- Vmware ESXI 安装Windows
Vmware ESXI 安装Windows >ESXi专为运行虚拟机.最大限度降低配置要求和简化部署而设计.只需几分钟时间,客户便可完成从安装到运行虚拟机的全过程,特别是在下载并安装预配置虚拟设 ...
- VMware ESXi 不支持NTFS格式的USB外接硬盘
本来想搞直通USB外接大容量硬盘(希捷Seagate Backup+ Hub WH 8T),实现在同一部ESXi下,直接将NAS的数据转移到外接硬盘.结果发现虚拟机下的win server系统识别不了 ...
- VMware ESXi 7.0 U2 SLIC & Unlocker Intel NUC 专用镜像
构建 Nano Datacenter 的两大平台 在测试环境或者家庭实验室(Home lab)中使用 VMware vSphere 作为虚拟化平台非常普遍,笔者更倾向使用 Nano Datacente ...
- VMware ESXi 7.0 U2 SLIC & Unlocker Intel NUC 专用镜像 202109 更新
2021.08.31 更新:集成 "vmkusb-nic-fling" 和 "nvme-community",现在只有一个镜像. 2021.06.16 更新:集 ...
- VMware ESXi 7.0 U2 SLIC 2.6 & Unlocker 集成 Intel NUC 网卡、USB 网卡和 NVMe 驱动
ESXi 7 U2 标准版镜像集成 NUC 网卡.USB 网卡 和 NVMe 驱动. 请访问原文链接:https://sysin.org/blog/vmware-esxi-7-u2-nuc-usb-n ...
- VMware ESXi 8.0 SLIC 2.6 & macOS Unlocker (Oct 2022 GA)
ESXi 8.0.0 GA (General Availability) 请访问原文 VMware ESXi 8.0 SLIC 2.6 & macOS Unlocker (Oct 2022 G ...
- RHEL 6.5 PXE 安装调试 VMWARE ESXi 5.1 安装
测试环境:win10/vmware workstation 12 pro 操作系统:RHEL 6.5(PXE服务器) [2016.11.30] [遗留问题] 1.ks.cfg通过本地文件方式加载不成功 ...
随机推荐
- 服务管理(svcadm)
svcs 正在运行的服务 svcs -a 正在运行和没运行的服务 svcs -D 此进程依赖的进程 svcs -D sendmail svcs -d 依赖于此进程的进程 svcs - ...
- 关于在vue里使用脚手架空行、空格会报错的问题
第一种方法: 重新用脚手架安装项目,在命令行里选择Use ESLint to lint your code?这项是输入 n 第二种方法: 找到build文件夹下的 webpack.base.conf ...
- Android Service AIDL
http://blog.csdn.net/liuhe688/article/details/6400385 在Android中,如果我们需要在不同进程间实现通信,就需要用到AIDL技术去完成. AID ...
- TensorFlow——module 'tensorflow' has no attribute 'xxx'
tf.sub()更改为tf.subtract() tf.mul()更改为tf.multiply() tf.types.float32更改为tf.float32 tf.pact()更改为tf.stact ...
- mysql-8.0.12安装和配置
1.下载Mysql8.0.12压缩包.下载地址:https://dev.mysql.com/downloads/file/?id=480557 2.解压文件到本地指定目录.这里我的mysql根目录是: ...
- Kail Linux渗透测试教程之网络扫描和嗅探工具Nmap
Kail Linux渗透测试教程之网络扫描和嗅探工具Nmap 网络扫描和嗅探工具——Nmap Nmap也就网络映射器(Network Mapper),是一个免费开放的网络扫描和嗅探工具.该工具可以扫描 ...
- React Native 系列(七)
前言 本系列是基于React Native版本号0.44.3写的.几乎所有的App都使用了ListView这种组件,这篇文章将学习RN中ListView的平铺样式和分组样式. ListView平铺样式 ...
- WP SyntaxHighlighter 初探
继上篇文章发布后,我随即去网上找了下博客园.CSDN他们用的高亮工具,果然都是用的别人的,SyntaxHighlighter.去官网上看了下,很强大,包含各种经典配色以及多语言.要想在wordpres ...
- hibernate 基于主键的单向一对一关联映射
1.设计表结构 表结构对于基于外键的关联关系来说就少了外键的关联列,并且两张表共用同一个ID,表示一对一. 2.创建Person对象 3.创建IdCard对象 4.写hbm.xml文件 5.生成数据库 ...
- JZYZOJ1237 教授的测试 dfs
http://172.20.6.3/Problem_Show.asp?id=1237 锻炼搜索的代码能力,不错的题. 开始对dfs到底向下传递什么搞不清楚,需要想一下,noip难度的题还有这种情况 ...