Windows Server 2019 Active Directory (AD域)时间不同步的解决方法

1)首先确认虚拟化底层的时间是否准确,因为所有虚拟机会自动同步空间的时间。

2)在所有AD主机上开启时间同步功能

一、找到适合的NTP主机

首先需要找一个适合自己网络环境的NTP主机,因为不同的网络会有不同的NTP主机起作用,检测NTP主机的方法为在AD上运行w32tm /stripchart /computer:以下NTP主机的名字,如

w32tm /stripchart /computer:ntp.dtops.cc #若是可以使用会显示如下图

若是不可用会显示如下图:

二、CMD命令指定NTP主机

找到适合自己网络的可用NTP主机后,假设找到s1a.time.edu.cn为可用NTP主机,在AD主机上开启时间同步,运行如下命令

PS C:\Windows\system32> w32tm /config /manualpeerlist:ntp.dtops.cc /syncfromflags:manual /reliable:yes /update PS C:\Windows\system32> w32tm /config /update PS C:\Windows\system32> net stop w32time PS C:\Windows\system32> net start w32time PS C:\Windows\system32> w32tm /resync /rediscover PS C:\Windows\system32> w32tm /query /source

三、设置主域控制器与国家授时中心主机时间同步,同步周期为1天。

1、 添加时间主机

Win+R 调出运行窗口输入 regedit 打开注册表

注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers在右边窗口点右键新建“字符串值”,将此“字符串值”命名为0。双击此新建的“字符串值”,输入:ntp.dtops.cc,保存。将“默认”(即第一个“字符串值”)修改为0即可,删除其他所有的值只保留如图所示的值

2、 指定时间源

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters,修改键NtpServer的值为ntp.dtops.cc

3、 设置校时周期

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval 修改键SpecialPollInterval的值为十进制的600(即为600秒,10分钟)

四、设置权威主机

1、 设置权威主机

在域控主机上打开注册表,找到键值

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config 修改键AnnounceFlags的值为十进制的10。

2、 启用 NTPServer

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer,修改键Enabled的值为十进制的1

所有注册表快速导入

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers] @="0" "0"="ntp.dtops.cc" [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\Parameters] "NtpServer"="ntp.dtops.cc" "Type"="NTP" [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpClient] "SpecialPollInterval"=dword:00000258 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\Config] "AnnounceFlags"=dword:0000000a [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer] "Enabled"=dword:00000001

五、配置组策略,设置时间同步

1、 打开组策略管理,Win+R 调出运行窗口输入 gpedit.msc 打开组策略管理

2、 计算机配置—管理模板—系统—Windows时间服务,双击“全局配置设置”,选择“已启用”。

修改MaxNegPhaseCorrection的值为600(即为600秒,10分钟)修改MaxPosPhaseCorrection的值为600(即为600秒,10分钟)修改AnnounceFlags的值为5点“应用”,“确定”。

3、 计算机配置—管理模板—系统—Windows时间服务—时间提供程序,“启用Windows NTP客户端”,选择“已启用”。

“配置Windows NTP客户端”,选择“已启用”。修改NtpSever的值为ntp.dtops.cc,修改Type的值为NTP,修改SpecialPollInterval的值为600(10分钟)

4、cmd命令在域控和客户端完成检测

域控上运行下面三条命令检测,返回成功执行了命令即为成功。若是返回此计算机没有重新同步,因为没有可用的时间数据。请排查上述文档中一步时间主机是否可用,和五-4步主机是否正确,看w32tm /query /source命令返回的结果是否正确。

PS C:\Windows\system32> gpupdate /force         #更新组策略 PS C:\Windows\system32> w32tm /query /source        #查看时间主机是否为更改过的ntp.dtops.cc PS C:\Windows\system32> w32tm /resync /rediscover   #手工同步时间

域内的客户端想要同主域时间同步,执行下面的命令,返回成功执行了命令即为成功

PS C:\Windows\system32> gpupdate /force           #更新组策略 PS C:\Windows\system32> w32tm /resync /rediscover    #手动同步时间

强制同步主域主机时间的方法

PS C:\Windows\system32> net time \\172.25.106.22 /SET /y

注意时间若想成功同步,时间不能跟标准时间差别太大,在范围内的才能成功同步。

1、系统时间比标准时间系统时间晚14小时59分钟之内

2、系统时间比标准时间早30分钟之内

NTP主机参考 210.72.145.44  (国家授时中心主机IP地址) ntp.sjtu.edu.cn 202.120.2.101 (上海交通大学网络中心NTP主机地址) s1a.time.edu.cn北京邮电大学 s1b.time.edu.cn清华大学 s1c.time.edu.cn北京大学 s1d.time.edu.cn东南大学 s1e.time.edu.cn清华大学 s2a.time.edu.cn清华大学 s2b.time.edu.cn清华大学 s2c.time.edu.cn北京邮电大学 s2d.time.edu.cn西南地区网络中心 s2e.time.edu.cn西北地区网络中心 s2f.time.edu.cn东北地区网络中心 s2g.time.edu.cn华东南地区网络中心 s2h.time.edu.cn四川大学网络管理中心 s2j.time.edu.cn大连理工大学网络中心 s2k.time.edu.cn CERNET桂林主节点 s2m.time.edu.cn 北京大学 Africa — africa.pool.ntp.org (53) Antarctica — antarctica.pool.ntp.org (0) Asia — asia.pool.ntp.org (298) Europe — europe.pool.ntp.org (2967) North America — north-america.pool.ntp.org (960) Oceania — oceania.pool.ntp.org (128) South America — south-america.pool.ntp.org (61)

3)对于有些客户端Windows Times服务会自动停止,可以尝试重新注册一下此服务项

1.首先,运行如下命令删除时间服务:

W32tm /unregister

2.然后,再运行如下命令加载默认时间配置服务:

W32tm /register

4、开启w32tm debug模式并打印日志到文件的方法

w32tm /debug /enable /file:c:\w32time.log /size:10000000 /entries:0-116   #开启方法 w32tm /debug /disable 关闭方法

推荐站内搜索:免费域名、免费的asp空间、vps虚拟主机、动态ip服务器、免费静态空间、域名查询、免备案虚拟主机、美国服务器服务器国外、虚拟主机测评、