如何才能讓nfs client在使用 iptables時可以正常使用nfs服務呢?辦法就是指定將上述服務的執行埠,然後在iptables中發布。相關的配置檔案為 /etc/sysconfig/nfs 。
要使用iptables來控制nfs,需靜態指定埠號讓portmap呼叫。nfs服務啟用時會檢查/etc/sysconfig/nfs檔案。在此檔案下來指定mountd,statd,lockd,rquotad埠號。
rquotad_port=10001
lockd_tcpport=10002
lockd_u***ort=10002
mountd_port=10003
statd_port=10004
/etc/sysconfig/nfs預設安裝的時候可能會不存在,5.1以上版本除外。可以手工建立此檔案編寫以上內容。
設定後需重啟服務
service nfslock restart
service nfs restart
使用命令檢視埠
#rpcinfo -p
program vers proto port
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
接下來就是配置iptables規則了
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 10001:10004 -j accept
iptables -a input -p udp --dport 10001:10004 -j accept
mount -t nfs -o nolock 172.16.10.254:/opt /mnt
新時代下,人們所需要的服務
馬慶雲老師寫了一篇文章 如何炒作一部電影?從王思聰大罵 一步之遙 說起 不談這件事兒,只談我自己。現在這件事情對我來說,感覺很自然。老百姓想電影,想獲得生活上的更多更好的體驗。但是,體驗本身並不只是由於某一項產品或者某一項服務的水準所決定的。正如很多有錢的大叔拿著房產證去相親,是的,你確實在經濟上很...
vmware所需要的埠
埠 描述 80vcenter server 需要埠 80 用於直接 http 連線。埠 80 會將請求重定向到 https 埠 443。如果意外使用了 http server 而不是 https server,此重定向將非常有用。如果使用與 vcenter server 儲存在同一主機上的自定義mi...
爬蟲所需要的HTML基礎
下方是乙個基本的網頁 框架 文件標題title head 文件內容.body html 乙個網頁的基本示例 headings and paragraphstitle head this is my first paragraphp heading 4h4 heading 5h5 heading 6h...