1 2 Previous Next 19 Replies Latest reply on Aug 2, 2012 8:03 PM by TommyReynolds-Oracle Go to original post
      • 15. Re: /etc/hosts is ignored.
        I don't have a scenario. What I thought was this: when any application attempts to resolve a name, a.example.com, it will look for /etc/hosts first, then if it could not find any entry to match, then look for DNS based on the setting in /etc/nsswitch.conf: hosts: file dns. In this way, I can manually put an entry in /etc/hosts, if there is no such line in DNS. I understand /etc/hosts only works on local machine.

        So, if I could not immeidately update DNS, and also /etc/hosts get ignored, then how application could resolve a host name or ip address. That is why I got confused.
        • 16. Re: /etc/hosts is ignored.
          • 17. Re: /etc/hosts is ignored.
            • 18. Re: /etc/hosts is ignored.
              The standard behavior of internet applications and tools is to use /etc/hosts file before attempting to resolve a name or IP using DNS. This can be changed in /etc/nsswitch.conf. Unless you use tools, like nslookup or host, which were specifically designed to only query DNS and ignore /etc/hosts by design.

              Again, /etc/hosts file is not DNS . The hosts file provides name resolving for a host, but not a internet network domain, like example.com. So in order to specifically query the /etc/hosts file under Linux you have use the getent utility as previously mentioned. For instance:

              [root@vm005 ~]# getent hosts vm005
     vm005.example.com vm005 localhost.localdomain localhost
              • 19. Re: /etc/hosts is ignored.
                Applications use a resolver library to determine the IP address associated with a host name. The usual suspects use "/etc/nsswitch.conf" to determine what resources to query, and in what order.

                Why do you think your */etc/hosts* file is being ignored?

                <li>Show us how you did your test.
                <li>Please show us your */etc/hosts* file.
                <li>Please show us your */etc/nsswitch.conf* file; at least the hosts: entry.
                <li>Please show us your */etc/resolv.conf* file.
                <li>Are you running dnsmasq(8) locally? If so, we need to see your */etc/dnsmasq.conf* files. This is a commonly-used DNS acceleration tool.
                1 2 Previous Next