Answer the question
In order to leave comments, you need to log in
Why is ubuntu ignoring /etc/hosts?
Google is silent or banned me, community, help me out. There is Ubuntu 12.04 desktop, 32-bit. One interface, network parameters are set manually or with dhcp (does not affect the result). At some point, the system stopped responding to entries in hosts. Neither the hosts that were registered earlier, nor those that I register now, do not resolve as indicated.
I tried to write hostnames with a dot, in one line (despite multi on), with a different ip-address. Everything is useless.
[email protected]:~$ uname -a
Linux svenediktov-lin 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux
[email protected]:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 sven-lin.domain.ru sven-lin
127.0.0.1 anyname
[email protected]:~$ cat /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
networks: files
[email protected]:~$ cat /etc/host.conf
order hosts,bind
multi on
[email protected]:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
[email protected]:~$ host anyname
Host anyname not found: 2(SERVFAIL)
Answer the question
In order to leave comments, you need to log in
Look at what you have in /etc/nsswitch.conf - it is he who sets the order for polling name services (not just domain names - there is also the order for polling services for resolving user names, services, etc. - everything that has a name).
If hosts: files dns is there, then hosts will be analyzed first, then a dns request will be made. If there is a different order or there are some other parameters - you yourself understand, it will be different. And here nobody canceled man nsswitch.conf.
And the host program (like nslookup) never looks at hosts. It specifically makes a request to the dns server, because, in fact, it is intended specifically for debugging the dns server, and not testing name resolution in the system.
Just a guess. Maybe something is wrong with the rights to the hosts file?
Thank you for your participation, the problem went away in the same mystical way as it appeared. Disappointing such unpredictability in the operation of the system.
this is ok www.linuxquestions.org/questions/linux-networking-3/dns-lookup-336029/#post1708372
www.linuxquestions.org/questions/linux-networking-3/dns-lookup-336029/#post1708457
try ping anyhost
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question