Installing and configuring Netatalk AFP on FreeBSD

on Wednesday 26th September, 2007 Gabe speculated thusly…

I have recently had a hard time getting FreeBSD to ‘play ball’ by sharing it’s resources via AFP. I have compiled this guide to help others through the traumatic experience. I was using FreeBSD 6.2 release and Netatalk 2.0.3 from ports. Though I have heard it works on 6.1 and 6.3.

Compiling Netatalk into the Kernel

The netatalk port requires the presence of the AppleTalk communications protocol in the system’s kernel. The following line in the kernel’s configuration file will enable AppleTalk:

options         NETATALK    # AppleTalk

You should now recompile the kernel as described in the FreeBSD Handbook. You will then need to reboot.

Install from Ports

cd /usr/ports/net/netatalkmake  WITH_SRVLOC=yes install

Edit /etc/rc.conf

Add the following lines to the file using your fave text editor.

slpd_enable="YES"

netatalk_enable="YES"atalkd_enable="YES"

cnid_metad_enable="YES"

afpd_enable="YES"

mdnsresponder_enable="YES"

mdnsresponder_flags="-f /usr/local/etc/mDNSResponder.conf

Install howl

cd /usr/ports/net/howl

make install

Create an mDNS Config

vi /usr/local/etc/mDNSResponder.conf
Now add the following to it:

BigMac _afpovertcp._tcp     local.  548

BigMac _ssh._tcp            Servers. 548

 

Note:
THERE MUST BE TABS BETWEEN THE ITEMS and A NEWLINE AT THE END!
BigMac is your servername

Conclusions

Afpd only advertises over appletalk, not over
tcp/ip. If your Macs are all OSX they don’t listen to appletalk
announcements. They listen to appletalk-over-tcp/ip announcements
which use the rendezevous protocol which is what mdnsresponder is
all about.
Note - try to keep any samba shares separate
from the appletalk shares. Samba clients do not update the
desktop file when they move/change/delete files which will result in
a corrupted desktop file. (ie: CNID database) If that happens you can do this:

/usr/local/etc/rc.d/netatalk.sh stop

cat /usr/local/etc/AppleVolumes.default

(shares are listed at the bottom)

Go to each share with the problem and rename the directory, ie:

cd /home/shares/Public

mv .AppleDB .AppleDB-temp-backup

Restart netatalk:

/usr/local/etc/rc.d/netatalk.sh start

Verify people can mount the shares and get to their files. Then you may delete the .AppleDB-temp-backup dirs.

Credits

Many thanks to Ted Mittelstaedt who provided enourmous assistance with creating this page, and everyone else who contributed on the FreeBSD mailing list.

Tags: , ,

2 Responses to “Installing and configuring Netatalk AFP on FreeBSD”

  1. Paul Bauer Says:

    you have the following typo.

    netatalk_enable=”YES”atalkd_enable=”YES”

    should be:

    netatalk_enable=”YES”
    atalkd_enable=”YES”

  2. Ray Bryan Says:

    I noted 2 more typos on the page:
    cd /usr/ports/net/netatalkmake WITH_SRVLOC=yes install

    should be:

    cd /usr/ports/net/netatalk
    make WITH_SRVLOC=yes install

    AND
    mdnsresponder_flags=”-f /usr/local/etc/mDNSResponder.conf

    has a quote at the start of the definition but not at the end.

Leave a Reply