Cannot Specify Fixed Ports for mountd and statd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nfs-utils (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
=== Release Version ===
Ubuntu 22.04
=== Package Version ===
nfs-utils 1:2.6.1-1ubuntu1
=== Custom Settings ===
In order to use NFSv3 client (e.g. on Windows 10) to mount the directories exported by the NFS server behind a firewall, I need to specify fixed ports to be used by /usr/sbin/
In /etc/default/
RPCMOUNTDOPTS=
RPCNFSDOPTS=
In /etc/default/
STATDOPTS="--port 32766 --outgoing-port 32765"
Then I restarted NFS server:
systemctl restart nfs-kernel-server
=== Expected Results ===
The output of "rpcinfo -p" should show something similar to the following messages:
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 32767 mountd
100005 1 tcp 32767 mountd
100005 2 udp 32767 mountd
100005 2 tcp 32767 mountd
100005 3 udp 32767 mountd
100005 3 tcp 32767 mountd
100024 1 udp 32766 status
100024 1 tcp 32766 status
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049
100003 3 udp 2049 nfs
100227 3 udp 2049
100021 1 udp 32768 nlockmgr
100021 3 udp 32768 nlockmgr
100021 4 udp 32768 nlockmgr
100021 1 tcp 32768 nlockmgr
100021 3 tcp 32768 nlockmgr
100021 4 tcp 32768 nlockmgr
150001 1 udp 835 pcnfsd
150001 2 udp 835 pcnfsd
150001 1 tcp 836 pcnfsd
150001 2 tcp 836 pcnfsd
Above messages are the output of the NFS server on Ubuntu 20.04 which shows the desired ports are used to mountd and statd daemons.
Actual results:
However, the actual output of "rpcinfo -p" on Ubuntu 22.04 shows the following:
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 33937 status
100024 1 tcp 60673 status
100005 1 udp 43042 mountd
100005 1 tcp 60125 mountd
100005 2 udp 48157 mountd
100005 2 tcp 39195 mountd
100005 3 udp 50182 mountd
100005 3 tcp 57251 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049
100021 1 udp 32768 nlockmgr
100021 3 udp 32768 nlockmgr
100021 4 udp 32768 nlockmgr
100021 1 tcp 32768 nlockmgr
100021 3 tcp 32768 nlockmgr
100021 4 tcp 32768 nlockmgr
Obvisouly, the ports used by mountd and statd are different from the specified values. Moreover, after each restart, the ports numbers also change. This means that random ports are assigned.
=== Possible Causes ===
I checked out the systemd configuration files in use and found the following clues:
/lib/systemd/
In 20.04: ExecStart=
In 22.04: ExecStart=
/lib/systemd/
In 20.04: ExecStart=
In 22.04: ExecStart=
/lib/systemd/
In 20.04: ExecStart=
In 22.04: ExecStart=
So, I think above differences could possibly explain why fixed ports can be specified for the NFS server in 20.04 but not in 22.04.
Hi,
the /etc/default/nfs-* files are ignored by the NFS server or client in Ubuntu 22.04. They were left there as a precaution because of the conversion process that converts those options into the new /etc/nfs.conf and /etc/nfs. conf.d/ local.conf files. I do agree it causes confusion, and the /etc/default/nfs-* files should either be removed, or have some text explaining that they are there just for old sysvinit compatibility. This may change in a future update.
You should look into /etc/nfs.conf to set these options. There is also a nfs.conf manpage you can review, and the ubuntu server guide was updated regarding this change:
https:/ /ubuntu. com/server/ docs/service- nfs