Bonjour (mDNS) via OpenVPN on Linux with Avahi-deamon
I've been using an EEE Box as a server at my parents home. I've installed Netatalk on it, to provide AFP network shares to my Macs (via OpenVPN). I always felt a little sad about this server not appearing in the "Network" list on my Macs.
After some Googling around today, I found a way to get it in there!
The solution is called "avahi-daemon" and it works!
"Cerberus" is now visible on my Macs!
Read on to see how to get it to work.
After some Googling around today, I found a way to get it in there!
The solution is called "avahi-daemon" and it works!

Read on to see how to get it to work.
First, you have to change your OpenVPN configuration to use a tap device instead of a tun device. The mDNS service won't travel over a level 3 connection but it will over level 2. (So, instead of making a TCP tunnel you're making an ethernet tunnel.)
If you're using a firewall (shorewal?) you'll need to change your firewall as wel (tun will need to be changed to tap) and you'll need to update your client configuration files. You'll also want to allow your firewall to initiate connections over the tap interfaces.
When that is done, just install avahi-deamon. If you're using Ubuntu, like me, you just type:
After which, you only need to configure the services you want to announce:
And restart avahi-daemon
You can do this for any service you have running. If you add VNC you get a "share screen" button in Finder.
You can probably also change the model=Xserve bit to make your server appear to be a Mac Mini, iMac or a Mac Pro, as these have different icons in the in Finder.
I like the XServe icon:
Zoomed all the way in on the icon using the new zoom feature in Snow Leopard.
If you're using a firewall (shorewal?) you'll need to change your firewall as wel (tun will need to be changed to tap) and you'll need to update your client configuration files. You'll also want to allow your firewall to initiate connections over the tap interfaces.
When that is done, just install avahi-deamon. If you're using Ubuntu, like me, you just type:
Code:
$ sudo apt-get install avahi-daemon
After which, you only need to configure the services you want to announce:
Code:
$ sudo nano /etc/avahi/services/afpd.service
Code:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Cerberus</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>And restart avahi-daemon
You can do this for any service you have running. If you add VNC you get a "share screen" button in Finder.
You can probably also change the model=Xserve bit to make your server appear to be a Mac Mini, iMac or a Mac Pro, as these have different icons in the in Finder.
I like the XServe icon:

4 days later: