Avahi-logo
Avahi-logo

Network discovery with Avahi and Bonjour

Avahi and Bonjour are open source implementations of the Zeroconf specification. With these tools it is possible to reach a host on your network without having its IP address, you need only need the hostname. Avahi runs on Linux and Bonjour on Windows and MacOS. It’s needed an both ends! Without any configuration you can reach a host by the url <hostname>.local, for example cubieboard.local. With Zeroconf it’s even possible to work without a DHCP server.

Install Avahi on Debian / Ubuntu / Raspbian servers

To install Avahi, open a SSH terminal and execute these commands

$ sudo apt-get update
$ sudo apt-get install libnss-mdns avahi-utils

Now you have Avahi running!

Install Bonjour on Windows

If you have iTunes installed on your machine, you have already Bonjour running, if not (like me), you need to get the Bonjour64.msi file. This file is not a seperate download, but it’s included in iTunes64Setup.exe. Download iTunes64Setup.exe from here: https://www.apple.com/itunes/download/.

Extract this exe file in the download folder with 7z or WinRAR. Now you have the \iTunes64Setup folder with the Bonjour64.msi file in it. Execute/install this file and you have Bonjour running on your machine!

Testing

Open in Windows cmd and try to ping the other machines

C:\Users\Arjan>ping cubieboard.local

Pinging cubieboard2.local [fe80::5ff:fe83:5601%20] with 32 bytes of data:
Reply from fe80::5ff:fe83:5601%20: time<1ms
Reply from fe80::5ff:fe83:5601%20: time<1ms
Reply from fe80::5ff:fe83:5601%20: time<1ms
Reply from fe80::5ff:fe83:5601%20: time<1ms

Also in the browser you can reach the server:

http://cubieboard.local

Remarks

  • You need to install Avahi or Bonjour on all machines where you want to use this functionality. On server and laptop/desktop.
  • If you have to switch on every machine IPV6 (this is default). Because if for example Avahi is using IPV6 the broadcast the machine info and your laptop is using IPV4, the system will not work of course. Or switch off IPV6 on every machine (not recommended).

If you are using KDE (Konqueror) or macOS (Finder), you can advertise your services on the local network with Avahi. How to add these services to Avahi, you can find here: https://wiki.archlinux.org/index.php/Avahi