Comment 11 for bug 993298

Revision history for this message
Thomas Hood (jdthood) wrote :

jerico wrote:
> I've got no instance of dnsmasq running and entries
> in /etc/hosts are respected when e.g. letting Firefox
> (or any other application I've access to) resolve URLs.

Yes, that is because the libc resolver consults /etc/hosts without doing a DNS lookup.

> AFAIK /etc/hosts is in not directly linked to dnsmasq
> and it doesn't matter whether DNS lookups are done
> externally or not.

The standalone dnsmasq (i.e., the dnsmasq that runs when the dnsmasq package is installed) does consult /etc/hosts when resolving names. This feature can be disabled.

> The hosts mechanism is much older than dnsmasq.

That's true.

[...]
> IMO it is most unusual for a Linux distribution to provide
> a default configuration that does not respect /etc/hosts.

That would be highly unusual. Ubuntu is not unusual in this respect. In Ubuntu 12.04 /etc/nsswitch contains

    hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

thus for host name lookups the libc resolver looks first at /etc/hosts.

Try this yourself. Add the line

    1.2.3.4 foo

to /etc/hosts and then try "ping foo".

     $ ping foo
    PING foo (1.2.3.4) 56(84) bytes of data.
    ^C