Why are DNS lookups not respecting /etc/nsswitch.conf & /etc/host.conf?
We were able to resolve this by disabling ipv6. We disabled ipv6 by adding the following to /etc/modprobe.conf and rebooting.
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1
After reboot, we no longer see DNS lookups for hosts listed in /etc/hosts.
It's not clear to me exactly why this resolves the issue.
There are many applications out there that do not use the OS-api to query names. Instead they do an explicit DNS-query.
If that happens - they will not go via the resolver library.
On Linux you can do the same on the command line:
-
host YOURHOST
will try to resolve DNS - no matter what. -
gethostip YOURHOST
will use the defined resolver settings in the configured order.