惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
V2EX - 技术
V2EX - 技术
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Project Zero
Project Zero
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
AWS News Blog
AWS News Blog
Scott Helme
Scott Helme
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
P
Privacy International News Feed
Google Online Security Blog
Google Online Security Blog
SecWiki News
SecWiki News
The Last Watchdog
The Last Watchdog
NISL@THU
NISL@THU
Attack and Defense Labs
Attack and Defense Labs
G
GRAHAM CLULEY
Security Latest
Security Latest
Help Net Security
Help Net Security
C
Cyber Attacks, Cyber Crime and Cyber Security
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Security @ Cisco Blogs
腾讯CDC
S
Secure Thoughts
WordPress大学
WordPress大学
P
Proofpoint News Feed
H
Help Net Security
Simon Willison's Weblog
Simon Willison's Weblog
小众软件
小众软件
M
MIT News - Artificial intelligence
博客园 - 叶小钗
IT之家
IT之家
G
Google Developers Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
N
News and Events Feed by Topic

博客园 - weipt

终于!我造了个「AI代驾」级别的AutoBuilder,一键干掉80%的重复CRUD工作 OpenClaw 配置飞书机器人完整指南:从零到每天定时推送天气 国产数据库私有化部署实战:PolarDB for PostgreSQL 免费容器版踩坑记 发票打印还在花钱?这款免费小工具,A4纸一半大小、自动排版,真香! 🔥 自己写的FBX转3D Tiles工具,免费!还能当模型浏览器用 相同代码在360浏览器能显示,在edge提示webgl不支持,edge下都最新的内核。 什么是技术架构、数据架构、业务架构、应用架构和代码架构? 使用pyinstaller打包的exe文件太大,怎么办 2026无人机新规正式施行!各位飞手赶紧收藏 谈谈EF的两种模式 谈谈EF Core 微软官方的 ORM(对象关系映射)框架 Next.js和blazor server比较开发网站哪个好 Blazor Server和 Blazor WebAssembly区别 关于vue项目中cesium的地图显示问题 关于顺丰退出抖音电商退货业务事件的分析 这样的算作“全栈技术”吗? 大疆上云APIdemo打包配置 用nssm将minio和srs注册成服务 LoRa定位技术和蓝牙AoA定位技术的关系 Mysql查询工具,你还用navcat吗? jar注册为服务的方式 nginx怎么样配置rtmp推流服务器 时间戳和时间格式互转
在WINDOWS上创建NTP授时服务器,并验证是否可用
weipt · 2025-12-04 · via 博客园 - weipt

1、创建ntp服务器方法,将下面代码保存为bat文件,然后用管理员方式运行

 
@echo off
REM 自动判断权限问题,主动获取管理员权限
@echo off  
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 
 
if '%errorlevel%' NEQ '0' (  
    goto UACPrompt  
) else ( goto gotAdmin )  
   
:UACPrompt  
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" 
    "%temp%\getadmin.vbs" 
    exit /B  
   
:gotAdmin  
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )  
    pushd "%CD%" 
    CD /D "%~dp0" 
 
:begin
 
@REM ntp 服务配置
reg add  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v "AnnounceFlags" /t REG_DWORD /d 5 /f
reg add  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /v "Enabled" /t REG_DWORD /d 1 /f
reg add  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v "Type" /t REG_SZ /d "NTP" /f
@REM 添加防火墙
netsh advfirewall firewall add rule name="_123 NTP" protocol=UDP dir=in localport=123 action=allow
@REM 设置服务开机自启 todo
 
@REM 启动服务
net start w32time
netstat -an | find "123"
 
w32tm /stripchart /computer:127.0.0.1
 
pause
 

  2、测试授时服务器是否可用

在客户端执行如下命令

# 测试与NTP服务器的时间同步(超时设为5秒) w32tm /stripchart /computer:目标NTP服务器IP/域名 /samples:1 /dataonly /period:5

  • 成功结果:显示0x00000000(无错误)+ 时间偏移 → UDP 123 开放且 NTP 服务正常;
  • 失败结果:0x800705B4(超时)/0x80070057(参数错误)→ 端口关闭 / 防火墙拦截 / 服务异常。