Translation(s): none

An account of the Avahi (zeroconf, Apple Bonjour) framework provided by Debian. Based on the packages distributed with Debian 10 (buster) and Debian 11 (bullseye).


Avahi technology is dependent on the mDNS and DNS-SD protocols and allows machines to

The local network is assumed to be trusted. A firewall should should permit multicast traffic on port 5353. Installation of Avahi is straightforward and generally maintenance-free afterwards.

apt install avahi-daemon

Machines that have cups installed will already have avahi-daemon as a recommended package.

Avahi Utilities

Basically, avahi-daemon will quietly get on with its job of publishing and discovering network services and hosts and most users will require little more from it apart from hostname resolution.

However, it is sometimes desirable to interact directly with avahi-daemon and, for that purpose, avahi-utils is available. The utilities are

Other packages (GUI) of interest are

Hostname Resolution

Hostname resolution via the system's Name Server Switch (NSS) facility is performed by libnss-mdns, which is recommended by avahi-daemon. Otherwise do

apt install libnss-mdns

As explained in /usr/share/doc/libnss-mdns/README.Debian, the package's post-installation script alters a line in /etc/nsswitch.conf to read

hosts:          files mdns4_minimal [NOTFOUND=return] dns

The mDNS domain .local is where hosts on the network reside and mdns4_minimal handles queries only for that domain. Hostname resolution takes place automatically with commands such as

ping <hostname>.local
ssh <hostname>.local
nmap <hostname>.local

To resolve a hostname to an IPv4 address with avahi-resolve:

avahi-resolve -n -4 <hostname>.local

The reverse process is performed with

avahi-resolve -a

avahi-resolve obtains an IP address or hostname directly from the mDNS multicast from hosts. It does not use the NSS functionality of libnss-mdns.

Using avahi-browse

For a complete view of services and hosts on the network:

avahi-browse -art | less

An entry from the output of one such command will be used to illustrate the common features of any entry.

=   eth0 IPv4 Music Player @ desktop     Music Player Daemon  local
   hostname = [desktop.local]
   address = []
   port = [6600]
   txt = []

Music Player Daemon is the friendly service name. The service is running on port 6600 of the machine desktop.local with an IPv4 address The text record (txt =) in this case is empty. If a service name is not available it will be replaced by the service type. All this information is published and will be available to a client wishing to access the service.

A list of all the service names known to avahi-daemon is given by

avahi-browse --dump-db


avahi-browse --dump-db -k

gives a list of matching service types, application protocol names. The service type _mpd._tcp matches the human-readable Music Player Daemon. This service can specifically be browsed for with

avahi-browse -rt _mpd._tcp

Or, in general:

avahi-browse -rt <service-type>

Display service types of services discovered on the network:

avahi-browse -kat

Debian Package Integration with Avahi

Some indication of the Debian packages that support service publication and discovery may be gleaned from libavahi-client3:

apt rdepends libavahi-client3

An incomplete list of packages that co-operate with avahi-daemon to give service publication and discovery is:

Disabling avahi-daemon

With root privileges and for temporary disablement:

systemctl disable avahi-daemon.service avahi-daemon.socket
systemctl stop avahi-daemon.service avahi-daemon.socket

Reverse this state of affairs:

systemctl enable avahi-daemon.service avahi-daemon.socket
systemctl start avahi-daemon.service avahi-daemon.socket

For permenant disablement (surviving a machine reboot):

systemctl mask avahi-daemon.service avahi-daemon.socket
systemctl disable avahi-daemon.service avahi-daemon.socket
systemctl stop avahi-daemon.service avahi-daemon.socket

Registering a New Service in Avahi

avahi-daemon will publish local services set up according to .service files placed in the directory /etc/avahi/services. This is independent of the services published from what the system is already aware of on the network.

An example is ssh. openssh-server does not advertise via mDNS but can be induced to by the .service file provided in /usr/share/doc/avahi-daemon/examples/.

Printing and Scanning Services

The Debian 11 printing and scanning systems support discovery of printing and scanning services on the network and over USB.