用Packet Filter(PF) 做 IP mapping 遇 … - BBS
By Carolina Franco
at 2010-05-12T06:29
at 2010-05-12T06:29
Table of Contents
※ 引述《yzupcbug (請加入HOT_Game板)》之銘言:
: ※ 引述《starlition (unknown)》之銘言:
: : 加一行 nat on $int_if from 192.168.198.3 port 220 to any -> $static_if
: : 我印象中
: : NAT的封包不需另外pass就會通過
: : (也就是說pass對nat無意義? <- 不大確定)
: 嗯, 結果是一樣不通, 此行於 pfctl -vsn 中完全沒有處理到封包
: nat on em1 inet from 192.168.198.3 port = imap3 to any -> 固IP
: [ Evaluations: 40121 Packets: 0 Bytes: 0 States: 0
: ]
: [ Inserted: uid 0 pid 16269 ]
剛剛測試了一下,你大概須要的東西:
dyn0if="tun1"
dyn0gw="tun1:peer"
int_if="nfe0"
internal_net="192.168.1.1/24"
ext_if_fttb="tun0"
gw_if_fttb="tun0:peer"
# 讓 192.168.1.200 這個 IP 能夠直接被外部 ip 連線
binat on $dyn0if from 192.168.1.200 to any -> ($dyn0if:0)
nat on $int_if from $internal_net to ($dyn0if:0) -> 192.168.1.200
# 讓不同 interface 進來的東西記得回家的路
pass in quick on $ext_if_fttb reply-to ($ext_if_fttb $gw_if_fttb) from any to
($ext_if_fttb) keep state
pass in quick on $dyn0if reply-to ($dyn0if $dyn0gw) from any to 192.168.1.200
keep state
# 強制讓 192.168.1.200 走特定 ip 出去
pass in quick on $int_if route-to ($dyn0if $dyn0gw) from 192.168.1.200 to any
大概就是這樣吧。
不過那個 ppp daemon 設 1.1.1.2 才能連多個是哪招阿,我在那邊被搞了好一下子 =.=
--
: ※ 引述《starlition (unknown)》之銘言:
: : 加一行 nat on $int_if from 192.168.198.3 port 220 to any -> $static_if
: : 我印象中
: : NAT的封包不需另外pass就會通過
: : (也就是說pass對nat無意義? <- 不大確定)
: 嗯, 結果是一樣不通, 此行於 pfctl -vsn 中完全沒有處理到封包
: nat on em1 inet from 192.168.198.3 port = imap3 to any -> 固IP
: [ Evaluations: 40121 Packets: 0 Bytes: 0 States: 0
: ]
: [ Inserted: uid 0 pid 16269 ]
剛剛測試了一下,你大概須要的東西:
dyn0if="tun1"
dyn0gw="tun1:peer"
int_if="nfe0"
internal_net="192.168.1.1/24"
ext_if_fttb="tun0"
gw_if_fttb="tun0:peer"
# 讓 192.168.1.200 這個 IP 能夠直接被外部 ip 連線
binat on $dyn0if from 192.168.1.200 to any -> ($dyn0if:0)
nat on $int_if from $internal_net to ($dyn0if:0) -> 192.168.1.200
# 讓不同 interface 進來的東西記得回家的路
pass in quick on $ext_if_fttb reply-to ($ext_if_fttb $gw_if_fttb) from any to
($ext_if_fttb) keep state
pass in quick on $dyn0if reply-to ($dyn0if $dyn0gw) from any to 192.168.1.200
keep state
# 強制讓 192.168.1.200 走特定 ip 出去
pass in quick on $int_if route-to ($dyn0if $dyn0gw) from 192.168.1.200 to any
大概就是這樣吧。
不過那個 ppp daemon 設 1.1.1.2 才能連多個是哪招阿,我在那邊被搞了好一下子 =.=
--
Tags:
BBS
All Comments
Related Posts
cp或mv時 顯示狀態
By Xanthe
at 2010-05-05T09:47
at 2010-05-05T09:47
COSCUP 2010 演講徵求書 (Call for Paper)
By John
at 2010-05-05T00:13
at 2010-05-05T00:13
cp或mv時 顯示狀態
By Leila
at 2010-05-04T13:51
at 2010-05-04T13:51
cp或mv時 顯示狀態
By Isla
at 2010-05-03T23:12
at 2010-05-03T23:12
用Packet Filter(PF) 做 IP mapping 遇 …
By Iris
at 2010-05-03T17:31
at 2010-05-03T17:31