Setting up mDNS with Avahi

Avahi is a service that provides mDNS name resolution for all the devices that use it on your local area network. This allows your device names (hostnames) to be used instead of an IP address. For example, my laptops host name is sk so other computers on the local network can use sk.local to find me instead of the IP number (192.168.1.49).

By default the Avahi service (avahi-daemon) comes on Linux Mint but is not activated. Here’s how to activate it on all the devices you want to use it with.

💎 mDNS is enabled on all Apple devices by default.

But First …

Step by Step

First let’s use the systemctl command to see the status of the avahi-daemon service.

systemctl status avahi-daemon

If you see something like the following it means it’s running and you don’t need to do anything else. Just look through it to find your host name. Now you can tell people to connect to your host name (mine is sk in this example).

Now might be a good time to consider changing your host name to something shorter.

[Changing Your Host Name on Linux]

● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
   Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-04-28 13:43:14 EDT; 5 days ago
 Main PID: 1181 (avahi-daemon)
   Status: "avahi-daemon 0.7 starting up."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/avahi-daemon.service
           ├─1181 avahi-daemon: running [sk.local]
           └─1197 avahi-daemon: chroot helper

May 03 23:40:17 sk avahi-daemon[1181]: Interface wlp2s0.IPv6 no longer relevant for mDNS.
May 03 23:40:17 sk avahi-daemon[1181]: Withdrawing address record for 192.168.1.49 on wlp2s0.
May 03 23:40:17 sk avahi-daemon[1181]: Leaving mDNS multicast group on interface wlp2s0.IPv4 with address 192.168.1.49.
May 03 23:40:17 sk avahi-daemon[1181]: Interface wlp2s0.IPv4 no longer relevant for mDNS.
May 04 07:48:04 sk avahi-daemon[1181]: Joining mDNS multicast group on interface wlp2s0.IPv4 with address 192.168.1.49.
May 04 07:48:04 sk avahi-daemon[1181]: New relevant interface wlp2s0.IPv4 for mDNS.
May 04 07:48:04 sk avahi-daemon[1181]: Registering new address record for 192.168.1.49 on wlp2s0.IPv4.
May 04 07:48:05 sk avahi-daemon[1181]: Joining mDNS multicast group on interface wlp2s0.IPv6 with address fe80::b3d:1c36:1076:c559.
May 04 07:48:05 sk avahi-daemon[1181]: New relevant interface wlp2s0.IPv6 for mDNS.
May 04 07:48:05 sk avahi-daemon[1181]: Registering new address record for fe80::b3d:1c36:1076:c559 on wlp2s0.*.

If you see something like the following your service is not running and probably disabled from running on startup.

TODO