Windows Server 2019 Active Directory (AD域)時間不同步的解決方法


Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

 

1)首先確認虛擬化底層的時間是否准確,因為所有虛擬機會自動同步虛擬主機的時間。

2)在所有AD服務器上開啟時間同步功能

一、找到適合的NTP服務器

首先需要找一個適合自己網絡環境的NTP服務器,因為不同的網絡會有不同的NTP服務器起作用,檢測NTP服務器的方法為在AD上運行w32tm /stripchart /computer:以下NTP服務器的名字,如

w32tm /stripchart /computer:ntp.dtops.cc #若是可以使用會顯示如下圖

Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

若是不可用會顯示如下圖:
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

二、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

Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

三、設置主域控制器與國家授時中心服務器時間同步,同步周期為1天。

1、 添加時間服務器

Win+R 調出運行窗口輸入 regedit 打開注冊表

注冊表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers在右邊窗口點右鍵新建“字符串值”,將此“字符串值”命名為0。雙擊此新建的“字符串值”,輸入:ntp.dtops.cc,保存。將“默認”(即第一個“字符串值”)修改為0即可,刪除其他所有的值只保留如圖所示的值
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

2、 指定時間源

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters,修改鍵NtpServer的值為ntp.dtops.cc
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

3、 設置校時周期

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval 修改鍵SpecialPollInterval的值為十進制的600(即為600秒,10分鍾)
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

四、設置權威服務器

1、 設置權威服務器

在域控服務器上打開注冊表,找到鍵值

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config 修改鍵AnnounceFlags的值為十進制的10。
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

2、 啟用 NTPServer

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer,修改鍵Enabled的值為十進制的1
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

所有注冊表快速導入

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 打開組策略管理
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

2、 計算機配置—管理模板—系統—Windows時間服務,雙擊“全局配置設置”,選擇“已啟用”。
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

修改MaxNegPhaseCorrection的值為600(即為600秒,10分鍾)修改MaxPosPhaseCorrection的值為600(即為600秒,10分鍾)修改AnnounceFlags的值為5點“應用”,“確定”。
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

3、 計算機配置—管理模板—系統—Windows時間服務—時間提供程序,“啟用Windows NTP客戶端”,選擇“已啟用”。
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

“配置Windows NTP客戶端”,選擇“已啟用”。修改NtpSever的值為ntp.dtops.cc,修改Type的值為NTP,修改SpecialPollInterval的值為600(10分鍾)
Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

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   #手工同步時間

Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

域內的客戶端想要同主域時間同步,執行下面的命令,返回成功執行了命令即為成功

PS C:\Windows\system32> gpupdate /force           #更新組策略
PS C:\Windows\system32> w32tm /resync /rediscover    #手動同步時間

Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

強制同步主域服務器時間的方法

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

Windows Server 2019 Active Directory (AD域)時間不同步的解決方法

注意時間若想成功同步,時間不能跟標准時間差別太大,在范圍內的才能成功同步。

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 關閉方法


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM