Manual for Debian Etch/Squeeze

In this small howto, we gonna set up two computers in the local network to share directories.

Without a DNS server and dynamically assigned IP addresses, we usually have the problem, that IP addresses may change and the client doesn’t know the servers IP address automatically.

Now, by using avahi, we can assign names to our computers, that can be retrieved by the others in the same local network.

These names always end with .local, a possible name for our server would thus be server.local.

Server

Like this in Squeeze, drop the nfs-common part in Etch:

aptitude install avahi-daemon nfs-common nfs-kernel-server

Configure NFS-Server

Not explained here in detail, please use your favorite search engine to find out, if necessary.

You will have to set your /etc/exports file to hold the directories you want to export and give some restriction on the machines that you want to allow to access your shared directories.

Configure avahi for NFS broadcast in local network

Open a terminal window and get root by using su or sudo together with the commands:

su

editor /etc/avahi/services/nfs.service

Fill the File /etc/avahi/services/nfs.service with the following text:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name> ## Name
<service>
<type>_nfs._tcp</type>
<port>2049</port>
</service>
</service-group>

Restart avahi:

/etc/init.d/avahi restart

Client

In Squeeze:

aptitude install autofs5

With Etch:

aptitude install autofs nfs-client

Configure autofs

editor /etc/auto.master

Text in file /etc/auto.master:

/ /etc/auto.misc --timeout=60

editor /etc/auto.misc

Text in file /etc/auto.misc:

<name Directory for automount on client> <hostname>.local:/<path to NFS-export>

Adjust file rights:

chmod 777 <path to NFS-export>

You can mount your remote directories with a mouse click from your file browser by creating a symlink:

ln -s <directory for automount on client> <link name>

Restart autofs:
/etc/init.d/autofs restart

Example

The directory for automount shall be /mnt.

In auto.misc we would write:
myavahi /home/userremote/directoryremote.

Our symlink shall be created in /home/user/Documents.

Create link as follows:
ln -s /mnt/myavahi /home/user/Documents/avahilink