设为首页 收藏本站
查看: 1971|回复: 0

[经验分享] VMware ESX/ESXi Server与虚拟机时间同步问题

[复制链接]

尚未签到

发表于 2018-6-3 10:26:02 | 显示全部楼层 |阅读模式
公司使用了VMware Vsphere 4.1,虚拟机是windows server 2003,并加入了网域中,最近发现虚拟机的本机时间会比DC慢了几分钟,并且该虚拟机所在的ESXi主机也比DC慢了一些,怀疑虚拟机同步了ESXi主机时间,影响了虚拟机的本地时间(虚拟机会周期性与ESXi主机进行时间同步),于是在虚拟机的Vmware tools的选项中,禁止了与ESXi主机的时间同步。本以为问题解决,但后来发现虚拟机的时间偶尔还是会和ESXi主机同步,导致慢几分钟。而且该ESXi主机的NTP SERVER也设置了DC的IP,与DC时间同步,但根本就同步不成功。于是在网上搜索并与VMware工程师联系,得到了以下两个重要的KB:
  1.   如何让ESX/ESXi主机与DC时间同步:http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1035833&sliceId=1&docTypeID=DT_KB_1_1&dialogID=228703032&stateId=0 0 228699835
  Configure ESX/ESXi NTP and Likewise Clients
  Configure ESX/ESXi to synchronize time with the Windows server Active Directory Domain Controller:
  1.   Connect to the ESX/ESXi host or vCenter Server using the vSphere Client.
  2.   Select the ESX/ESXi host in the inventory.
  3.   Click the Configuration tab.
  4.   Under the Software heading, click Time Configuration.
  5.   Click Properties.
  6.   Ensure that the NTP Client Enabled option is selected.
  7.   Click Options.
  8.   Click NTP Settings.
  9.   Click Add and specify the fully qualified domain name or IP address of the Windows server Domain Controller(s).
  10. Click OK.
  11. Click OK to save the changes.
  Additional configuration must be done from the command line.
  1.   Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 (1017910).
  2.   Open the file /etc/ntp.conf in a text editor. For more information, see Editing configuration files in VMware ESX (1017022).
  3.   Add the tos maxdist command on its own line:

tos maxdist 30
  4.   Save the configuration file.
  5.   Make the file /etc/likewise/lsassd.conf writable using the command:

chmod +w /etc/likewise/lsassd.conf
  6.   Open the file /etc/likewise/lsassd.conf in a text editor. For more information, see Editing configuration files in VMware ESX (1017022).
  7.   Locate the sync-system-time option, uncomment it, and set the value to no:

sync-system-time = no
  8.   Save the configuration file.
  9.   On ESXi, save the configuration changes to the boot bank so they persist across reboots using the command:

/sbin/auto-backup.sh
  10. Restart the ntpd and lsassd service for the configuration change to take effect using the commands:

service lsassd restart
service ntpd restart

Note: To restart the ntpd and lsassd services on an ESXi host use the below commands:

./etc/init.d/lsassd restart
./etc/init.d/ntpd restart
  2.如何完全禁止虚拟机与ESX/ESXi主机的时间同步
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1189
  Select the virtual machine in the VMware Infrastructure Client inventory. On the Summary tab, clickEdit Settings, then click the Options tab and select General (under Advanced). ClickConfiguration Parameters, then click Add Row and add this information:
  tools.syncTime = "0"
time.synchronize.continue = "0"
time.synchronize.restore = "0"
time.synchronize.resume.disk = "0"
time.synchronize.shrink = "0"
time.synchronize.tools.startup = "0"
  time.synchronize.resume.host = "0"
  如果单单在VMware tools 中禁止虚拟机与ESX/ESXi主机时间同步,仅会禁止周期性的时间同步,但当以下情况发生时,虚拟机还是会与ESX/ESXi主机时间同步:
  1)当暂停VMs后,下次恢复VMs时,它会与主机时间同步。
2)当使用vMotion迁移主机,制作快照,恢复快照,收缩虚拟硬碟,或者重启VMware tools Service,或重启VMs后,时间会重新和主机同步
  个人建议:使用第一个KB让ESX/ESXi主机与DC时间同步,不要使用第二个KB。然后在虚拟机的VMware tools中禁止虚拟机与ESX/ESXi主机同步就可以了。因为要考虑到,如果有虚拟长时间关机或者脱域,当虚拟机开机后,就不一定能成功与DC时间同步了,但此时它可以同步ESX/ESXi主机的时间。
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-508877-1-1.html 上篇帖子: VMware驱动程序"vmci.sys"的版本不正确 怎么解决 下篇帖子: scvmm添加vmware集群
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表