我尝试了所有并在谷歌上搜索了很多!但是我无法在我的服务器上使用 NTP。这篇文章是最后的希望!我已使用此配置 ( )在 debian 服务器上安装了ntp/etc/ntp.conf:
driftfile /var/lib/ntp/ntp.drift
statdir /var/log/ntpstats/
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.it.pool.ntp.org iburst
server 1.it.pool.ntp.org iburst
server 2.it.pool.ntp.org iburst
server 3.it.pool.ntp.org iburst
restrict -4 default nomodify nopeer noquery notrap
restrict -6 default nomodify nopeer noquery notrap
# Restrict eth0 ip
restrict 192.168.1.1
restrict 127.0.0.1 noserve nomodify
restrict ::1
Run Code Online (Sandbox Code Playgroud)
现在当我尝试:
ntpq -pn
127.0.0.1: timed out, nothing received
***Request timed out
Run Code Online (Sandbox Code Playgroud)
当我尝试:
ntpdate -q
9 Mar 18:08:01 ntpdate[27896]: no servers can be used, exiting
Run Code Online (Sandbox Code Playgroud)
但与:
ntpdate -d 0.it.pool.ntp.org
Run Code Online (Sandbox Code Playgroud)
我收到传入的数据包并设置时间偏移。这导致我错误的ntp.conf配置。
为什么会发生这种情况的任何线索。
您的问题似乎是在配置文件的这两行中选择了这 2 个服务器:
server ntp1.inrim.it iburst
server ntp2.inrim.it iburst
Run Code Online (Sandbox Code Playgroud)
当我尝试查询其中任何一个时,我也会收到您的错误:
$ sudo ntpq -p ntp1.inrim.it
ntp1.inrim.it: timed out, nothing received
***Request timed out
$ sudo ntpq -p ntp2.inrim.it
ntp2.inrim.it: timed out, nothing received
***Request timed out
Run Code Online (Sandbox Code Playgroud)
我会尝试为初学者选择一些不同的服务器。
当我用谷歌搜索他们的名字时,我发现了这个页面,标题为:Come configurare il vostro NTP。那里也提到了另一台无法工作的服务器:
$ sudo ntpq -p host2.miaditta.it
host2.miaditta.it: timed out, nothing received
***Request timed out
Run Code Online (Sandbox Code Playgroud)
这些服务器似乎是问题所在。
如果您进一步查看我提到的上面的 URL,他们讨论使用加密,您可能需要启用此功能才能访问这些 NTP 服务器。
我能够iburst使用以下命令成功连接到您的两台服务器:
$ ntpdate -d <server>
Run Code Online (Sandbox Code Playgroud)
例子
$ ntpdate -d ntp1.inrim.it
9 Mar 21:01:37 ntpdate[20739]: ntpdate 4.2.6p5@1.2349-o Tue Apr 2 17:47:01 UTC 2013 (1)
Looking for host ntp1.inrim.it and service ntp
host found : ntp1.inrim.it
transmit(193.204.114.232)
receive(193.204.114.232)
...
server 193.204.114.232, port 123
stratum 1, precision -22, leap 00, trust 000
refid [CTD], delay 0.19319, dispersion 0.00084
transmitted 4, in filter 4
reference time: d6c78d79.f0206119 Sun, Mar 9 2014 21:01:45.937
originate timestamp: d6c78d7e.55ab5b4b Sun, Mar 9 2014 21:01:50.334
transmit timestamp: d6c78d77.7e9b8296 Sun, Mar 9 2014 21:01:43.494
filter delay: 0.19460 0.19710 0.19453 0.19319
0.00000 0.00000 0.00000 0.00000
filter offset: 6.755368 6.757349 6.755239 6.756265
0.000000 0.000000 0.000000 0.000000
delay 0.19319, dispersion 0.00084
offset 6.756265
9 Mar 21:01:43 ntpdate[20739]: step time server 193.204.114.232 offset 6.756265 sec
Run Code Online (Sandbox Code Playgroud)
所以看来你的问题实际上是你的ntp.conf文件有问题。请确认情况确实如此,我们可以继续进一步调试。
| 归档时间: |
|
| 查看次数: |
27311 次 |
| 最近记录: |