An NFS exchange server works normaly out of the box. But if you need to have a firewallscript like iptables on your system NFS connection will fail.
Why is the big question … NFS works with rpc (Remote Procedure Call). This means that ports will allocated randomly. One way is to tell your firewall that their are rpc and that the specific port will be opened and closed.
An easier option is to modify the nfs-kernel-server itself.
First modify /etc/default/nfs-common:
go to line STATDOPTS and add:
Further you need to modify /etc/default/nfs-kernel-server:
go to RPCMOUNTDOPTS and ad:
And now you need to export your nfs folder. I have a separate partition for /export for NFS.
Now please restart the nfs-kernel-server
To finalize your NFS server, go to your firewall and open ports TCP/UDP 2039,4000,4002 and restart your firewall filter.
To mount your firewall protected NFS Server just add “proto” to your mount command and give alues for the uses protocoll and portnumber:
mount -t nfs4 -o proto=tcp,port=2049 192.168.178.253:/export/home /mnt