尝试运行`ntpdate`时,“找不到适合同步的服务器”错误
我正在尝试在Ubuntu机器上设置NTP服务器。 我在这个特殊问题上打破了我的头脑。
获取错误ntpdate[5005]: no server suitable for synchronization found
执行命令ntppdate
时ntpdate[5005]: no server suitable for synchronization found
。
有人可以帮我解决这个问题吗?
/etc/ntp.conf中:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
当我给命令netstat -anltp | grep "LISTEN"
netstat -anltp | grep "LISTEN"
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1816 / dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 939 / sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1013 / cupsd tcp 0 0 127.0.0.1:39558 0.0.0.0:* LISTEN 5529 / rsession tcp 0 0 0.0.0.0:902 0.0.0.0:* LISTEN 1275 / vmware-authdla tcp 0 0 127.0.0.1:47304 0.0.0.0:* LISTEN 5822 / rsession tcp6 0 0 ::: 80 ::: * LISTEN 1400 / apache2 tcp6 0 0 ::: 22 ::: * LISTEN 939 / sshd tcp6 0 0 :: 1:631 ::: * LISTEN 1013 / cupsd
那么我应该怎么做才能听到123呢?
如果我输出为
PORT STATE SERVICE 123/udp open ntp
如果我发出命令nmap -p 123 -sU -P0 192.168.36.198
,那意味着UDP是开放的吗? 那为什么它不显示在命令中显示监听端口?
问题来自/etc/ntp.conf
给出的网络默认限制。 您可能必须取消注释ntp服务器配置文件中的以下行:
# Clients from this (example!) subnet have unlimited access, but only if # cryptographically authenticated. #restrict 192.168.123.0 mask 255.255.255.0 notrust
至
# Clients from this (example!) subnet have unlimited access, but only if # cryptographically authenticated. restrict 192.168.123.0 mask 255.255.255.0
您可能无法访问ubuntu.pool.ntp.org
尝试使用其他NTP服务器池。
向您的ISP(或网络管理员)咨询本地NTP服务器(或群集)。
如果你想与外部时间ref同步,你不必“听”。
检查是否可以访问0.ubuntu.pool.ntp.org(ping和nmap -p 123 -sU 0.ubuntu.pool.ntp.org)
当ntp服务器尝试使用远程服务器同步本地时间时,会出现此错误。
检查您的计算机是否具有Internet访问权限并且未阻止端口123 / UDP:
如果你想要一个没有互联网访问权限的ntp服务器,你不能在你的ntp.conf文件中定义服务器,你可以在行的开头添加一个#来注释它:
#server 0.ubuntu.pool.ntp.org #server 1.ubuntu.pool.ntp.org #server 2.ubuntu.pool.ntp.org #server 3.ubuntu.pool.ntp.org
您可以在http://support.ntp.org/bin/view/Support/WebHome获取更多信息
我从上到下给出了详细的答案。 您可能希望跳到我的答案中间,或者只是参考下面的屏幕截图,以便一目了然地理解它。
您需要使用服务器配置ntp,如下所示:
您至少应该在/etc/ntp.conf配置文件中设置以下参数: server
例如,使用nano文本编辑器打开/etc/ntp.conf文件:
sudo nano /etc/ntp.conf
找到服务器参数,如果为空,请按如下所示进行设置:
server pool.ntp.org
但通常在ubuntu中已经预先写了一些服务器
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
保存文件并重新启动ntpd服务:
/etc/init.d/ntpd start
您可以使用以下命令立即将系统时钟同步到NTP服务器:
sudo ntpdate pool.ntp.org
或者只是运行已定义的服务器
sudo ntpdate 0.ubuntu.pool.ntp.org
或使用服务器定义的其他服务器
通常
sudo ntpdate
但在此之后,您可能会使用Error NTP socket in use
如下所示:
在那种情况下,只需运行
ntpdate -u pool.ntp.org
在ntp deamon运行时更新
或者只是停止deamon,更新并再次启动它,如下所示:
$ sudo ntpdate pool.ntp.org $ sudo service ntp stop $ sudo ntpdate pool.ntp.org $ sudo service ntp start
你会得到的