技術討論區 > BSD 討論版
關於 FreeBSD 上 ipfw 的小問題...
(1/1)
...:
請問一下在使用動態的真實 IP 時,要如何在 rc.firewall 檔案中設定對外介面的資料?
因為使用 ADSL 掛 PPPoE 加 NAT 給內部的機器用,不過在設定 ipfw 的時候卻不知道該如何對外介面的設定,以處理外部的連線.
主要是因為直接上網的機器為 NAT ,有掛兩張網卡,而網卡分別為 vr0, vr1.
vr0 是對內部網路,ip 為 192.168.0.254, vr1 為對外的 ADSL 連線,因為用撥接式,因此是由 isp 動態分配 ip,而撥號後產生的 tun0.
現在是因為要把 rc.firewall 的 type 設為 simple 以管制兩個介面封包上的交換.
不過目前找的到的資料都僅有針對固定的 ip,而沒有說如何動態去找介面的 ip,所以才請各位大大指教.
...:
請參考 /etc/rc.firewall:
......
oif="ed0"
onet="192.0.2.0"
omask="255.255.255.240"
oip="192.0.2.1"
# set these to your inside interface network and netmask and ip
iif="ed1"
inet="192.0.2.16"
imask="255.255.255.240"
iip="192.0.2.17"
# Stop spoofing
${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif}
${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif}
# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}
.....
導覽
[0] 文章列表
前往完整版本