NFS 用到的服務(wù)有 portmapper nfs rquotad nlockmgr mountd
通過命令 rpcinfo -p 可查看nfs使用的端口
# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 53713 status
100024 1 tcp 47753 status
100011 1 udp 875 rquotad
100011 2 udp 875 rquotad
100011 1 tcp 875 rquotad
100011 2 tcp 875 rquotad
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 40399 nlockmgr
100021 3 udp 40399 nlockmgr
100021 4 udp 40399 nlockmgr
100021 1 tcp 46247 nlockmgr
100021 3 tcp 46247 nlockmgr
100021 4 tcp 46247 nlockmgr
100005 1 udp 60639 mountd
100005 1 tcp 39962 mountd
100005 2 udp 51575 mountd
100005 2 tcp 42414 mountd
100005 3 udp 38358 mountd
100005 3 tcp 48741 mountd
其中 portmapper nfs 服務(wù)端口是固定的分別是 111 2049
另外 rquotad nlockmgr mountd 服務(wù)端口是隨機(jī)的。由于端口是隨機(jī)的,這導(dǎo)致防火墻無(wú)法設(shè)置。
這時(shí)需要配置/etc/sysconfig/nfs 使 rquotad nlockmgr mountd 的端口固定。
找到以下幾項(xiàng),將前面的#號(hào)去掉。
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
#service nfs restart
#rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 53713 status
100024 1 tcp 47753 status
100011 1 udp 875 rquotad
100011 2 udp 875 rquotad
100011 1 tcp 875 rquotad
100011 2 tcp 875 rquotad
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 32769 nlockmgr
100021 3 udp 32769 nlockmgr
100021 4 udp 32769 nlockmgr
100021 1 tcp 32803 nlockmgr
100021 3 tcp 32803 nlockmgr
100021 4 tcp 32803 nlockmgr
100005 1 udp 892 mountd
100005 1 tcp 892 mountd
100005 2 udp 892 mountd
100005 2 tcp 892 mountd
100005 3 udp 892 mountd
100005 3 tcp 892 mountd
設(shè)置防火墻
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 111 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 875 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 2049 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 32769 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 32803 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 892 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 111 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 875 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 2049 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 32769 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 32803 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -p udp --dport 892 -j ACCEPT
查看IPTABLES
# iptables -L
保存IPTABLES
# iptables-save > /etc/sysconfig/iptables
posted on 2012-03-14 16:14
Derek.Guo 閱讀(1714)
評(píng)論(0) 編輯 收藏