FreeBSD can also be used to host Network File Service(NFS). We can use FreeBSD as NFS server and also as an NFS client. In this article let us look at how to configure NFS server on FreeBSD 10.
Server Installation and Configuration
Let us assume NFS server’s IP is 10.0.0.1. We can create NFS share on the server 10.0.0.1 using the following steps. We have to add the following lines in /etc/rc.conf before starting the service.
rpcbind_enable="YES" nfs_server_enable="YES" mountd_enable="YES" mountd_flags="-r"
The file, in which we have to mention the shared folders, is /etc/exports. We need to create the file now. Let us create it.
touch /etc/exports
Now let us start the services
service nfsd start service mountd reload
We can now configure a basic NFS share in this machine. For example, if we are going to share /home directory to the client 10.0.0.2, the entry on /etc/exports file would be like this.
/home 10.0.0.2
Connecting from the client
If the Client machine is FreeBSD or Linux, We can query the NFS server for information about the shared folders using the following command.
showmount -e 10.0.0.1
The output would be like
/home 10.0.0.2
We can mount the shared folder, using this command.
mount 10.0.0.1:/home /mnt