Peter Humphrey wrote on 19.11.2023 16:12:
Yes, indeed. In fact I don't know why this has only just bitten me; I've been
doing the same thing for years without problem.
That search turns up so many answers that I don't know where to start, even
prefixing the phrase with "gentoo". Most of them seem to date from 10 years ago
or more.
You need to configure two files. Add a *.conf file below /etc/sysctl.d with
the following content:
# Set fixed ports for lockd.
fs.nfs.nlm_tcpport = 4014
fs.nfs.nlm_udpport = 4014
Then set some options in /etc/conf.d/nfs. Here's my config, the -p options configure the ports
of various NFS services.
# /etc/conf.d/nfs
# If you wish to set the port numbers for lockd,
# please see /etc/sysctl.conf
# Optional services to include in default `/etc/init.d/nfs start`
# For NFSv4 users, you'll want to add "rpc.idmapd" here.
NFS_NEEDED_SERVICES="rpc.idmapd"
# Options to pass to rpc.nfsd
OPTS_RPC_NFSD="8 -s -V 3 -N 4"
# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD="-p 4010 --manage-gids"
# Options to pass to rpc.statd
# ex. OPTS_RPC_STATD="-p 32765 -o 32766"
OPTS_RPC_STATD="-p 4011 -o 4012"
# Options to pass to rpc.idmapd
OPTS_RPC_IDMAPD=""
# Options to pass to rpc.gssd
OPTS_RPC_GSSD=""
# Options to pass to rpc.svcgssd
OPTS_RPC_SVCGSSD=""
# Options to pass to rpc.rquotad (requires sys-fs/quota)
OPTS_RPC_RQUOTAD="-p 4013"
# Timeout (in seconds) for exportfs
EXPORTFS_TIMEOUT=30
# Options to set in the nfsd filesystem (/proc/fs/nfsd/).
# Format is <option>=<value>. Multiple options are allowed.
#OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096"
Then you need to allow ports 111 (TCP + UDP), 2049 (TCP) and 4010:4014 (TCP + UDP) through your
firewall. I'm not entirely sure about TCP vs. UDP, you might be able to remove some of them (it
has been a while that I configured this). You can pick different port number than 4010:4014 if
you like.
-- Remy