Avahi-daemon is a service running on Linux systems that provides network service discovery using mDNS (Multicast DNS) and DNS-SD (DNS Service Discovery).
It helps devices and applications find each other on a local network without needing to configure the DNS server manually.
This service is particularly useful for home networks or small office environments where devices like printers, file shares, and media servers need to be discovered easily by other devices.
Why Enable Avahi-Daemon?
Enabling Avahi-daemon can be beneficial in many scenarios:
- It simplifies the process of connecting to network services.
- Ideal for homes with multiple devices like smart TVs, printers, and computers that need to communicate.
- Facilitates the discovery of shared resources like files and printers.
- It is useful for developers who must discover and test network services without dealing with complex configurations.
Why Disable Avahi-Daemon?
While Avahi-daemon is useful, there are reasons you might want to disable it:
- Broadcasting services on the local network can pose a security risk, especially in larger or less trusted networks.
- It consumes system resources, so disabling it can free up CPU and memory for other tasks.
- Some networks, particularly in corporate environments, have strict policies against auto-discovery services.
- If you do not use any service that requires Avahi, it makes sense to disable it to simplify your system.
How to Disable Avahi-Daemon on Systemd-based Systems
To disable avahi-daemon, you need to stop the avahi-daemon service and prevent it from starting automatically at boot as shown.
sudo systemctl stop avahi-daemon sudo systemctl disable avahi-daemon
Next, you need to mask it so that it impossible to start the service manually or automatically by other services.
sudo systemctl mask avahi-daemon
Finally verify that avahi-daemon is no longer running.
sudo systemctl status avahi-daemon
How to Enable Avahi-Daemon in Linux
To enable avahi-daemon again, you need to umask, enable and start the service so that it starts automatically at boot.
sudo systemctl unmask avahi-daemon sudo systemctl enable avahi-daemon sudo systemctl start avahi-daemon
To ensure that avahi-daemon is running and enabled, check its status with the following command.
sudo systemctl status avahi-daemon
How to Disable Avahi-Daemon on Non-Systemd Systems
Disabling or enabling avahi-daemon in a non-systemd distribution involves different steps than systemd-based distributions. Non-systemd distributions often use init systems like SysVinit, Upstart, or OpenRC.
On SysVinit
To disable avahi-daemon on SysVinit systems, you need to stop the service and prevent it from starting automatically at boot as shown.
sudo /etc/init.d/avahi-daemon stop sudo update-rc.d -f avahi-daemon remove
To enable the avahi-daemon service again, run the following commands.
sudo update-rc.d avahi-daemon defaults sudo /etc/init.d/avahi-daemon start
On Upstart
To disable avahi-daemon on Upstart systems, you need to stop the service and disable it from starting at boot as shown.
sudo stop avahi-daemon sudo sh -c 'echo "manual" > /etc/init/avahi-daemon.override'
To enable the avahi-daemon service again, you must remove the override and start the service.
sudo rm /etc/init/avahi-daemon.override sudo start avahi-daemon
On OpenRC
To disable avahi-daemon on OpenRC systems, you need to stop the service and disable it from starting at boot as shown.
sudo rc-service avahi-daemon stop sudo rc-update del avahi-daemon default
To enable the avahi-daemon service again, run the following commands.
sudo rc-update add avahi-daemon default sudo rc-service avahi-daemon start
Conclusion
avahi-daemon is a useful service for discovering network services effortlessly, especially in home and small office networks. However, it may not be necessary or desirable in all environments, particularly where security and performance are prioritized.
Great and clear information on disabling this SystemD service. Many forget to mention the ‘mask‘ part.
Thanks a lot—this was exactly what I needed to disable the annoying discovery service on Debian.
How does one disable/enable AVAHI in a non-systemd distro?
@dragonmouth,
Hi there! I’ve added instructions on how to disable/enable Avahi-Daemon in non-systemd distributions in the article.
Thank you very much.