RHEL Name Resolution Local Host file and DNS

Unable to get name resolution from RHEL 5 /etc/hosts.

/etc/nsswitch.conf includes:

hosts: files dns

Example: /etc/hosts contains:
172.113.100.1       testsservername

host testservername returns: Host testsservername not found: 3(NXDOMAIN)

Thanks
GSK
gskortzAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
farzanjConnect With a Mentor Commented:
host command will query DNS not /etc/hosts file

You can query like

getent ahosts testsservername
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
What is in your /etc/host.conf ?

It should contain:

order hosts,bind
0
 
savoneConnect With a Mentor Commented:
try ping, which will use the service is nsswitch.

try:

ping testservername

It should show the IP address it gets from /etc/hosts.
0
 
gskortzAuthor Commented:
Responding to several comments:
/etc/hosts.conf does contain expect order = hosts,bind

ping does resolve to the expected address so /etc/nsswitch.conf or host.conf acting as expected.

getent hosts [hostname] provides what I need.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.