How network manager is resolving localhost without /etc/hosts

Tom H tomh0665 at
Mon Dec 28 10:09:21 UTC 2015

On Sun, Dec 27, 2015 at 8:58 PM, Rashkae <ubuntu at> wrote:
> On 15-12-27 04:51 AM, Tom H wrote:
>> On Fri, Dec 25, 2015 at 11:33 PM, Bruce Ferrell <bferrell at>
>> wrote:

>> This isn't an issue regarding the order of resolution of dns queries.
>> "localhost." isn't going to be resolved by anything other than
>> "files". It turns out that in the NM case, "localhost." is resolved
>> without a hosts file unless NM's dns setting is "none".
> This statement contradicts itself. There's nothing different about looking
> up localhost than any other hostname. (other than the assumption that it's
> always going to be

Give "dig @ localhost." or "dig @ localhost." a
try and let us know whether you get an answer; "localhost" is special.

> The system, configured with a default lookup order, will first examine hosts
> file to resolve, then, I guess, some network muticasting (that's new to me,
> but whatever,), then dns.
> A default configuration of Bind includes a local zone file with localhost,
> in case a querry makes it to dns for whatever reason.. Apparently, NM's dns
> caching is doing something similar. But what started this whole thread was
> the belief of the OP that NM dns was overruling hosts file, which would only
> happen if something was wrong with nsswitch.conf, or something very wrong
> with the hosts file.

As I said in the email to which you're responding, this isn't an order
of resolution of dns queries.

The OP,  AFAIU, set "<ip_address> localhost" in "/etc/hosts" where
ip_address isn't "" but localhost was still being resolved as
"" because the OP hadn't set "dns=none" in the NM

More information about the ubuntu-users mailing list