ntp服务配置

  

restrict ip mask 不跟参数表示无任何限制,常用nomodify 客户端不能修改服务器时间,但可校时
noquery 不能校时
notrap: 不提供远程时间登陆功能
notrust 不接受没有认证的client

server ip|hostname [prefer iburst]
设置上层ntp服务器

使用123/udp

restrict 127.0.0.1
restrict ::1
restrict ntp.api.bz 允许上级ntp server主动修改本机时间
restrict 192.168.8.0 mask 255.255.255.0 nomodify notrap 允许本网段

server ntp.api.bz prefer iburst

 

ntpstat 查看状态服务器状态

ntpq -pn


ntpdate -u Direct ntpdate to use an unprivileged port for outgoing packets.

开启ntpd时可用-u选项,此时不会使用123端口,与ntpd不会产生冲突

server 127.127.1.0
fudge 127.127.1.0 stratum 10

作为局域网的time service provider,通常将stratum设置为10 (Stratum 10 is conventional for unsynchronized local clocks; it is high enough that nobody is likely to mistake it for a desirable clock to synchronize with.)


查看/var/log/messages 查看是否有ntp失败或者fail提示.


Feb 20 22:54:41 xnu_1 ntpd[2187]: 0.0.0.0 0617 07 panic_stop -28777 s; set clock manually within 1000 s.

Feb 20 22:54:57 xnu_1 ntpd_intres[2193]: parent died before we finished, exiting


tinker panic 0 在/etc/ntp.conf第一句添加,保证ntpd在较大时差时工作.

ntpdate -ud 127.0.0.1 测试本机ntpd服务

posted @   ascertain  阅读(640)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示