我正在公司网络中配置ntp。
我做了
restrict default ignore
restrict -6 default ignore并明确列出了servers (我正在使用来自pool.ntp.org的公共服务器)。我也没有启用broadcastclient。
过了一段时间,ntpq -p一直只显示本地网络中的特定服务器,而我没有在配置文件中添加这些服务器。
restrict default ignore不应该让ntpd忽略来自没有显式提到的服务器的所有数据包吗?
我已经检查了我与dig一起使用的服务器,地址似乎是正确的。
这里是ntpq -pn:
remote refid st t when poll reach delay offset jitter
==============================================================================
10.200.10.253 .INIT. 16 u - 64 0 0.000 0.000 0.000和我当前的ntp.conf (注释删除)
driftfile /var/lib/ntp/ntp.drift
statsdir /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 2.europe.pool.ntp.org
restrict default ignore
restrict -6 default ignore
restrict 2.europe.pool.ntp.org nomodify
restrict 127.0.0.1
restrict ::1发布于 2015-01-02 18:06:14
经过一些调试和Aaron's的帮助,我发现了问题。
中默认情况下,ISC DHCP客户端获取ntp服务器信息。
Debian的ntpd init脚本通过扩展/etc/ntp.conf使其使用该信息。生成的文件可在/var/lib/ntp/ntp.conf.dhcp上使用。
当然,解决方案是正确地配置DHCP以不接收ntp服务器(只需删除ntp-servers选项在/etc/dhcp/dhclient.conf中)。
在NTP的支持页面,第6.12节中可以获得更多信息:
ISC's dhcp is able to automatically configure the servers used by ntpd.
Here's how to get it working:
The dhcp server you are using must be configured to provide
the ntp-servers option
Configure your dhclient to request ntp-servers (it doesn't by default).
To do this add ntp-servers to the default request line in
/etc/dhcp3/dhclient.conf
Create an /etc/ntp.conf with all of the other settings that you wish to use.
This file will be used to create /etc/ntp.conf.dhcp, it won't be over written.
Your ntpd must be told to use /etc/ntp.conf.dhcp if it exists.
This is usually accomplished in the ntp init script (e.g. /etc/init.d/ntp). https://serverfault.com/questions/655942
复制相似问题