[問題] NFS 的防火牆設定

看板Linux作者 (閒閒的研究生)時間15年前 (2009/07/28 17:35), 編輯推噓4(402)
留言6則, 3人參與, 最新討論串1/3 (看更多)
我想在 Fedora 7 上想建立一個 NFS server 已經開啟 rpcbind nfs,但是在防火牆的設定方面有點問題: 在 client 端打 showmount -e (IP),如果我關閉防火牆,client端可以正常顯示, 如果防火牆開啟後,會出現 mount clntudp_create: RPC: Port mapper failure - RPC: Unable to receive 如果我打開 111:tcp 111:udp 2049:tcp 2049:udp 後,會出現 rpc mount export: RPC: Unable to receive; errno = No route to host 我搜尋了一些文章,有人提到 nfs 開啟的 port 是隨機的, 所以要到 /etc/sysconfig/nfs, 指定 nfs 使用的 TCP/UDP Port 但是rpcbind(或稱portmap)的功能不就是固定 port 為 111 嗎? 我不知道是什麼地方出錯了,請各位前輩指導一下,謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.214.118

07/28 21:18, , 1F
你貼上你的iptables script 給我們看比較好
07/28 21:18, 1F
Chain INPUT (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain RH-Firewall-1-INPUT (1 references) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT esp -- anywhere anywhere ACCEPT ah -- anywhere anywhere ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns ACCEPT udp -- anywhere anywhere udp dpt:ipp ACCEPT tcp -- anywhere anywhere tcp dpt:ipp ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:4067 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:sunrpc ACCEPT udp -- anywhere anywhere state NEW udp dpt:sunrpc ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nfs ACCEPT udp -- anywhere anywhere state NEW udp dpt:nfs ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp REJECT all -- anywhere anywhere reject-with icmp-host-prohibited 謝謝 ※ 編輯: g03 來自: 140.123.214.118 (07/28 21:36)

07/28 22:35, , 2F
看起來,FORWARD 不該設REJECT 才是..
07/28 22:35, 2F

07/28 23:17, , 3F
我把那行刪掉之後還是一樣耶@@
07/28 23:17, 3F
我大概了解問題了,開啟portmap後,NFS只是向portmap註冊其開啟的port, 讓client端可以連到這個port,所以跟防火牆是無關的,防火牆沒開一樣連不到。 兩個解決方是,一個就是限制NFS開啟的port,然後在防火牆設定把這個port打開, 另一個就是在防火牆的設定中把信任的client端的IP設為ACCEPT。 還有一個比較麻煩的是讓防火牆自動開啟NFS打開的port,我還不會設定。 ※ 編輯: g03 來自: 140.123.214.118 (07/29 01:42)

07/30 11:30, , 4F
NFS防火牆會檔到 假如你要用防火牆的話 必須固定NFS的PORT
07/30 11:30, 4F

07/30 11:40, , 5F
設定檔在 /etc/sysconfig/nfs
07/30 11:40, 5F

07/30 11:40, , 6F
希望有幫助到你
07/30 11:40, 6F
文章代碼(AID): #1ARiPLcR (Linux)
文章代碼(AID): #1ARiPLcR (Linux)