Score:0

Why is getent appending domain name to all .org lookups?

ru flag

On running the following command in CentOS 7, getent is appending my domain name to .org domains only:

[root@panel ~]# getent hosts ballotpedia.org
2606:4700:3031::6815:241e ballotpedia.org.mydomain.com
2606:4700:3032::ac43:b854 ballotpedia.org.mydomain.com

This doesn't happen when I lookup any other domain that doesn't contain .org extension as seen below:

[root@panel ~]# getent hosts google.com
2404:6800:4007:805::200e google.com

On stopping nscd service, the issue doesn't happen. I have tried clearing nscd cache using the following command as well but that didn't resolve the issue:

for db in `ls /var/db/nscd`;do /usr/sbin/nscd -i $db;done && /scripts/restartsrv_nscd

How to fix this and what might be causing this?

Score:1
nc flag

There are two possible ways to fix this:

  • A hostname not ending in . is considered incomplete and the system may try looking it up in multiple domains until it finds it. If your hostname is a fully qualified domain name already, it should end in a . so this doesn't happen.
  • In /etc/resolv.conf there may be a search line listing domains to check for incomplete short hostnames. This file may be dynamically generated, in which case you should probably find the source of this, which could be dhcp, NetworkManager, netplan, or (depending on os and distro) other network configuration sources. In CentOS, if this isn't dynamically configured by NetworkManager, it may be in /etc/sysconfig/network-scripts/ifcfg-*
dc09 avatar
ru flag
Adding `.` at the end of the hostname resolved the issue. However, still curious as to why domain name was being suffixed when `/etc/resolv.conf` doesn't have `search` line and `/etc/sysconfig/network-scripts/ifcfg-eth0` and `/etc/sysconfig/network-scripts/ifcfg-lo` also don't have any `search` line.
I sit in a Tesla and translated this thread with Ai:

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.