Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Static NFS Ports?

Featured Replies

 

Hello,

I would like to use NFS over different networks. For this I have to open ports at my firewall. Unfortunately, NFSv3 uses dynamic ports as standard.

Where can I set NFSv3 to use static ports, so I can set the ports in my firewall?

  • 1 year later...

while waiting for nfs4 support, wrote this user.script for nfs3

for version 6.6.6

#!/bin/bash

DEFAULT_RPC="/etc/default/rpc"
STATD_PORT=32766
LOCKD_PORT=32768

RC_NFSD="/etc/rc.d/rc.nfsd"
MOUNTD_PORT=32767

nfs_config() (
	set -euo pipefail
	sed -i '
	s/^#RPC_STATD_PORT=.*/RPC_STATD_PORT='$STATD_PORT'/;
	s/^#LOCKD_TCP_PORT=.*/LOCKD_TCP_PORT='$LOCKD_PORT'/;
	s/^#LOCKD_UDP_PORT=.*/LOCKD_UDP_PORT='$LOCKD_PORT'/;
	' ${DEFAULT_RPC}
	sed -i '
	s/^\s\{4\}\/usr\/sbin\/rpc\.mountd$/    \/usr\/sbin\/rpc\.mountd -p '$MOUNTD_PORT'/;
	' ${RC_NFSD}
	/etc/rc.d/rc.rpc restart
	sleep 1
	/etc/rc.d/rc.nfsd restart
)

nfs_config
if [[ $? -ne 0 ]]; then
	/usr/local/emhttp/webGui/scripts/notify -i warning -s "NFS config failed"
fi

 then check

rpcinfo -p

   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  32766  status
    100024    1   tcp  32766  status
    100003    3   tcp   2049  nfs
    100003    3   udp   2049  nfs
    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
    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

 

  • 2 years later...

Configuration stored in /etc/rc.d/rc.nfsd changed with Unraid 6.10.0-rc1. nfs_config() should be updated to:

 

nfs_config() (
	set -euo pipefail
	sed -i '
	s/^#RPC_STATD_PORT=.*/RPC_STATD_PORT='$STATD_PORT'/;
	s/^#LOCKD_TCP_PORT=.*/LOCKD_TCP_PORT='$LOCKD_PORT'/;
	s/^#LOCKD_UDP_PORT=.*/LOCKD_UDP_PORT='$LOCKD_PORT'/;
	' ${DEFAULT_RPC}
	sed -i '
	s/^\s\{4\}\/usr\/sbin\/rpc\.mountd$/    \/usr\/sbin\/rpc\.mountd -p '$MOUNTD_PORT'/;
	/if \[ \-x \/usr\/sbin\/rpc.mountd \]/ i RPC_MOUNTD_PORT='$MOUNTD_PORT';
	' ${RC_NFSD}
	/etc/rc.d/rc.rpc restart
	sleep 1
	/etc/rc.d/rc.nfsd restart
)

 

The above should cover both 6.10.0-rc1 while still keeping compatibility with prior versions.

  • 2 years later...

thanks heaps for this.. i've followed the guide here: https://unraid.net/de/blog/deploying-an-unraid-nfs-server, updated the script with the changes above and forwarded the ports required between my vlans in opnsense but i can see the client trying to access NFS on the unraid server via other ports outside the specified range (38983, 34691 etc)

 

any tips or advice?

On 1/21/2024 at 11:58 AM, ideasman said:

thanks heaps for this.. i've followed the guide here: https://unraid.net/de/blog/deploying-an-unraid-nfs-server, updated the script with the changes above and forwarded the ports required between my vlans in opnsense but i can see the client trying to access NFS on the unraid server via other ports outside the specified range (38983, 34691 etc)

 

any tips or advice?

 

check the ports announced by portmapper on unraid with rpcinfo

 

the ports are shown as 2 octets. the portnumber is  256*octet1+octet2

 

The script is outdated though. I will post an updated version.

This script has been successfully used with unraid 6.12.4, change the port numbers as you see fit.
 

DEFAULT_RPC="/etc/default/rpc"
STATD_PORT=950
LOCKD_PORT=4045
MOUNTD_PORT=635

nfs_config() (
    set -euo pipefail
    sed -i '
    s/^#RPC_MOUNTD_PORT=.*/RPC_MOUNTD_PORT='$MOUNTD_PORT'/;
    s/^#RPC_STATD_PORT=.*/RPC_STATD_PORT='$STATD_PORT'/;
    s/^#LOCKD_TCP_PORT=.*/LOCKD_TCP_PORT='$LOCKD_PORT'/;
    s/^#LOCKD_UDP_PORT=.*/LOCKD_UDP_PORT='$LOCKD_PORT'/;
    ' ${DEFAULT_RPC}
    /etc/rc.d/rc.rpc restart
    sleep 1
    /etc/rc.d/rc.nfsd restart
)

nfs_config
if [[ $? -ne 0 ]]; then
    /usr/local/emhttp/webGui/scripts/notify -i warning -s "NFS config failed"
fi

 

  • 1 year later...
On 2/10/2019 at 1:24 PM, Arch said:

while waiting for nfs4 support, wrote this user.script for nfs3 


does this not apply to NFS v4, does it has a different configuration for static ports?
(running on unraid 7.1.2)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.