我最近把我的主要时间服务器移到了另一个系统,例如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已被closures。 但为什么它坚持服务器? 这是/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能够同步,networking上的其他系统使用完全相同的configuration完美工作。 唯一明显的区别是那些系统以前从未使用old.fqdn 。 有没有其他的地方, ntpdlogging其父母服务器?
系统是目前的Debian Jessie:ntp 1:4.2.6.p5 + dfsg-7 + deb8u2,amd64
更新:我开始在工作站上重新安装ntp( apt-get --purge remove ntp && apt-get install ntp )。 重新安装后,相同的configuration按预期工作。
解决scheme:原因是ntpd不是用/etc/ntp.conf启动的,而是用/var/lib/ntp/ntp.conf.dhcp 。 后者具有old.fqdn硬编码的IP。 是的,在过去,系统已经通过DHCP进行了configuration,目前他们没有。
Debian的启动脚本/etc/init.d/ntp检查文件是否存在,并用它来进行configuration。 所以解决这个问题的办法是删除/var/lib/ntp/ntp.conf.dhcp 。 不知道为什么我之前没有检查ps aux 。
使用server指令时,NTP不会自动重试DNS查找。 将server切换到pool并重新启动NTP以获取此行为。
我想, ntpd返回第一个PTRlogging作为服务器名称,它是old.fqdn 。 如果你删除这个logging,你会得到第二个PTRloggingnew.fqdn作为时间服务器的相同的IP地址。 Ntpd与IP地址一起工作,它在开始时将域名parsing为IP。
你可以在工作站上用命令看到这个IP地址:
ntpq -p -n localhost