Score:0

CentOS 7 : NTPd (wierd?) behaviour with FQDN vs IP

cn flag

I recently setup NTP server on my environment, along with DNS. And when I configure an NTP client, I see the below behaviour:

[root@template ~]# host mydns.mydomain.ops
mydns.mydomain.ops has address 10.10.5.2
[root@template ~]# grep mydns.mydomain.ops /etc/ntp.conf
server 0.mydns.mydomain.ops iburst
[root@template ~]# systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-12-20 16:38:54 IST; 10min ago
  Process: 724 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 737 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─737 /usr/sbin/ntpd -u ntp:ntp -g
[root@template ~]# ntpq -pn
10.10.5.2: timed out, nothing received
***Request timed out
[root@template ~]#

However, if I happen to replace the FQDN in my /etc/ntp.conf with the IP address (and ofcourse restart the service), it works just perfectly fine:

[root@template ~]# grep 10.10.5.2 /etc/ntp.conf
server 10.10.5.2 iburst
[root@template ~]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.10.5.2      192.46.15.60     3 u   44   64  377    0.251   11.240   4.310

I'm kind of confused how DNS resolution is failing only for NTP. Is there something else I'm overlooking? Please help ...

jp flag
In the first example, you use `mydns.mydomain.ops` with `host` command but your `ntp.conf` has `0.mydns.mydomain.ops`. In the same first example `ntpq -pn` prints `10.10.5.2` and this indicates that DNS resolution is working.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.