Bonjour (mDNS) via OpenVPN on Linux with Avahi-deamon

Posted by Quinny Mon, 14 Sep 2009 15:39:08 GMT
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!

Screen shot 2009-09-14 at 17.19.13.png
"Cerberus" is now visible on my Macs!

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:

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:
Screen shot 2009-09-14 at 17.18.57.png
Zoomed all the way in on the icon using the new zoom feature in Snow Leopard.

1 comment |



Comments

Leave a comment

  1. manu
    4 days later:
    I love this tip. Just did the same thing between my parents home and my uni-flat. Thanks!!

Leave a comment