…or just about any other UNIX you happen to be running that doesn’t have Avahi.
Introduction
If you have the need to advertise Linux services via Rendezvous, you can install Apple’s Rendezvous responder on your Linux box. The setup described here is only useful to advertise services on one machine (i.e., one responder per machine), but since it is a very resilient setup (there is no single point of failure and no need to run a graphical app like Network Beacon), I decided to document the procedure (besides, I had dabbled in this earlier with good results, and thought it was high time to write down all the steps properly).
You can get a machine to advertise services for an entire network, but the current Rendezvous sample responders aren’t up to scratch right now - you have to run multiple instances of mDNSProxyResponderPosix
(one for each service you want to advertise) and that’s not a good enough solution as far as I’m concerned. Maybe someone will develop a better responder, but for now that’s that.
Note: An alternative Rendezvous responder/client that seems to work better in both Windows and FreeBSD is Howl, which I wholeheartedly recommend since some people have reported difficulties getting this to work under older Linuxes and FreeBSD. Howl also runs on Solaris, which may be good news for a lot of people. If you’re running Gentoo, Sandy McArthur has a Howl Gentoo package and a set of notes on Rendezvous.
Compiling mDNSResponderPosix
Get the mDNSResponder
source code from the Apple Developer Connection (registration required), unpack and compile it:
# mkdir Build
# cd Build
# tar -zxvf ../Packages/mDNSResponder-58.tar.gz
Now cd
into the mDNSPosix
directory and compile it for Linux:
# cd mDNSResponder-58/mDNSPosix
# make os=linux
Installation
Since there is no standard way to install the binaries, I opted for moving them into /usr/local/sbin
(they are, after all, system daemons, and this is a local customization):
# mv build/mDNS* /usr/local/sbin
System Configuration
Based on snippets found on the Rendezvous mailing-list, I cobbled up a simple startup script for the mDNSResponder
(I removed my RedHatisms (like checking for network status using ${NETWORKING}
) so that it should be a drop-in on most Linux distros):
# cat /etc/rc.d/init.d/rendezvous
#!/bin/sh
#
# A startup script for the Rendezvous mDNS Responder
#
# chkconfig: 345 98 2
# description: This script is used to start the rendezvous \
# server as a background process.\
#
# Usage /etc/init.d/rendezvous start|stop|reload|restart|status
# Source function library.
. /etc/rc.d/init.d/functions
RDV_CONF=/etc/rendezvous.conf
RDV_PID=/var/run/mDNSResponder.pid
prog=Rendezvous
exe=/usr/local/sbin/mDNSResponderPosix
start() {
echo -n "Starting $prog: "
daemon $exe -f $RDV_CONF -b
RETVAL=$?
echo
}
stop() {
echo -n "Stopping $prog: "
killproc $exe -SIGINT
RETVAL=$?
echo
}
reload()
{
echo -n $"Reloading $prog:"
killproc $exe -HUP
RETVAL=$?
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $exe
RETVAL=$?
;;
*)
echo "Usage: rendezvous {start|stop|reload|restart|status}"
exit 1
esac
After putting the file in place, use chkconfig
to add it to the services list and enable it for runlevels 3, 4 and 5:
# chkconfig --add rendezvous
# chkconfig --level 345 rendezvous on
You will have noticed that the startup script depends on a configuration file (/etc/rendezvous.conf
). I don’t know all the valid Rendezvous schemas, but a good starting point (that will make your Linux box visible in Safari and Terminal.app’s File|Connect To Server...
menu) is this:
# cat /etc/rendezvous.conf
Linux Web Server
_http._tcp.
path=/
80
User's Site
_http._tcp.
path=/~user
80
linux
_ssh._tcp.
none
22
First Run
Obviously enough, service rendezvous start
will start the daemon and the machine should be instantly accessible from the Safari Rendezvous menu.
If anything goes wrong and you can’t see the new entries in Safari’s Rendezvous menu, try running the daemon by hand in verbose mode - mDNSResponderPosix
has the following command-line options:
Usage: mDNSResponderPosix [-v level ] [-r] [-n name] [-t type] [-d domain] [-x TXT] [-p port] [-f file] [-b] [-P pidfile]
-v verbose mode, level is a number from 0 to 2
0 = no debugging info (default)
1 = standard debugging info
2 = intense debugging info
can be cycled kill -USR1
-r also bind to port 53 (port 5353 is always bound)
-n uses 'name' as the host name (default is none)
-t uses 'type' as the service type (default is '_afpovertcp._tcp.')
-d uses 'domain' as the service domain (default is 'local.')
-x uses 'TXT' as the service TXT record (default is empty)
-p uses 'port' as the port number (default is '548')
-f reads a service list from 'file'
-b forces daemon (background) mode
-P uses 'pidfile' as the PID file
(default is '/var/run/mDNSResponder.pid')
only meaningful if -b also specified
And that’s it. Have fun accessing your Linux box automagically from any [Mac][mac] on your network…
Final Note and Disclaimer
This should be reproducible on just about any Linux distro you care to name (and FreeBSD as well, with different startup scripts and minor tweaking), but it has only been tested on RedHat 9.0 and Fedora Core 1 - so your mileage may vary, your Linux box may disappear mysteriously or your cat might show up on Rendezvous.
In short, these instructions worked for me. There is no guarantee (express or implied) that they’ll work for you, nor will I necessarily be able to help you if anything goes wrong.