Iptables settings required by the nfs service

Source: Internet
Author: User
When the NFS service is started, portmapp assigns a dynamic port to each NFS service, such as MOUNTD_PORT, STATD_PORT, LOCKD_TCPPORT, and LOCKD_UDPPORT. How can NFSclient use the NFS service properly when using iptables? The method is to specify the running port of the above service, and then assign a dynamic port to each NFS service when iptabl portmapp starts the NFS service, such as MOUNTD_PORT, STATD_PORT, LOCKD_TCPPORT, and LOCKD_UDPPORT.
How can I enable NFS client to be used? IptablesCan the NFS service be used normally? The method is to specify the port for the above service, and then IptablesPublish. The related configuration file is/etc/sysconfig/nfs.
To use iptables to control NFS, you must statically specify the port number for portmap to call. When the NFS service is enabled, the/etc/sysconfig/nfs file is checked. In this file, specify the Mount TD, statd, lockd, and rquotad port numbers.
RQUOTAD_PORT = 10001
LOCKD_TCPPORT = 10002
LOCKD_UDPPORT = 10002
MOUNTD_PORT = 10003
STATD_PORT = 10004
/Etc/sysconfig/nfs may not exist when it is installed by default, except for versions above 5.1. You can manually create this file to write the above content.
Restart the service after setting
Service nfslock restart
Service nfs restart
Use commands to view ports
# Rpcinfo-p
Program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 10004 status
100024 1 tcp 10004 status
100011 1 udp 10001 rquotad
100011 2 udp 10001 rquotad
100011 1 tcp 10001 rquotad
100011 2 tcp 10001 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 10002 nlockmgr
100021 3 udp 10002 nlockmgr
100021 4 udp 10002 nlockmgr
100021 1 tcp 10002 nlockmgr
100021 3 tcp 10002 nlockmgr
100021 4 tcp 10002 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100005 1 udp 10003 mountd
100005 1 tcp 10003 mountd
100005 2 udp 10003 mountd
100005 2 tcp 10003 mountd
100005 3 udp 10003 mountd
100005 3 tcp 10003 mountd
The next step is to configure iptables rules.
Iptables-a input-p tcp -- dport 111-j ACCEPT
Iptables-a input-p udp -- dport 111-j ACCEPT
Iptables-a input-p tcp -- dport 2049-j ACCEPT
Iptables-a input-p udp -- dport 2049-j ACCEPT
Iptables-a input-p tcp -- dport 1000:10004-j ACCEPT
Iptables-a input-p udp -- dport 1000:10004-j ACCEPT

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.