The user had the following line in /etc/nsswitch.conf: hosts: dns files.
By changing the line to point first to files and then to DNS, hosts: files dns, the problem was resolved.
Other considerations: This error could also happen if you are using a fully qualified host name. Make sure your host name does not have the domain appended. If you use a fully qualified host name, the domain is appended twice. Also, verify that the domain name specified in /etc/resolv.conf is a reachable domain.