最近,我将我的主要时间服务器移到了另一个系统,例如old.fqdn到new.fqdn。所有从属ntpd守护进程都使用ntp.fqdn作为服务器,该服务器现在是指向new.fqdn的CNAME,即该系统上的host ntp.fqdn生成:
ntp.fqdn is an alias for new.fqdn.
new.fqdn has address xxx.xxx.xxx.xxx然而,ntpq -p的产量:
remote refid st t when poll reach delay offset jitter
==============================================================================
old.fqdn .INIT. 16 u - 1024 0 0.000 0.000 0.000这是一致的,因为old.fqdn已经被关闭。但是为什么它要粘在服务器上呢?这是/etc/ntp.conf:
driftfile /var/lib/ntp/ntp.drift
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 ntp.fqdn iburst
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1当然,ntpd已在DNS更改后重新启动。而且,ntpdate -s ntp.fqdn能够同步,而网络上的其他系统使用完全相同的配置可以很好地工作。唯一明显的区别是,这些系统以前从未使用过old.fqdn。还有其他地方,ntpd保存其父母服务器的记录吗?
系统当前Debian : ntp 1:4.2.6.p5+dfsg-7+deb8u2 8u2,amd64
更新:我开始在工作站上重新安装ntp (apt-get --purge remove ntp && apt-get install ntp) .重新安装后,相同的配置将按预期工作。
解决方案:原因是ntpd不是用/etc/ntp.conf启动的,而是用/var/lib/ntp/ntp.conf.dhcp启动的。后者的IP为old.fqdn硬编码。是的,在过去,这些系统是由DHCP配置的,目前它们并不是。
Debian脚本/etc/init.d/ntp检查文件是否存在,并将其用于配置。所以解决这个问题的方法是删除/var/lib/ntp/ntp.conf.dhcp。不知道为什么我不早点检查ps aux。
发布于 2017-03-08 04:03:44
当使用server指令时,NTP不会自动重试DNS查找。将server切换到pool并重新启动NTP以获得此行为。
发布于 2017-03-08 18:56:58
我认为,ntpd返回第一个PTR记录作为服务器名,它是old.fqdn。如果要删除该记录,您将得到时间服务器相同ip地址的第二个PTR记录new.fqdn。Ntpd使用ip地址,它从一开始就将域名解析为ip。
您可以通过工作站上的命令看到这个ip地址:
ntpq -p -n localhosthttps://serverfault.com/questions/836746
复制相似问题