Jon*_*nik 27 linux debian ntp time-synchronization
Debian 稳定版 (5.0.3) 服务器正在运行ntpd,并已连接到 Internet。尽管如此,系统时钟还是有大约 5 分钟的错误。
$ /etc/init.d/ntp status
NTP server is running..
Run Code Online (Sandbox Code Playgroud)
相关部分(我认为)/etc/ntp.conf:
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
server 3.europe.pool.ntp.org
Run Code Online (Sandbox Code Playgroud)
我知道 NTP 不一定会立即按时提供时钟。尽管如此,您需要等待多少小时或多少天才能合理地期望 NTP 完成其工作并同步时钟?
我是否缺少其他配置文件或选项,或者只是做错了什么?是NTP(而不是如用ntpdate),这样做的正确的工具?有没有什么快速的方法可以检查配置是否正确以及选择的NTP服务器是否返回正确的时间?
编辑:输出ntpq -p是:
remote refid st t when poll reach delay offset jitter
==============================================================================
ns1.nexellent.n .INIT. 16 u - 1024 0 0.000 0.000 0.000
dnscache-madrid .INIT. 16 u - 1024 0 0.000 0.000 0.000
sinister.wzw.tu .INIT. 16 u - 1024 0 0.000 0.000 0.000
dnscache-frankf .INIT. 16 u - 1024 0 0.000 0.000 0.000
Run Code Online (Sandbox Code Playgroud)
编辑 2:结果ntpdate -u 0.europe.pool.ntp.org命令(由布伦特建议)返回
17 Dec 17:37:29 ntpdate[14195]: no server suitable for synchronization found
Run Code Online (Sandbox Code Playgroud)
...即使在其他机器上命令工作正常。因此,我们将查看此特定服务器(位于不同网络中,通过 VPN 访问)的网络/防火墙设置。
解决方案:罪魁祸首不是我们服务器上的本地防火墙,而是周围网络中某处的防火墙设置。所以我们要求服务器托管提供商允许我们的机器使用 NTP,现在它工作正常。例如,ntpq -p现在返回:
remote refid st t when poll reach delay offset jitter
==============================================================================
ns1.eunet.fi 192.36.144.23 2 u 10 64 1 1.043 0.258 0.001
ns2.eunet.fi 62.142.10.44 2 u 9 64 1 0.671 0.135 0.001
ns3.eunet.fi 62.142.10.44 2 u 8 64 1 0.750 0.277 0.001
Run Code Online (Sandbox Code Playgroud)
(我们还切换到托管公司推荐的 eunet.fi 服务器,但这不是重点。)布伦特回答中的命令很有帮助,因为它们让我意识到问题在于对 NTP 服务器的网络访问,而不是 NTP 配置本身。谢谢大家!
bre*_*ent 24
停止ntpd,运行ntpdate -u 0.europe.pool.ntp.org3次,启动ntpd,检查时间ntpq -p,延迟,偏移和抖动应该是非零的。
| 归档时间: |
|
| 查看次数: |
83696 次 |
| 最近记录: |