If you have ever monitored the network traffic on an Ubuntu machine using a tool like Wireshark, you might have noticed a constant stream of background multicast packets originating from your computer. This chatter is generated by avahi-daemon, a service that implements Apple’s “Bonjour” protocol (also known as mDNS/DNS-SD) for zero-configuration networking.
Avahi is useful because it allows your Ubuntu machine to automatically discover local network printers, Apple TVs, and other Linux machines without needing a central DNS server. However, if you are running a secure server, a virtual machine, or if you simply prefer a quiet network interface and know the static IPs of your devices, you can completely disable this broadcasting service.
How to Disable the Avahi Daemon
Disabling the service requires a few terminal commands, as Avahi is deeply integrated into the Ubuntu startup process via systemd.
- Open your terminal application (
Ctrl+Alt+T). - First, stop the currently running service and its associated network socket by running the following command:
sudo systemctl stop avahi-daemon.service avahi-daemon.socket
- Next, disable the service so it does not automatically restart the next time you boot your computer:
sudo systemctl disable avahi-daemon.service avahi-daemon.socket
- Because other software packages might attempt to start the avahi-daemon as a dependency, the safest way to ensure it never runs is to “mask” the service. Masking links the service to
/dev/null, making it impossible to start:
sudo systemctl mask avahi-daemon.service avahi-daemon.socket
What Are the Side Effects?
Once Avahi is disabled, your Ubuntu machine will stop broadcasting its hostname (e.g., ubuntu.local) to the rest of the network. Furthermore, your machine will no longer automatically discover network printers or cast-enabled devices via mDNS.
If you find that your printer suddenly stopped working, or if you need to use a tool that relies on local discovery, you can undo these changes by running the unmask and enable commands:
sudo systemctl unmask avahi-daemon.service avahi-daemon.socket
sudo systemctl enable --now avahi-daemon.service avahi-daemon.socket