Home arrow Latest Tutorials arrow Configuring NFS server and client in FreeBSD
Configuring NFS server and client in FreeBSD PDF
Saturday, 03 October 2009
This tutorial shows you how to configure a NFS server and a NFS client in FreeBSD in a simple way.

A. Configuring the NFS Server
-------------------------------

Step 1A. Configure NFS Server, start the NFS service
----------------------------------------------------
Add the following lines to /etc/rc.conf

# ----------- add this to rc.conf ------
nfs_server_enable="YES"
mountd_flags="-r"
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
# ----------- end ------------------------


Step 2A. Add the directories we want to share to /etc/exports
------------------------------------------------------------
/usr/home/fileserver/drive -maproot=root 10.0.0.10 10.0.0.20

This will export /usr/home/fileserver/drive directory and allow other systems to access this partition as with root permisions.
If you omit -maproot=root parameter you will still see the partition from other systems but will be read only.

10.0.0.10 and 10.0.0.20 are machines that are allowed to mount NFS server resources.


Step 3A. Start the NFS server services
-------------------------------------
Do the following steps from command line, with root account

 rpcbind
 nfsd -u -t -n 4
 mountd -r

Important! After you change /etc/exports file you must reload mountd service.
You can acompilish that by doing:

/etc/rc.d/mountd onereload

After you've followed all steps when debuging it is useful to look in /var/log/messages, usualy if something is not properly configured, messages from there will help you to debug easely.


B. Configuring the NFS Client
------------------------------

Step 1B. Add service in /etc/rc.conf to start as boot and start the NFS client
----------------------------------------------------------------------------
Add the following lines to /etc/rc.conf

# ----------- add (append) to /etc/rc.conf -----------------
nfs_client_enable="YES"
nfs_client_flags="-n 4"
#------------ end of file --------------------------------------

Start the NFS client:
nfsiod -n 4


Step 2B Mount NFS Server resource on client machine
------------------------------------------------------
mount -v 10.0.0.5:/home/fileserver/drive /mnt/server

If you want this resource to be mounted automaticaly you can place a record in /etc/fstab.
If you are not sure if NFS Server will be available started) all the time you can mount the resource at boot, with a script, or you can use amd to automout the directory where the resource will be mounted.

To debug don't forget to look into /var/log/messages file.
( tail -f /var/log/messages )
Last Updated ( Wednesday, 07 October 2009 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?