In order to write iptables rules, this port must be fixed to better use, so in/usr/lib/systemd/scripts/nfs-utils_env.sh found a very interesting thing
So I directly wrote the sysctl file.
Echo-e '### nfs add \ nfs. nfs. nlm_tcpport = 32803 \ nfs. nfs. nlm_udpport = 32769'>/etc/sysctl. conf
Sysctl-p
Then I tried again and found that the port was fixed. I went there, and it was quite fun.
Then you can directly create iptables rules later.
Iptables-N NFS
Iptables-r input 8-p udp-m state -- state NEW-m multiport -- dports $ (rpcinfo-p | awk 'NR> 1 & $3 ~ /Udp /&&! A [$4] ++ {c = c? C "," $4: $4} END {print c} ')-j NFS
Iptables-r input 7-p tcp-m state -- state NEW-m multiport -- dports $ (rpcinfo-p | awk 'NR> 1 & amp; $3 ~ /Tcp /&&! A [$4] ++ {c = c? C "," $4: $4} END {print c} ')-j NFS
Iptables-I NFS-s 10.0.0.0/8-p tcp-j ACCEPT
Iptables-a nfs-s 10.0.0.0/8-p udp-j ACCEPT