NFSv3 (Network File System Version 3)

Client setup

There isn't much to setup on the client side. You need to:

and then just mount the remote filesystem like this:

mount -t nfs yourserver:/exportdir /mnt -o hard,intr,nfsvers=3,rsize=2048,wsize=2048

Test things

on the client:
showmount -e nfsserver
rpcinfo -p nfsserver
on the server:
showmount -a
nfsstat

Server setup

NFSv4 (Network File System Version 4)

The main difference between NFSv3 and NFSv4 is, that NFSv4 uses only one single TCP port (default is 2049) and therefore can be used over the internet (unlike NFSv3)
Also the mapping of user names to userids works in a better way (users don't need to have the same userid on every client)

Client setup

There isn't much to setup on the client side. You need to:

and then just mount the remote filesystem like this:
root@osiris:~# mount -t nfs -o nfsvers=4 yourserver:/ /mnt/nfs4/
or, using kerberos, like this:
root@osiris:~# mount -t nfs -o nfsvers=4,sec=krb5 yourserver:/ /mnt/nfs4/

When using entries in the fstab, you should fill in something like this:

/etc/fstab
nfsserver:/ /mountpoint nfs noauto,nfsvers=4,proto=tcp 0 0

Or for even better automounting and unmounting using systemd, something like this (it gets unmounted after 1 minute of inactivity):

/etc/fstab
nfsserver:/ /mountpoint nfs noauto,x-systemd.automount,x-systemd.device-timeout=10s,x-systemd.idle-timeout=1min,vers=4,nfsvers=4,noatime,rsize=32768,wsize=32768,proto=tcp,port=2049 0 0

If you want to use IPv6, you need to use "proto=tcp6"

Please note that the use of filesystem "nfs4" in fstab is deprecated and often does not work as expected. Use type "nfs" instead and add the option "nfsvers=4"

Server setup

On Arch Linux: - pacman -S nfs-utils - edit /etc/sysconfig/nfs - systemctl start nfs-server - systemctl enable nfs-server

This isn't much harder either, it's just a few things more:

Configuration of a NFSv4-only server

When running a NFSv4-only server, you no longer need rpcbind.service

/etc/conf.d/nfs-server.conf
NFSD_OPTS="-N 2 -N 3"

Configuration of rpc.idmapd

/etc/idmapd.conf
[General] Verbosity = 0 Domain = localdomain [Mapping] Nobody-User = nobody Nobody-Group = nogroup

/etc/fstab
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0 nfsd /proc/fs/nfsd nfsd defaults 0 0
mkdir /var/lib/nfs/rpc_pipefs
---- startup -----
/sbin/portmap
/usr/sbin/rpc.mountd
/usr/sbin/rpc.idmapd
/usr/sbin/rpc.nfsd
exportfs -r

Portmap

/etc/hosts.deny
portmap:ALL
/etc/hosts.allow
portmap:<ip-range>