我正在尝试在 Ubuntu 20.x 服务器上使用 NFSv3,并且需要设置静态端口以使用 UFW。不幸的是,需要连接到此服务器的 Windows 10 仅支持 NFSv3,因此仅打开端口 2049 是不够的。
我试图将端口添加到 /etc/default/nfs-kernel-server:
# Number of servers to start up
RPCNFSDCOUNT=64
# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids"
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""
# Options for rpc.svcgssd.
RPCSVCGSSDOPTS=""
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
RQUOTAD_PORT=875
虽然配置确实需要 64 台服务器来启动,但它没有选择底部的端口配置,即使在重新启动后也是如此。
有谁知道我在哪里可以正确设置这些?
我想通了,对于静态端口,需要编辑这些文件:
MOUNTD 的 /etc/default/nfs-kernel-server:
原来的:
RPCMOUNTDOPTS="--manage-gids"
新的:
RPCMOUNTDOPTS="--manage-gids -p 892"
STATD 的 /etc/default/nfs-common:
原来的:
STATDOPTS=
新的:
STATDOPTS="--port 662"
/etc/default/quotas for Quotas我决定不为这个项目运行配额。但是,它应该是:
RPCRQUOTADOPTS="-p 875"
/etc/sysctl.conf 用于锁定:
添加:
fs.nfs.nlm_tcpport = 32803
fs.nfs.nlm_udpport = 32769
然后运行:
sysctl -p
systemctl restart nfs-kernel-server
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句