Avahi mDNS allows connecting to the Raspberry Pi (or other Avahi-enabled device) without knowing the IP address.
For the Raspberry Pi, the default address is
If you have changed the
hostname of your Raspberry Pi as seen from
Then in that example, you’d do
instead of the default
As always, you should be using 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.
Setup Avahi mDNS for Wifi-connected host
For a Raspberry Pi or other SSH server on Wifi, the default
/etc/avahi/avahi-daemon.conf puts mDNS on all active interfaces.
If for some reason you need to manually configure the interfaces Avahi is on, here’s how.
This example is for a Raspberry Pi 3 with Raspbian, but will be very similar for many Linux devices.
find your Pi’s hostname
hostname the default is `raspberrypi`
Try to ping your Avahi device from your laptop
if this doesn’t work and you’re on a Windows PC, note that as of this writing, WSL does not yet support Avahi/mDNS. So you would need to use a native Linux or Mac laptop (or use SSH Windows-native client after installing Bonjour).
find your WLAN adapter device name by
often it will be named
wlan0. Also note the wlan0 IP address for testing if Avahi doesn’t work right away.
/etc/avahi/avahi-daemon.confto have the line
or whatever interfaces you want to use.
Testing Raspberry Pi Avahi mDNS
From a Mac, Linux, or Android device (currently Windows Subsystem for Linux doesn’t work with Avahi mDNS) try
If that doesn’t work, try using the IP address as found by typing in the Raspberry Pi
If that doesn’t work, be sure you’ve opened the Raspberry Pi
ufw firewall port.
You should see Port 22 (or whatever port you have in
/etc/ssh/sshd_config on the Raspberry Pi) from
sudo ufw status
If you prefer a GUI, you can use on the Raspberry Pi:
sudo apt install gufw
You can see which interfaces and IPv6/IPv6 Avahi is active on from the Pi
sudo service avahi-daemon status
More Avahi Diagnostics
sudo apt install avahi-utils mdns-scan
Then from your laptop (or Pi if diagnosing)
You should see your device (also try this from your Pi).