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

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Sat, 23 Aug 2025 20:32:45 UTC
On Sat, Aug 23, 2025 at 11:40 AM Lionel Cons <lionelcons1972@gmail.com> wrote:
>
> 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.
Ok, that makes sense. I thought of a NAT gateway, but it would map the
port#s to 2049 for the servers behind it, but if you are doing this without NAT,
I can see it.

rick

>
> Lionel
>