Re: [問題] 請問iptables規則

看板Linux作者 (雪循)時間14年前 (2012/02/17 12:04), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串5/5 (看更多)
※ 引述《gilberthsu (雪循)》之銘言: : 標題: [問題] 請問iptables規則 : 時間: Thu Feb 16 12:53:38 2012 : : : : server 上有三張網卡 : : eth0(192.168.1.101) 對外 : : eth1(192.168.2.1) net : 192.168.2.0/30 服務:用NFS連接NAS(192.168.2.2) : : eth2(192.168.3.1) net : 192.168.3.0/24 服務:NAT/DHCP(發 192.168.3.128/25) : : 現在想要讓 : : 1.NAT 內的 client 可以自由上網 : 2.NAT 內的 client 可以掛載 NAS : 3.NAT 內的 client 可以藉由 tftp 到 server 上還原系統 : : 謝謝大家 : : -- : ※ 發信站: 批踢踢實業坊(ptt.cc) : ◆ From: 140.120.203.103 : → hukhuk:先說說你要怎麼做 02/16 16:18 一開始想用 #iptables -t nat -A POSTROUTING -s 192.168.3.128/25 -j SNAT --to 192.168.1.101 讓client 可以自由上網,不過會造成 tftp 連不上 server 拿掉規則以後,tftp 就可以 RUN 了 NFS 的問題則是在於 client 找不到 NAS(192.168.2.2) : → oldjou:這似乎把路由加進去就好了,用不著 iptables 吧? 02/16 16:56 : → hukhuk:先貼你的路由表上來吧 02/16 19:15 Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 0.0.0.0 255.255.255.252 U 0 0 0 eth1 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.140.35.62

02/17 18:11, , 1F
你第一條rule加上 -i eth2 -o eth0 試試看
02/17 18:11, 1F

02/17 18:11, , 2F
iptables的rule
02/17 18:11, 2F

02/21 15:47, , 3F
nat table 的 rule 不能加 -i eth2 耶@@
02/21 15:47, 3F

02/21 15:47, , 4F
server 的系統是 centOS5.7
02/21 15:47, 4F
※ 編輯: gilberthsu 來自: 140.120.203.103 (02/21 15:48)
文章代碼(AID): #1FFT6q6I (Linux)
文章代碼(AID): #1FFT6q6I (Linux)