How network manager is resolving localhost without /etc/hosts

Shashwat Kumar shashwatkmr.001 at gmail.com
Mon Dec 28 21:13:57 UTC 2015


I read the solutions and applied everyone one by one but could not make
localhost not work. My localhost server is actually running on
http://localhost:5000 .


   - Removed /etc/hosts
   - Set dns=none in /etc/NetworkManager/NetworkManager.conf
   - Set hosts : files in /etc/nsswitch.conf (i.e. deletd mdns_minimal
   [NOTFOUND=return] dns )
   - Flush dns cache using sudo /etc/init.d/nscd restart
   - Restart network manager.

The localhost is running and ping localhost is showing 127.0.0.1 . Any more
changes that I can apply?

On Mon, Dec 28, 2015 at 9:43 PM, Rashkae <ubuntu at tigershaunt.com> wrote:

> On 15-12-28 05:09 AM, Tom H wrote:
>
>> Give "dig @8.8.8.8 localhost." or "dig @208.67.222.222 localhost." a try
>> and let us know whether you get an answer; "localhost" is special.
>>
>
> NXDOMAIN, which is what I would expect.  When I said it would resolve by
> DNS, I meant the resolver library would query DNS if localhost is not in
> /hosts.  Whether or not DNS responds with 127.0.0.1 would then depend on
> configuration of the DNS server to which that query is made.
>
>
> The OP,  AFAIU, set "<ip_address> localhost" in "/etc/hosts" where
>> ip_address isn't "127.0.0.1" but localhost was still being resolved as
>> "127.0.0.1" because the OP hadn't set "dns=none" in the NM
>> configuration.
>>
>>
> No, the IP tried commenting every line in /hosts, was surprised localhost
> was still resolving, and assumed, because of another problem they were
> having, that Network Manager dns caching was taking priority over
> /etc/hosts.
>
> My points are:
>
> 1. dns cache server resolving localhost in the absense of an entry in
> hosts file is normal.  (while I haven't tested the dnsmasq software used by
> Network Manager, it is, indeed, the default configuration of Bind to do so.)
>
> 2.  If hostnames in hosts file are indeed resolving to something else when
> NM dns caching is in play, *that* is an issue of resolve order, (or, I
> think, more likely, something done wrong in the hosts file, as not many
> would ever touch nsswitch).  In either way, the default config of Network
> Manager should not in any way bypass hosts file.  Name resolution by other
> programs has nothing to do with Network Manager config, other than the DNS
> servers used when the query gets to that point.
>
>
>
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>



-- 
Shashwat Kumar
Final year Undergraduate student
Department of Computer Science and Engineering
IIT Kharagpur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20151229/20a27e71/attachment.html>


More information about the ubuntu-users mailing list