Raspberry Pi WiFi Avahi mDNS config

Avahi mDNS allows connecting to the Raspberry Pi and other Avahi-enabled host devices without knowing the host IP address. For the Raspberry Pi, the default mDNS address is raspberrypi.local, where raspberrypi comes from

hostname

The default /etc/avahi/avahi-daemon.conf puts mDNS on all active interfaces–including WiFi.

Manual config Avahi interfaces

This procedure is NOT typically needed. This example is for a Raspberry Pi 3 with Raspbian.

  1. On Raspberry Pi, find WLAN adapter name by
    ip a
    

    typically named wlan0. Also note the wlan0 IP address for testing if Avahi doesn’t work right away.

  2. edit /etc/avahi/avahi-daemon.conf to have
    allow-interfaces=eth0,wlan0
    

    or whatever interface desired to have Avahi on.

  3. Verify which interfaces and IPv6/IPv6 Avahi is active on from the Avahi host device:
    service avahi-daemon status
    
  4. Test Raspberry Pi Avahi mDNS: from a Mac, Linux, Windows or Android device try
    ping raspberrypi.local
    

    If that doesn’t work, try using the IP address as found on Avahi host:

    ip a
    

Configure firewall for SSH

Be sure you’ve opened the Raspberry Pi ufw firewall port. You should see Port 22 (or other SSH port assigned in /etc/ssh/sshd_config on the Raspberry Pi) from

ufw status

If you prefer a Firewall GUI:

apt install gufw

Notes

Avahi Diagnostics

  1. prereqs
    apt install avahi-utils mdns-scan
    
  2. from your laptop (or Pi if diagnosing)
    avahi-browse -arp
    

    or

    mdns-scan
    

You should see your device (also try this from your Pi).

SSH security

Use SSH Public Key Authentication with ED25519 keys. Raspberry Pi is trivial to hack like any other device on any operating system if proper cybersecurity is not used. Why do you care if someone hacks your Pi? The hacker can use the Pi’s relatively powerful CPU & GPU to stage sophisticated attacks on the rest of your network.

Leave a Comment