[CentOS] /etc/hosts not resolving hostnames

Fri Apr 8 19:39:14 UTC 2011
Dvorkin, Asya <dvorkias at umdnj.edu>

Try flushing DNS cache:

/etc/init.d/nscd restart

On Apr 8, 2011, at 3:31 PM, Johan Martinez wrote:

This is working fine on another CentOS system. This particular install where host command is failing is trimmed down install using kickstart file. It is working on a system where install is default 'Server non-GUI', option given during interactive CD install. I guess this has to do with some missing package. Any clues??

jM.

On Fri, Apr 8, 2011 at 2:01 PM, John R Pierce <pierce at hogranch.com<mailto:pierce at hogranch.com>> wrote:
On 04/08/11 11:24 AM, Johan Martinez wrote:
> I have modified /etc/hosts file with IP address and hostname entries.
> However, host command is returning 'Host vhost1.example.com<http://vhost1.example.com/>
> <http://vhost1.example.com<http://vhost1.example.com/>> not found: 3(NXDOMAIN)'. Also, apache is
> returning error on start as '[error] (EAI 2)Name or service not known:
> Could not resolve host name vhost1.example.com<http://vhost1.example.com/>
> <http://vhost1.example.com<http://vhost1.example.com/>> -- ignoring!' . The ssh worked fine and
> resolved the hostname correctly (ssh from same system to itself - just
> for test). Am I missing something here? I thought /etc/hosts will be
> referred for all lookups. Any help??

the 'hosts' command (as well as dig, and nslookup) go directly to DNS,
they do not look at /etc/hosts or nsswitch.conf for that matter.
Apache may well go to DNS also, since your local /etc/hosts file is not
recognized by any systems outside the localhost, and apache IS a server.




_______________________________________________
CentOS mailing list
CentOS at centos.org<mailto:CentOS at centos.org>
http://lists.centos.org/mailman/listinfo/centos

_______________________________________________
CentOS mailing list
CentOS at centos.org<mailto:CentOS at centos.org>
http://lists.centos.org/mailman/listinfo/centos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110408/69a94dd7/attachment-0005.html>