※ 引述《[email protected] (DucK)》之銘言:
: 目前環境為 FreeBSD_5.0_Release
: 聯外網路型態為SEEDNET DHCP取得IP
: 如何以一張網卡實行IPNAT+IPFILTER?
: 如果用alias的話...ipnat.rules中routing怎麼設定呢?
: 對外
: │
: ┌┬┬┼┬┬┐Switching Hub
: └┼┼┼┼┼┘
: Other PC ─┘│││└FreeBSD5-NAT_Server
: withVR_IP──┘││
: gateway ───┘│
: =FreeBSD────┘
--
╭──── Origin:<不良牛牧場> bbs.badcow.com.tw (210.200.247.200)─────╮
│ ↘ Welcome to SimFarm BBS -- From : [210.240.95.40] │
╰◣◣◢ ◢◢《不良牛免費撥接→電話:40586000→帳號:zoo→密碼:zoo》 ◣◣◢ ─╯
我的經驗是
用一張網路卡加上IPFILTER做過
下面的的筆記給您參考一下
1.編輯kernel
加入 options IPFILTER
options IPFILTER_LOG 兩行
ps kernel重編 make depend all install
2.修改 /etc/rc.conf 指定兩個 IP再同一張網卡上
#真的IP
ifconfig_xl0="inet 140.111.143.143 netmask 255.255.255.0"
#虛擬的
ifconfig_xl0_alias_0="inet 10.10.10.10 netmask 255.255.255.0"
gateway_enable= "YES"
3.ipnat檔的設定 建議放在/etc下面
map xl0 10.10.10.0/24 -> 140.111.143.143/32 portmap tcp/udp 2000:65000
map xl0 10.10.10.0/24 -> 140.111.143.143/32
4.啟動ipnat
/sbin/ipnat -f /etc/ipnat.conf
PS: ipnat -f 讀取設定檔
ipnat -l 列出目前狀態
ipnat -c 清除所有連線
5.附註 A 我的網路卡是3com的 所以網卡代號是xl0
B 140.111.143.0/25是宜蘭某小學的網路區段
在此僅作示範用 請勿有非分之想
C 24的意思是 255.255.255.0 32則是255.255.255.255
我不知要如何解釋