FreeBSD 嵌入式防火牆 m0n0wall Firewall 實作 (CF to IDE)
m0n0wall 是一套FreeBSD 做的Embedded 的 Firewall,可以做在光碟,磁碟片,硬碟,還有CF 上,我把它裝在CF 上,韌體大小只有5M左右,安裝的版本是最新的generic-pc-1.2b9.img的版本到這裡下載,主要是以FreeBSD 4.11 + ipfilter做的嵌入式防火牆 , ipfilter 的firewall rules 的書寫習慣比較容易上手,不過在這裡的rules 規則是以 first match
要將img 寫入CF還要下載一個寫入程式physdiskwrite (在這裡下載)
補充使用方法
Installation on a standard PC requires the following steps:
- download the raw CF/IDE image (generic-pc)
- write the image to a CF card (> 5 MB) or an IDE hard disk, either with dd under FreeBSD or under Windows with my tool, physdiskwrite 0.5
- FreeBSD:
gzcat generic-pc-xxx.img | dd of=/dev/rad[n] bs=16k
where n = the ad device number of your CF card (check dmesg)
(ignore the warning about trailing garbage - it's because of the digital signature)- Linux:
gunzip -c generic-pc-xxx.img | dd of=/dev/hdX bs=16k
where X = the IDE device name of your HD/CF card (check with hdparm -i /dev/hdX) - some CF adapters, particularly USB, may show up under SCSI emulation as /dev/sdX
(ignore the warning about trailing garbage - it's because of the digital signature)- Windows:
(use the -u flag if the target disk is > 800 MB - make very sure you've selected the right disk!!)
physdiskwrite [-u] generic-pc-xxx.img
(you must use v0.3 or later!)- put the CF card/HD into the target PC
- plug the PC into the network (LAN/WAN/...)
- power it up
- assign functions (LAN/WAN/OPT) to your interfaces (hint: use auto-detection, or let the MAC addresses tell you which card is which one)
- change the LAN IP address, or use the default (192.168.1.1; m0n0wall acts as a DHCP server by default)
- access the webGUI (user: 'admin', default password: 'mono')
- make the necessary changes to the default configuration
1.安裝
找了一張32 MB 一張 256MB的CF卡來做, 再找一台87年擴大內需退下來的AMD 333的舊電腦 + 2片 intel 網卡(網卡要用好一點)
將CF卡接到 CF to IDE轉接卡上,接到windows系統的電腦上(將secondary IDE的排線接上CF轉IDE卡上),開機後在cmd 下執行physdiskwrite [-u] generic-pc-xxx.img .執行後會顯示目前有幾個磁碟在電腦上,不要選錯
[-u flags 使用在硬碟或CF卡大於800M時 ], 選擇要安裝的磁碟(不要選錯,否則C所有的東西都不見了)(CF 卡的執行效率比硬碟好多了)
然後將CF轉接卡接到firewall的機器上,開啟後開始設定網卡分別指定Lan(對內), Wan(對外)所使用的網卡,
指定好網卡後設定Lan網卡的IP並打開DHCP的功能,指定所要發送IP的區段就OK了
將對內的網卡接到switch上,隨便一台windows電腦也接上switch,然後以瀏覽器連接到對內網卡的IP上就可以開使設定(預設的帳號/密碼 admin/mono)
連上後先設定General setup 設定新密碼 - 並設定 Wan 網卡的 IP
設定static Routes 規則
設定Firewall Rules (Wan / Lan) (預設是 default pass all)
還可以設定流量控制
設定DHCP server 發送IP 的區段 , 也可指定IP
還可以顯示(Lan / Wan)流量圖(要先安裝 Adobe SVG viewer)
使用後發現實在是太棒了,執行效率還不錯,web界面的控制也很方便,用在電腦教室也可以很方便的控制學生電腦的網路只要按個鍵,port 80就全鎖了,..ftp 沒影響...
沒有留言:
張貼留言