Pre-configured NFS ports are always passed Rpcinfo x.x.x.x This command to find the port that needs to be released, and then release the port in the firewall, but because the server is in a rack, the property that often power off, so every time after the power outage restart, I need to re-set the firewall, inadvertently listen to colleagues said can set the fixed port, so tried a, oh, My God, Mom doesn't have to worry about restarting the server after all. Here is the record, remembering that all operations are performed on the NFS server side.
1) Determine the port, must be 1024 under the port and is not occupied, you can use the netstat command to see if the lower port is occupied, I use the two ports 1012 and 1013, are not occupied
[Email protected] ~]# NETSTAT-ANPTU | grep 1012[[email protected] ~]# NETSTAT-ANPTU | grep 1013
2) Modify the/etc/services file
Mountd 1012/tcp # rpc.mountdmountd 1012/UDP # Rpc.mountdrquotad 10 13/TCP # Rpc.rquotadrquotad 1013/UDP # Rpc.rquotad
3) Restart NFS Service
[[email protected] ~]# service nfsd restartnfsd: unrecognized service [[email protected] ~]# service nfs restart Close NFS Daemon: [OK] close nfs mountd: [OK] close NFS quotas: [OK] Close NFS service: [Determine]shutting down rpc idmapd: [OK] Start NFS service: [OK] turn off NFS quotas: [OK] Start NFS mountd: [OK] start NFS daemon: [OK] is starting  RPC idmapd: [OK]
4) Modify the firewall
portmap:111 nfsd:2049 mountd:1012 rpc.statd:32768
[Email protected] ~]# vim/etc/sysconfig/iptables-a input-s 176.20.0.0/24-p tcp-m multiport--dports 111,2049,1012,101 3,32768-j accept-a input-s 176.20.0.0/24-p udp-m multiport--dports 111,2019,1012,1013,32768-j ACCEPT
5) Restart the firewall
[[Email protected] ~]# service iptables restart Iptables: Set the chain as policy accept:filter [OK]iptables: Clear firewall rule: [OK]iptables: Uninstalling module: [OK]iptables: Apply firewall rule: Determine
This article is from the "Court of the Odd Tree" blog, please be sure to keep this source http://zhangdl.blog.51cto.com/11050780/1864740
Configuring NFS Fixed Ports in CentOS