I just noticed this recently. Unlike in CentOS, Debian mountd ports are dynamic and they will keep changing every reboot. Therefore, if the host firewall is enabled, the allowed ports may require constant modification due to mountd ports are not hardcoded.
To install NFS on Debian
apt install -y nfs-kernel-server nfs-common
You can find the mountd ports via the following command. Execute this to the NFS server.
rpcinfo -p | grep mountd
To get make the mountd port(s) permanent, we need to edit the
/etc/defaults/nfs-kernel-server. We need to add the following lines.
# Original RPCMOUNTDOPTS="--manage-gids" # Modified #RPCMOUNTDOPTS="--manage-gids" RPCMOUNTDOPTS="--port 32767"
After updating the
nfs-kernel-server file, the
nfs-kernel-server.service need to be restarted.
systemctl restart nfs-kernel-server.service
Verify the mountd ports that matches the statically set using the command
rpcinfo -p | grep mountd. On the client side, run the command
showmount -e <ip-addr>
If you have a firewall installed, you need to allow the ports. This is it.