[RndTbl] wacky NFS port problem
trevor at tecnopolis.ca
Mon Oct 24 03:57:32 CDT 2016
On 2016-10-24 Trevor Cordes wrote:
> It would be really nice if I could specify the local source port, or
> at least specify the list of no-no ports using this elusive,
> promised, "sysctl". Anyone have any ideas?
Sigh... as often the case, after writing my email I found the answer,
this was a tough one! Had to use the source patch logs to get some
hints. I didn't want to grep the files in sys and proc for nfs, but
#find /proc/ /sys/ | grep sunrpc |grep port
#tail -c+1 /proc/sys/sunrpc/m??_resvport
==> /proc/sys/sunrpc/max_resvport <==
==> /proc/sys/sunrpc/min_resvport <==
Also 2 files in:
Might need to tweak.
Tada! I'll just tweak those to a tiny range I know for sure I won't use
at all, and still be under 1024.
Note, each mount takes another of those ports, so if you mount a large
number of remote fs's then you need a big enough range. I only mount 1
NFS mount, so I'm good with a tiny (1?) range.
A bit presumptuous of them to assume anything over 665 is "safe"!!
Moral of the story, if you use NFSv4 and you run critical services over
port 664, you better set these sysctl's to avoid this problem.
Aside: I may also be forgetting my raw socket programming, but I didn't
think using a source port to connect to something external (i.e. as an
initiator) tied up that port completely keeping others from
bind/listen()ing on it? I thought as long as you were the only
bind/listen()er it didn't matter what ports other progs took? I could
be massively wrong on this...
More information about the Roundtable