Skip to content

Local Network Discovery

João Mário Lago edited this page Feb 29, 2024 · 1 revision

Configuring System/Browser to Use Avahi for .local Domain Discovery on Linux

This guide provides the steps to enable your Chrome browser and other services on Linux to discover .local domains using Avahi through Multicast DNS (mDNS). This setup is useful for accessing devices and services on your local network that advertise their presence using .local domain names.

Prerequisites

Ensure your Linux distribution is up-to-date and has internet access to download necessary packages.

Step 1: Ensure Avahi is Installed and Running

Avahi is a service discovery system that uses mDNS/DNS-SD protocol suite. Check if Avahi is installed and running:

avahi-daemon --version

If not installed, you can install Avahi using your package manager

Step 2: Enable Avahi Daemon

Enable and start the Avahi daemon using your system's service manager:

systemctl enable avahi-daemon
systemctl start avahi-daemon

Step 3: Install nss-mdns Package

The nss-mdns package allows your system to resolve .local domain names. Install it using your package manager.

Try to find the package either using name libnss-mdns or nss-mdns and install it using your package manager.

For Debian-based systems:

sudo apt-get install libnss-mdns

For arch:

sudo pacman -S nss-mdns

Step 4: Configure nsswitch.conf

Modify /etc/nsswitch.conf to include mdns_minimal [NOTFOUND=return] before resolve, you may need sudo privileges to edit this file.

Change the line:

hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns

To:

hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns

Step 5: Restart Avahi Daemon

Apply the changes by restarting the Avahi daemon:

sudo systemctl restart avahi-daemon

Testing

Test the setup by pinging a .local domain on your network:

ping blueos.local