
我們設定了允許 TCP/UDP 連接埠 111 2049 32769 32803 892 的 iptables
..我在 /etc/sysconfig/nfs 中進行了以下更改
RPCMOUNTDOPTS="-p 892"
和
/etc/sysctl.conf
fs.nfs.nlm_tcpport=32803
fs.nfs.nlm_udpport=32769
依照 Redhat 文件中的規定,在 Redhat/Centos 7 中的防火牆後面執行 nfs
nfs 仍然沒有綁定到這個提供的端口,並採用任何隨機端口,由於 iptables 的原因限制任何客戶端連接到 nfs ..我們無法停止 iptables ..
嘗試使用 rpc.mountd -p 892 這個指令但似乎不起作用..
o/p-rpcinfo -p
程式與原型連接埠服務
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 46390 status
100024 1 tcp 38521 status
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 40472 nlockmgr
100021 3 udp 40472 nlockmgr
100021 4 udp 40472 nlockmgr
100021 1 tcp 35454 nlockmgr
100021 3 tcp 35454 nlockmgr
100021 4 tcp 35454 nlockmgr
任何有關這個世界的幫助將不勝感激。
答案1
好吧,/usr/lib/systemd/system/nfs-mountd.service 使用 $RPCMOUNTDARGS 選項呼叫 rpc.mountd,該選項與 /etc/sysconfig/nfs 中的 RPCMOUNTDOPTS 不同。
還有另一個名為 nfs-config.service 的服務,它預處理 NFS 配置並將其輸出放入 /run/sysconfig/nfs-utils 中,並且 RPCMOUNTDOPTS 會轉換為 RPCMOUNTDARGS。
儘管 nfs.service 在使用停止/啟動或重新啟動時不會呼叫 nfs-config,因此 /etc/sysconfig/nfs 中的設定不會更新 /run/sysconfig/nfs-utils。
解決方案很簡單,在重新啟動 nfs.service 之前執行「systemctl restart nfs-config」。