UPDATE: You should really be using Avahi now. Don't use this.
UPDATE: The command line switches have changed in newer versions of Apple's mDNS code. Make sure you read the README.
I had someone on slashdot ask me how to do this, so here it is.
How to set up Rendezvous services on Linux (or other UNIX like OS).
Firstly, this is only to help the mac find the Linux stuff, not the other way around. Linux applications need to be modified to enable this. So, with that said, on to the HOWTO.
What you'll need:
- One or more UNIX like boxen (Linux, and BSD should all work fine)
- One or more computers running Mac OS X Jaguar or higher
- The Rendezvous Source Code from Apple
- A bit of UNIX knowlege (how to extract tarballs and compile programs).
The services I have enabled over Rendezvous are AFP, FTP and SSH. In addition to everything below, in order to serve these you'll need netatalk, OpenSSH and your favorite ftpd (I'm using OpenBSD's ftpd, but feel free to use proftpd or wu-gimme-root-ftpd).
Extract and follow the instructions for compiling the Rendezvous for POSIX systems. You should end up with files named
mDNSResponderPosix. You can read the documentation that comes with it to learn about each of these. The one we're interested in is
I put my
mDNS*Posix stuff in
/usr/local/lib/mDNS and then created an init script to handle starts and stops. Do whatever your distro thinks is normal for this kind of thing, or do something completely different. It's up to you.
Create a text file that contains the services you want to share. If you don't know what services you want to share, or what they're called, take a look at the Rendezvous service types used in Mac OS X published by Apple. I named mine
mdns.services and also placed it in
/usr/local/lib/mDNS. Here's what mine looks like:
Overlook _afpovertcp._tcp. TXT 548 Overlook _ftp._tcp. TXT 21 Overlook _ssh._tcp. TXT 22 My Stuff _http._tcp. path=/~bahamat/ 80
The first line of each block is the name you want the service shared under (this will also supply DNS resolution, so you can for example ping Overlook.local from the mac and it'll hit my Linux box). The second line is the service type. I forget what line 3 is for, but as you can see all of them are specified as being text, and line 4 is the port number. The service and port number have to match. Check
/etc/services if you're not sure what to put where.
The startup script (that I mentioned earlier) needs to call mDNSResponderPosix with two switches,
-f to specify the filename of services and
-d to force daemon mode. The important line looks something like this:
mDNSResponderPosix -f /usr/local/lib/mDNS/mdns.services -d
After you start it up you can open up the Finder on your Mac and go to the network section. In it you'll find the AFP service available. If you have Fugu you can open it up and see the SSH service in there. CyberDuck (which I don't recomend using) will show you the FTP service.
Future projects for me include adding WebDAV and NFS since Apple says that both are browsable via the Finder. I also think it would be fun to get my hands on Apple's
mod_rendezvouz for Apache, and find a way to allow Gaim and iChat to interface over Rendezvous (are you listening Sean Eagen??).
Special thanks to Steve Jobs for giving us the wonderous treasure that is Mac OS X and Rendezvous, Ken Thompson for giving us the awesome splendor of UNIX, and Linus Torvalds for making UNIX cheap and available for me to learn on.
Copyright © 2004 Brian Bennett
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.