We have learned some about the FNS service in Linux. We have already introduced its general settings in the previous article and will not go into details here. Today, we will mainly explain the Linux NFS service fixed port and firewall configuration.
# Linux NFS service fixed port and firewall configuration #
1. Install NFS on LINUX
2. Modify/etc/service and add the following content. The port number must be less than 1024 and is not in use)
- # Local services
- mountd 1011/tcp #rpc.mountd
- mountd 1011/udp #rpc.mountd
- rquotad 1012/tcp #rpc.rquotad
- rquotad 1012/udp #rpc.rquotad
3. Restart the Linux NFS service
- service nfs restart
- chkconfig nfs on
4. Now the rpc-related port has been fixed. You can add firewall rules for Linux NFS.
- #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