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 @ 2020-07-08 01:34  ascertain  阅读(619)  评论(0编辑  收藏  举报