Skip to content

Instantly share code, notes, and snippets.

@davisford
Created July 12, 2013 14:14
Show Gist options
  • Save davisford/5984768 to your computer and use it in GitHub Desktop.
Save davisford/5984768 to your computer and use it in GitHub Desktop.
Setup avahi-daemon on Ubuntu for so you can reach hostname `ubuntu.local` from host OS
sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan
@donbarthel
Copy link

I'm not sure what's wrong on my Ubuntu system. avahi-browse -a shows my five local mDNS devices on the network by their host names. However, if I try avahi-resolve-host-name on any one of them it gives me a "Timeout reached". I'm unable to ping any of them. I've installed everything described in this thread, and I've tried the various settings. The behavior remains unchanged. Any thoughts what I may be missing?

Try the hostname without the ".local". I have an Octopi server (its a 3D printer appliance) on a Raspberry Pi and sometimes octopi.local works and sometimes just octopi. Not sure why. Then I just recently installed Avahi on a virtual machine and no matter what I did hostname.local didn't work. Then I tried hostname by itself without a .local and viola! SSH and web browser can both reach it that way.

@Bandicoot
Copy link

May I suggest the following as an all-in-one? sudo apt update && sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan && sudo apt upgrade. Once that looks good, sudo reboot. That got me going on my new Ubuntu install on the TuringPi RK-1 modules.

@eyadmba
Copy link

eyadmba commented Oct 7, 2024

I looked them up to know what each one does.
avahi-daemon is the core service on your device that makes it publish itself via mDNS. This is the only thing you need to make your device respond to {hostname}.local. It seems like it can also advertise other services on the network through mDNS though, but I'm not sure.

avahi-discover is a GUI app to show other services published through mDNS. I didn't need it.
mdns-scan is a CLI that also scans for mDNS services on the local network. Useful for troubleshooting, but I also didn't need it.
avahi-utils is a collection of CLI tools that could be useful, but I didn't need them for my server. It includes things like avahi-browse which is similar to the above two tools.

libnss-mdns is useful for client devices that want to access services published via mDNS. So if you want your device to reach other .local services, you need this installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment