UDel ntpd - 完全禁用时间服务器发现

UDel ntpd - 完全禁用时间服务器发现

我将 UDel ntpd(版本 4.2.6.p5)配置为我所在组织运营的三台服务器的客户端,并且(我认为)没有其他人运营。

server xx.yy.zz.1 iburst
server xx.yy.zz.2 iburst
server xx.yy.zz.3 iburst

restrict default ignore
restrict xx.yy.zz.1 nomodify notrap nopeer noquery
restrict xx.yy.zz.2 nomodify notrap nopeer noquery
restrict xx.yy.zz.3 nomodify notrap nopeer noquery

正常运行约五分钟后,ntpq 报告守护进程已发现并添加了另外两个时间服务器(也由我的组织运营,但不在其官方时间服务器列表中):

ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*xx.yy.zz.1          aa.bb.cc.dd  2 u   16   64    1    0.157   -2.230   0.032
 xx.yy.zz.2          aa.bb.cc.dd  2 u   15   64    1    0.207   -2.191   0.032
 xx.yy.zz.3          aa.bb.cc.dd  2 u   14   64    1    0.211   -2.171   0.014
 xx.yy.zz.4         .INIT.       16 u    -   64    0    0.000    0.000   0.000
 xx.yy.zz.5         .INIT.       16 u    -   64    0    0.000    0.000   0.000

由于这些服务器不在地址白名单中(因为我不知道它们),所以客户端与它们通信的尝试显然失败了。

我不知道这到底是怎么发生的,但我从文档中得到的印象是,服务器 A 可以通过某种方式告诉客户端“嘿,你也应该与服务器 B、C 和 D 对话。”我发现的文档对实现此目的的各种方法有很多冗长的描述,但对如何控制它却只字未提。

因此,问题是:我该如何完全关闭此功能,以便客户端无论如何都只尝试与配置文件中明确列出的服务器通信?


根据请求:

# ntpq -pncrv | redact
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+xx.yy.zz.1      aa.bb.cc.dd  2 u   56 1024  377    0.177   -0.010   0.070
*xx.yy.zz.2      aa.bb.cc.dd  2 u  690 1024  377    0.237    0.028   0.046
+xx.yy.zz.3      aa.bb.cc.dd  2 u  226 1024  377    0.229    0.013   0.052
 xx.yy.zz.4      .INIT.      16 u    - 1024    0    0.000    0.000   0.000
 xx.yy.zz.5      .INIT.      16 u    - 1024    0    0.000    0.000   0.000
associd=0 status=061b leap_none, sync_ntp, 1 event, leap_event,
version="ntpd [email protected] Fri Apr 10 19:04:04 UTC 2015 (1)",
processor="x86_64", system="Linux/3.16.0-4-amd64", leap=00, stratum=3,
precision=-22, rootdelay=0.405, rootdisp=38.394, refid=128.2.1.21,
reftime=d951542d.a6db3cdc  Wed, Jul 15 2015 17:50:37.651,
clock=d95156df.0d2756da  Wed, Jul 15 2015 18:02:07.051, peer=9102, tc=10,
mintc=3, offset=0.009, frequency=-5.266, sys_jitter=0.024,
clk_jitter=0.030, clk_wander=0.003

# redact < /etc/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 aa.bb.cc.1 iburst
server aa.bb.cc.2 iburst
server aa.bb.cc.3 iburst
restrict -4 default ignore
restrict -6 default ignore
restrict aa.bb.cc.1 nomodify notrap nopeer noquery
restrict aa.bb.cc.2 nomodify notrap nopeer noquery
restrict aa.bb.cc.3 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1

我没有看到这里有关从 DHCP 选择附加服务器的任何信息。

答案1

我猜测一下你的组织是什么并且你正在使用 dhcp。

是的,您的组织突出发布一组 3 个服务器话虽如此,您的组织也指示 dhcp 客户端使用其他六个服务器

我不确定为什么您的机器使用 dhcp 中公布的服务器会造成问题,但您可以根据需要关闭此功能。如果您使用的是 Debian,则需要/etc/dhcp/dhclient.conf从请求语句中编辑并删除 ntp-servers 选项:

request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search,
netbios-name-servers, netbios-scope, interface-mtu,
-   rfc3442-classless-static-routes;
+   rfc3442-classless-static-routes, ntp-servers;

如果您没有使用 Debian,则需要查阅您的发行版文档。

相关内容