Linux – Specifying which UDP port NFS should use

centoslinuxnfsUbuntu

I want to force NFS to use a specific port I've opened on my firewall. It seems to randomly pick the UDP port, the TCP port is static. How do I lock in the UDP port so i'm not opening a range of ports?

mount /mnt/backup
mount: trying 127.21.164.236 prog 100003 vers 3 prot tcp port 2049
mount: trying 127.21.164.236 prog 100005 vers 3 prot udp port 57917

I see a lot of info on setting up NFS but cant seem to narrow in on how to force a specific port.

Best Answer

I found out where it was after some more digging. On ubuntu as the server (which is what I was using) it's in /etc/default/nfs-kernel-server and you have to set the RPCMOUNTDOPTS to include the port.

Ultimately I found it here http://wiki.debian.org/SecuringNFS