[CentOS] /etc/hosts not resolving hostnames

Robert Spangler mlists at zoominternet.net
Fri Apr 8 20:30:31 UTC 2011


On Friday 08 April 2011 14:32, the following was written:

>  On Fri, Apr 8, 2011 at 1:27 PM, <m.roth at 5-cent.us> wrote:
>  > Johan Martinez wrote:
>  > > I have modified /etc/hosts file with IP address and hostname entries.
>  > > However, host command is returning 'Host 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-- 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??
>  >
>  > Does /etc/resolv.conf exist? If so, what does /etc/nsswitch.conf say -
>  > files first?
>  >
>  >        mark
>
>  resolv.conf exists and nsswitch.conf has a following line:
>  "hosts:      files dns"

Check /etc/host.conf  that is the file that tells the system in what order to 
do it's lookups.  Should be as follows:

order hosts,bind

>  SELinux was in enforcing mode, but I didn't see any errors in audit.log.
>  Still I have disabled it for now.

SELinux shouldn't play a role here.


-- 

Regards
Robert

Linux
The adventure of a lifetime.

Linux User #296285
Get Counted
http://counter.li.org/



More information about the CentOS mailing list