ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

Ubuntu时间同步服务器

Ubuntu时间同步服务器 Ubuntu时间同步服务器服务端sudoaptinstallntp#安装时间同步服务器编辑/etc/ntp.conf# 漂移文件记录时钟漂移提高长期精度 driftfile /var/lib/ntp/ntp.drift # 本地时钟作为时间基准纯局域网核心配置 server 127.127.1.0 fudge 127.127.1.0 stratum 10 # 允许本机查询 restrict 127.0.0.1 restrict ::1 # 允许局域网客户端同步修改为你的实际网段 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # 默认拒绝其他所有访问 restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noqueryNTP服务使用UDP123端口#验证状态ntpq-premote refid st t when poll reach delay offset jitter*LOCAL(0).LOCL.10l106410.0000.0000.000客户端ubuntu直接用timesyncd服务就可以同步时间/etc/systemd/timesyncd.conf[Time] # 指向你的内网 NTP 服务器 NTP192.168.1.100 # 清空备用源纯局域网环境避免访问公网失败导致延迟 FallbackNTP # 最大可接受的根距离秒默认5秒 RootDistanceMaxSec5 # 最小轮询间隔秒默认32秒 PollIntervalMinSec32 # 最大轮询间隔秒默认2048秒约34分钟 PollIntervalMaxSec2048# 开启 NTP 自动同步 sudo timedatectl set-ntp true # 重启同步服务使配置生效 sudo systemctl restart systemd-timesyncd # 设置开机自启 sudo systemctl enable systemd-timesyncd
RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进