The Computer Oracle

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

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream

--

Chapters
00:00 Avahi: Ping Can'T Resolve Hostname, But Nslookup Can
02:50 Accepted Answer Score 36
03:25 Answer 2 Score 7
03:56 Answer 3 Score 2
04:25 Answer 4 Score 11
04:38 Thank you

--

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

--

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.