FreeBSD NTP 简单使用
FreeBSD NTP 简单使用
来源 https://blog.csdn.net/stevexk/article/details/1349506
1.ntptrace xxx.xxx.xxx.xxx
查找要对时的服务器状态,可以trace到一级时钟服务器,
2.ntpq -p 或者 ntpq -pn
显示当前时钟服务器状态
3.ntpdata xxx.xxx.xxx.xxx 或者 ntpdata -d xxx.xxx.xxx.xxx (Debug模式)
与时钟服务器对时,着先时钟服务器要先对时,才能用来提钟时钟服务
4.ntpd
既可以自动对时,又可对外提供时钟服务,先要配置/etc/ntp.conf





5.开机对时,/etc/rc.conf中添加
ntpdate_enable="YES"
ntpdate_program="/usr/sbin/ntpdate"
ntpdate_flags="-b"
6.每天(好像是每天)对时且对外提供时钟服务, 在/etc/rc.conf中添加
xntpd_enable="YES"
xntpd_program="/usr/sbin/ntpd"
xntpd_flags="-p /var/run/ntpd.pid"
7.端口
时钟服务器端口为123,udp , netstat -an
# We won't allow *anything* from hosts not listed in the configuration
# This means you need a restrict line for each server
restrict default ignore
restrict -6 default ignore
# Allow just about anything from localhost, IPv4.
restrict 127.0.0.1 mask 255.0.0.0
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/tmp/ntp.drift
logfile /var/log/ntpd.log
# Log everything, even from ntpd (which otherwise defaults to "all =sync")
logconfig =all +all
server 127.127.1.0
fudge 127.127.1.0 stratum 5
server 182.92.12.11 minpoll 6 maxpoll 10
restrict 182.92.12.11 nomodify notrap nopeer noquery
/etc/ntp.common.conf
# Common elements of NTP configuration # # Do not edit: changes will be lost following reboot. # For site-specific NTP configuration, see the instructions in /etc/ntp.conf # # We won't allow *anything* from hosts not listed in the configuration # This means you need a restrict line for each server restrict default ignore restrict -6 default ignore # Allow just about anything from localhost, IPv4. restrict 127.0.0.1 mask 255.0.0.0 restrict 127.0.0.1 restrict -6 ::1 driftfile /var/tmp/ntp.drift logfile /var/log/ntpd.log # Log everything, even from ntpd (which otherwise defaults to "all =sync") logconfig =all +all server 127.127.1.0 fudge 127.127.1.0 stratum 5
/etc/ntp.conf
includefile /etc/ntp.common.conf server 218.75.4.130 minpoll 6 maxpoll 10 restrict 218.75.4.130 nomodify notrap nopeer noquery
常用的Ntp服务器:
203.107.6.88
ntp.aliyun.com
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com
ntp8.aliyun.com
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南