How to configure Rendezvous/Bonjour/ZeroConf in OpenBSD with avahi deamon

by bram

Since the howl package is no longer available, but the excellent avahi is, here’s how to install and configure it:

(with an older OpenBSD system, you might want to check out:

http://doink.org/index.php?option=com_content&task=view&id=52&Itemid=1)

1. run a pkg_info on avahi:

Information for ftp://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/avahi-0.6.27.tgz

Comment:
framework for Multicast DNS Service Discovery

Description:
Avahi is a free, standards-compliant implementation of the Zeroconf
protocols Multicast DNS and DNS-SD.
It is a system which facilitates service discovery on a local network.
This means that you can plug your laptop or computer into a network and
instantly be able to view other people who you can chat with, find
printers to print to or find files being shared.  This kind of
technology is already found in Apple MacOS X (branded Rendezvous,
Bonjour and sometimes Zeroconf) and is very convenient.

Maintainer: Antoine Jacoutot <ajacoutot@openbsd.org>

WWW: http://www.avahi.org/

Install notice:
For proper function, multicast(4) needs to be enabled. To do so, add the
following line to /etc/rc.conf.local:
multicast_host=YES

To start avahi automatically, add the following to /etc/rc.local:
(after dbus-daemon but before Zeroconf-aware applications startup)

if [ -x /usr/local/sbin/avahi-daemon ]; then
echo -n ‘ avahi-daemon’; /usr/local/sbin/avahi-daemon -D
fi

Optionally to start the unicast DNS server configuration daemon, add
if [ -x /usr/local/sbin/avahi-dnsconfd ]; then
echo -n ‘ avahi-dnsconfd’; /usr/local/sbin/avahi-dnsconfd -D
fi

2. install the software

pkg_add avahi

* in case you run into the following, you haven’t got xbase etc… (see the openbsd install how to on the openbsd website to learn how to install this post install):

Can’t install dbus-1.2.24p4 because of libraries
|library ICE.9.0 not found
| not found anywhere
|library SM.8.0 not found
| not found anywhere
|library X11.13.0 not found
| not found anywhere
|library Xau.9.0 not found
| not found anywhere
|library Xdmcp.10.0 not found
| not found anywhere
|library pthread-stubs.0.0 not found
| not found anywhere
|library xcb.2.1 not found
| not found anywhere
Can’t use string (“dbus-1.2.24p4”) as a HASH ref while “strict refs” in use at /usr/libdata/perl5/OpenBSD/PkgAdd.pm line 883.

if not, you’ll get another shot at some important info:

bash-4.1$ sudo pkg_add avahi
avahi-0.6.27:libgamin-0.1.10p3: ok
avahi-0.6.27:pcre-8.02p1: ok
avahi-0.6.27:glib2-2.24.1p2: ok
avahi-0.6.27:gdbm-1.8.3p0: ok
avahi-0.6.27:dbus-1.2.24p4: ok
avahi-0.6.27:libdaemon-0.13: ok
avahi-0.6.27: ok
— +avahi-0.6.27 ——————-
For proper function, multicast(4) needs to be enabled. To do so, add the
following line to /etc/rc.conf.local:
multicast_host=YES

To start avahi automatically, add the following to /etc/rc.local:
(after dbus-daemon but before Zeroconf-aware applications startup)

if [ -x /usr/local/sbin/avahi-daemon ]; then
echo -n ‘ avahi-daemon’; /usr/local/sbin/avahi-daemon -D
fi

Optionally to start the unicast DNS server configuration daemon, add
if [ -x /usr/local/sbin/avahi-dnsconfd ]; then
echo -n ‘ avahi-dnsconfd’; /usr/local/sbin/avahi-dnsconfd -D
fi
— +dbus-1.2.24p4 ——————-
To start systemwide message dbus daemon whenever the machine boots,
add the following lines to /etc/rc.local:

if [ -x /usr/local/bin/dbus-daemon ]; then
install -d -o _dbus -g _dbus /var/run/dbus
echo -n ‘ dbus’; /usr/local/bin/dbus-daemon –system

3. add the last part to rc.local, after the avahi stuff you added in step 1

4. change /etc/myname to someting .local

5. edit /etc/avahi/avahi-daemon.conf

host-name=<your-name>

use-ipv6=no