I have a problem with name resolution on one of my Pis. I have set my router to start dnsmasq with LAN domain local. Other systems except this Pi can ping host.local addresses just fine.

I installed dnsutils on my Pi to see if this is a DNSMasq problem. When I do nslookup ipad.local, I get the IP and the correct response. But when I do ping ipad.local, the name doesn't get resolved. However, to my surprise, when I change it omitting .local, it works: ping ipad How can I make the .local domain get resolved?


Turn out I had to change priorities in /etc/nsswitch.conf from:

hosts:          files mdns4_minimal [NOTFOUND=return] dns


hosts:          files dns myhostname mymachines mdns4_minimal [NOTFOUND=return]

It gives DNS server results priority over avahi.

  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Dec 28 '19 at 23:03

nslookup is part of dnsutils so you need to install that with:

sudo apt install dnsutils

First test:

pi@raspberry:~ $ nslookup lanhost.local

Name:   lanhost.local

pi@raspberry:~ $ ping lanhost.local
ping: unknown host lanhost.local

So nslookup works, but ping doesn't. As sozkara mentiones. We need to edit /etc/nsswitch.conf.

sudo nano /etc/nsswitch.conf

Change this line

hosts:          files mdns4_minimal [NOTFOUND=return] dns

so it looks like this

hosts:          files dns myhostname mymachines mdns4_minimal [NOTFOUND=return]

Second Test:

pi@raspberry:~ $ ping lanhost.local
PING lanhost.local ( 56(84) bytes of data.
64 bytes from lanhost.local ( icmp_seq=1 ttl=128 time=1.69 ms
64 bytes from lanhost.local ( icmp_seq=2 ttl=128 time=0.783 ms
64 bytes from lanhost.local ( icmp_seq=3 ttl=128 time=0.558 ms

Because you also tagged the raspberrypi zero: Windows does not implement mDNS properly. For that you need a servoce like Bonjour. This allows devices to register properly on .local

See here for further information https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux

(might also hrlp with other

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.