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?

1 Answer 1


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-*
  • 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.
    – dc09
    Mar 26 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.