Linux: /etc/hosts gets ignored

I had the problem that my /etc/hosts wasn’t read by the system.

First: Use ping to test local Hostname lookups, because dig calls the nameservers directly.

There are two files that can configure in which order the lookup system are tried.
The two systems are the local hosts file and the normal DNS system.

/etc/host.conf

“order hosts,bind” tells the system to use the hosts file first, and then try bind == DNS system.

/etc/nsswitch.conf

“hosts: files dns” tells the system to use the hosts files first, and then try DNS system.

Try which file has to be edited, because it is not clear which is used.

One thought on “Linux: /etc/hosts gets ignored

  1. Pingback: Apache2: apr_sockaddr_info_get() failed for HOSTNAME | h4cc