How network manager is resolving localhost without /etc/hosts
lproven at gmail.com
Sun Dec 20 23:30:09 UTC 2015
On 20 December 2015 at 21:57, Shashwat Kumar <shashwatkmr.001 at gmail.com> wrote:
> I tried to make a new mapping in /etc/hosts which didn't work. After
> searching I found that network-manager does not use /etc/hosts but dnsmasq
> is used as local dns resolver.
> To confirm this design, I commented every line in /etc/hosts and flush
> dnsmasq cache using
> sudo /etc/init.d/nscd restart
> and restarted network-manager
> sudo service network-manager restart
> But to my surprise ping localhost was still resolving to 127.0.0.1. As per
> my knowledge localhost mapping is only maintained in /etc/hosts. So how
> localhost was still being resolved? Is there any information that I am
> Thanks in advance.
Localhost is *always* 127.0.0.1 on any computer with IPv4. You can't
change this to anything else in any way at all, as far as I know; it's
part of the definition of IPv4.
You do *not* set localhost to your network IP address! That will break
TCP/IP very badly, I think.
Liam Proven • Profile: http://lproven.livejournal.com/profile
Email: lproven at cix.co.uk • GMail/G+/Twitter/Flickr/Facebook: lproven
MSN: lproven at hotmail.com • Skype/AIM/Yahoo/LinkedIn: liamproven
Cell/Mobiles: +44 7939-087884 (UK) • +420 702 829 053 (ČR)
More information about the ubuntu-users