6

I just set up my new Pi2 with Raspbian. All works well, I installed avahi, so that I can reach the Pi via raspberrypi.local. However, the Pi does not find my MacBook, which is usually resolvable via mymacbook.local. For example, this is what I get when pinging:

raspberrypi $ ping mymacbook.local
ping: unknown host mymacbook.local

The other way around works fine.

What do I need to do, to make Raspbian search the .local domain?

The Pi is connected via WiFi (wpa_supplicant), using DHCP.

2 Answers 2

7

What you are trying to do is to add multicast DNS to the name searching on Raspbian.

Install the package libnss-mdns (ie: sudo apt-get install libnss-mdns). This will pull in the Avahi packages to implement multicast DNS (which is used for name resolution for ".local" domains).

After installation ensure that /etc/nsswitch.conf has the line:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

Edit: when going from mac-->raspi to ensure that the Mac can log into your Raspberry Pi install the package avahi-daemon and add a file /etc/avahi/services/ssh.service containing

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_ssh._tcp</type>
    <port>22</port>
  </service>
</service-group>

Note that the RaspberryPi ships with IPv6 turned off. If the other host does not implement IPv4 link local addresses then you may need to turn on IPv6 on the RaspberryPi to have a IP protocol in common between the two machines. You can turn onIPv6 on the RasPi deleting /etc/modprobe.d/ipv6.conf and rebooting.

3
  • After looking at your answer, I think I misread the question. Your answer is better than mine.
    – Celada
    Feb 9, 2015 at 5:33
  • Thanks for the compliment. It took me while to set this up, so I was more than happy to help out someone else.
    – vk5tu
    Feb 9, 2015 at 5:38
  • Great explanation. I've obviously already got sshd set up already, but telling avahi about it is a good idea!
    – Arne
    Feb 9, 2015 at 8:05
5

Command line with avahi (used on Linux):

avahi-browse -a

GUI using avahi:

avahi-discover

GUI using MacOS: Bonjour Browser.

NOTE: none of these actually search the .local domain. It is not possible in general to browser or enumerate DNS domains. What they do is browser the underlying Zeroconf network services.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .