建議使用 ntpd for windows,這是一個ntp的windows版,操作和linux相似
下載:https://www.meinbergglobal.com/english/sw/ntp.htm#ntp_nt
目前版本是ntp-4.2.8p7,經測試可以在win7上使用。
1、下載安裝,都很簡單,下一步完成。
2、配置,基本和linux差不多,安裝應用目錄

點擊Edit Ntp Configuration,進行ntp配置,參考linux配置
#默認拒絕所有來源的任何訪問 restrict default noquery nopeer nomodify notrap restrict -6 default noquery nopeer nomodify notrap # allow status queries and everything else from localhost # 允許本地訪問 restrict 127.0.0.1 restrict -6 ::1 # if you need to allow access from a remote host, you can add lines like this: # restrict <IP OF REMOTE HOST> # 設置自己需要訪問的網段地址 restrict 10.102.145.0 mask 255.255.255.0 nomodify restrict 10.20.0.0 mask 255.255.0.0 nomodify # Use drift file driftfile "C:\Program Files (x86)\NTP\etc\ntp.drift" # your local system clock, could be used as a backup # (this is only useful if you need to distribute time no matter how good or bad it is) # 按自己需求增加上層NTP服務器 server 0.centos.pool.ntp.org prefer server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org server us.npt.org.cn # but it should operate at a high stratum level to let the clients know and force them to # use any other timesource they may have. fudge 127.127.1.0 stratum 10 # End of generated ntp.conf --- Please edit this to suite your needs
使用菜單中的Restart Ntp Server 重啟服務。
使用Quick NTP Status查看NTP服務的狀態,其實就是 watch ntpq -p;如果如下圖,基本就成功了

然后就是你的服務器端設置了。
下面再說下一些術語解釋:
# 1. 關於權限設定部分
# 權限的設定主要以 restrict 這個參數來設定,主要的語法為:
# restrict IP mask netmask_IP parameter
# 其中 IP 可以是軟件地址,也可以是 default ,default 就類似 0.0.0.0
# 至於 paramter 則有:
# ignore :關閉所有的 NTP 聯機服務
# nomodify:表示 Client 端不能更改 Server 端的時間參數,不過,
# Client 端仍然可以透過 Server 端來進行網絡校時。
# notrust :該 Client 除非通過認證,否則該 Client 來源將被視為不信任網域
# noquery :不提供 Client 端的時間查詢
# notrap :不提供trap這個遠程事件登入
# 如果 paramter 完全沒有設定,那就表示該 IP (或網域)“沒有任何限制”
restrict default nomodify notrap noquery # 關閉所有的 NTP 要求封包
restrict 127.0.0.1 #這是允許本級查詢
#在192.168.0.1/24網段內的服務器就可以通過這台NTP Server進行時間同步了
restrict 192.168.0.1 mask 255.255.255.0 nomodify
# 2. 上層主機的設定
# 要設定上層主機主要以 server 這個參數來設定,語法為:
# server [IP|HOST Name] [prefer]
# Server 后面接的就是我們上層 Time Server 啰!而如果 Server 參數
# 后面加上 perfer 的話,那表示我們的 NTP 主機主要以該部主機來作為
# 時間校正的對應。另外,為了解決更新時間封包的傳送延遲動作,
# 所以可以使用 driftfile 來規定我們的主機
# 在與 Time Server 溝通時所花費的時間,可以記錄在 driftfile
# 后面接的文件內,例如下面的范例中,我們的 NTP server 與
# cn.pool.ntp.org聯機時所花費的時間會記錄在 /etc/ntp/drift文件內
server 0.pool.ntp.org
server 1.pool.ntp.org
注:windows原生的做ntp服務不是很穩定,建議重要環境不要使用,不然要死翹翹
1. 修改注冊表項
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
Enabled 設定為 1(默認0)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\
AnnounceFlags 設定為 5 (默認 10)
2. 禁用防火牆或設置例外,UDP 123端口。
3. 運行 services.msc,將Windows Time服務設置成自動(延遲啟動)
