Re: FreeBSD NFS4 on custom TCP port (not 2049)?

From: Lionel Cons <lionelcons1972_at_gmail.com>
Date: Sat, 23 Aug 2025 18:40:00 UTC
On Sat, 23 Aug 2025 at 17:01, Rick Macklem <rick.macklem@gmail.com> wrote:
>
> On Sat, Aug 23, 2025 at 7:38 AM Rick Macklem <rick.macklem@gmail.com> wrote:
> >
> > On Fri, Aug 22, 2025 at 11:09 PM Lionel Cons <lionelcons1972@gmail.com> wrote:
> > >
> > > Do the FreeBSD NFS4 server and client support operating at a custom
> > > TCP port (not TCP 2049)?
> > > How can I set the TCP port number for the server, and how do I mount it?
> > It does not do that now. You would have to patch the sources.
> Actually, I was incorrect. If you change the lines that start with "nfsd" in
> /etc/services, it will use whatever port# you specify there.
>
> I do wonder why you would want to change it?
> There can only be one instance of "nfsd" in each vnet jail (which means only
> one running on the server if you are not using vnet jails), so why would you
> want it at a different port#?

Because we have a public IPv4 address shortage in case IPv6 cannot be used.
Running multiple NFSv4 servers sharing one internet-facing IPv4
address with different ports has become quite common... which was one
of the reasons why NFSv4 has everything (NFS server, lock and mount
protocols etc) within one TCP port.

Lionel