Installing Avahi on FreeBSD

From searching around on google, apparently either nobody installs the multicast DNS/Zeroconf module Avahi on FreeBSD or it’s so easy to install it warrants no easy to follow documentation. Unfortunately, neither of the above are true, so I will do my best to provide an easy-to-follow tutorial for getting Avahi working on FreeBSD. Specifically, getting Avahi set up to allow for .local domain support locally as well as broadcasts of the computer’s own information over multicast dns.

First, install avahi and nss-mdns. Please note that avahi requires dbus which, in turn, requires glib, so if you don’t have these packages installed already, it could take some time. Also, since nss-mdns requires avahi, all you have to do is install nss-mdns and it will grab everything else automatically.

# cd /usr/ports/net/avahi && make install clean
# cd /usr/ports/dns/nss_mdns && make install clean

Make sure the service starts by adding


to /etc/rc.conf.

Finally, edit /etc/nsswitch.conf and change

hosts: files dns


hosts: files dns mdns


Now reboot. When everything comes back up, try pinging something that you know broadcasts mDNS. Try pinging hostname.local from another computer that supports mDNS as well. If all went well, it should work perfectly and the IP address with get looked up without issue and other computers on the network will pick up the mDNS information. Done!

[BTW, the only not-so-obvious part of the whole thing is editing nsswitch.conf. Unfortunately, there are multiple sites that have information on it and most of the information available simply doesn't work. Maybe it's just my computer or maybe they're for a different version of nss-mdns. Regardless, after quite a bit of searching and trial-and-error, I found the change listed here to work perfectly.]

en/freebsd/installing_avahi.txt · Last modified: 2011/05/17 11:24 by alex
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki