The Computer Oracle

avahi: ping can't resolve hostname, but nslookup can

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Question
03:26 Accepted answer (Score 35)
04:13 Answer 2 (Score 11)
04:34 Answer 3 (Score 7)
05:21 Answer 4 (Score 6)
05:45 Thank you

--

Full question
https://superuser.com/questions/704785/a...

Question links:
[ping doesn't make a dns request]: http://www.linuxquestions.org/questions/.../

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #dns #ping

#avk47



ACCEPTED ANSWER

Score 36


As described in detail in this blog post, you need to edit /etc/avahi/avahi-daemon.conf:

[server]
domain-name=.alocal

This binds the daemon to the domain .alocal instead of the default .local.

and restart the daemon with:

sudo service avahi-daemon restart

Note from the blog post:

You may need to flush the DNS,mDNS and resolver cache, as well as restart your web browsers to clear their internal cache.

After that, ping and nslookup started to agree.

Thanks to harrymc for getting me on the right track.




ANSWER 2

Score 11


Modifying /etc/nsswitch.conf and replacing:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

by:

hosts:          files dns

worked for me.




ANSWER 3

Score 7


Easy thing to do: Edit /etc/default/avahi-daemon

Change the line:

AVAHI_DAEMON_DETECT_LOCAL=1

to

AVAHI_DAEMON_DETECT_LOCAL=0

Restart the avahi-daemon, or kill it.

I don't like Avahi, and I don't use any of its features. If you want to truly disable avahi, modify /etc/init/avahi-daemon.conf, similar to the following:

start on (never 
          and filesystem
      and started dbus)
stop on stopping dbus



ANSWER 4

Score 2


If you are not doing connection sharing with other devices or VMs thru your computer, you could turn off dnsmasq in Network Manager.

Edit /etc/NetworkManager/NetworkManager.conf and comment the line (put a # in front of it) :

dns=dnsmasq

Then do :

sudo restart network-manager

That will turn off the local resolver.

Source: DNS in Ubuntu 12.04.