Why does nslookup/dig/host not resolve hostnames mentioned in /etc/hosts file in Red Hat Enterprise Linux ?

Solution Verified - Updated -

Issue

  • nslookup or dig or host does not resolve hostnames mentioned in /etc/hosts file
  • Performing a DNS lookup of a system in /etc/hosts fails with the following message:
# nslookup server1 
Server:     10.x.x.x
Address:    10.x.x.x#53

** server can't find server1: SERVFAIL 

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content