#Linux NFS Service Fixed port and firewall configuration #
1. Install the NFS service normally on Linux
2. Modify the/etc/service to add the following (the port number must be below 1024 and is not occupied)
# Local Services
Mountd 1011/tcp #rpc. Mountd
Mountd 1011/udp #rpc. Mountd
Rquotad 1012/tcp #rpc. Rquotad
Rquotad 1012/udp #rpc. Rquotad
3. Restart NFS Service
Service NFS Restart
Chkconfig NFS On
4. Now that the RPC-related port is fixed, you can add a firewall rule
#portmap
/sbin/iptables-a input-s 192.168.1.0/24-p TCP--dport 111-j ACCEPT
/sbin/iptables-a input-s 192.168.1.0/24-p UDP--dport 111-j ACCEPT
#nfsd
/sbin/iptables-a input-s 192.168.1.0/24-p TCP--dport 2049-j ACCEPT
/sbin/iptables-a input-s 192.168.1.0/24-p UDP--dport 2049-j ACCEPT
#mountd
/sbin/iptables-a input-s 192.168.1.0/24-p TCP--dport 1011-j ACCEPT
/sbin/iptables-a input-s 192.168.1.0/24-p UDP--dport 1011-j ACCEPT
#rquotad
/sbin/iptables-a input-s 192.168.1.0/24-p TCP--dport 1012-j ACCEPT
/sbin/iptables-a input-s 192.168.1.0/24-p UDP--dport 1012-j ACCEPT
#rpc. statd
/sbin/iptables-a input-s 192.168.1.0/24-p TCP--dport 32768-j ACCEPT
/sbin/iptables-a input-s 192.168.1.0/24-p UDP--dport 32768-j ACCEPT
[Email protected] iosupload]# Cat/etc/exports
/wqdata 22.10.9.3 (rw,sync,no_root_squash,anonuid=0,anongid=0)
[Email protected] nfs84]# mount-t NFS 22.10.9.4:/wqdata//mnt/nfs84/
NFS Service Configuration Fixed port