首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ntpd不断添加本地服务器,同时被告知不要添加本地服务器。

ntpd不断添加本地服务器,同时被告知不要添加本地服务器。
EN

Server Fault用户
提问于 2015-01-02 17:01:32
回答 1查看 739关注 0票数 5

我正在公司网络中配置ntp。

我做了

代码语言:javascript
复制
restrict default ignore
restrict -6 default ignore

并明确列出了servers (我正在使用来自pool.ntp.org的公共服务器)。我也没有启用broadcastclient

过了一段时间,ntpq -p一直只显示本地网络中的特定服务器,而我没有在配置文件中添加这些服务器。

restrict default ignore不应该让ntpd忽略来自没有显式提到的服务器的所有数据包吗?

我已经检查了我与dig一起使用的服务器,地址似乎是正确的。

这里是ntpq -pn

代码语言:javascript
复制
     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 (注释删除)

代码语言:javascript
复制
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
EN

回答 1

Server Fault用户

发布于 2015-01-02 18:06:14

经过一些调试和Aaron's的帮助,我发现了问题。

在Debian.

中默认情况下,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节中可以获得更多信息:

代码语言:javascript
复制
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). 
票数 8
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/655942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档