1 / 53

M0N0 Wall 安裝及設定

M0N0 Wall 安裝及設定. 臺北市立松山工農 翁三偉 sanwei@ele.saihs.edu.tw. 2014/11/30. Facts. The m0n0wall system currently takes up less than 6 MB on the Compact Flash card (or CD-ROM), and contains all the required FreeBSD components (kernel, user programs) ipfilter PHP (CGI version) mini_httpd

Télécharger la présentation

M0N0 Wall 安裝及設定

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. M0N0 Wall 安裝及設定 臺北市立松山工農 翁三偉 sanwei@ele.saihs.edu.tw 2014/11/30

  2. Facts • The m0n0wall system currently takes up less than 6 MB on the Compact Flash card (or CD-ROM), and contains • all the required FreeBSD components (kernel, user programs) • ipfilter • PHP (CGI version) • mini_httpd • MPD • ISC DHCP server • ez-ipupdate (for DynDNS updates) • Dnsmasq (for the caching DNS forwarder) • racoon (for IPsec IKE) • UCD-SNMP • choparp • BPALogin

  3. On a net4501, m0n0wall provides a WAN <-> LAN TCP throughput of about 17 Mbps, including NAT, when run with the default configuration. On faster platforms (like net4801 or WRAP), throughput in excess of 50 Mbps is possible (and > 100 Mbps with newer standard PCs). • On a net4501, m0n0wall boots to a fully working state in less than 40 seconds after power-up, including POST (with a properly configured BIOS)

  4. web interface (supports SSL) serial console interface for recovery set LAN IP address reset password restore factory defaults reboot system wireless support (access point with PRISM-II/2.5/3 cards, BSS/IBSS with other cards including Cisco) captive portal 802.1Q VLAN support stateful packet filtering block/pass rules logging NAT/PAT (including 1:1) DHCP client, PPPoE, PPTP and Telstra BigPond Cable support on the WAN interface IPsec VPN tunnels (IKE; with support for hardware crypto cards and mobile clients) PPTP VPN (with RADIUS server support) static routes DHCP server caching DNS forwarder DynDNS client SNMP agent traffic shaper SVG-based traffic grapher firmware upgrade through the web browser Wake on LAN client configuration backup/restore host/network aliases

  5. 安裝m0n0wall所需硬體設備 • PC一部 • 主機 • 工業主機 • 一般PC • 儲存媒體 • 硬碟 • 光碟+軟碟 • IDE快閃模組(DOM、DOC) • 網路卡2片

  6. Soekris Engineering net4801

  7. 盤儀科技 EmCORE-v611

  8. 創見 IDE 快閃模組

  9. CF轉IDE(函數科技)

  10. Why m0n0? • 考量因素 • BSD系統 • 熟悉的作業系統環境,修改、更新容易。 • 又以PHP為WEB的語言,方便操作介面修改。 • 使用Web作為設定、控制環境。 • 效能 • 可在較低等級的CPU上有不錯的表現、不需太大的RAM、HDD • 可以從CF、USB開機

  11. 本校使用 m0n0wall 情形 • 無線閘道器(前身為GNATBOX ) 1部 • K6-450 • 記憶體128M • 網路卡 2 片 • 軟體放置於DOC • 路由器 (EmCORE-v611) 2部 • 負責本校對外 10M 光纖路由 • 軟體放置於CF

  12. 安裝 m0n0wall • 選擇適合平台的軟體版本 • standard PC (CD-ROM version) • net45xx/net48xx/WRAP embedded PC • standard PC (CF/IDE version) or other embedded PC

  13. 一般PC安裝 • 下載 CF/IDE 影像檔 (generic-pc) • 下載 physdiskwrite • http://m0n0.ch/wall/downloads/physdiskwrite-0.5.zip • physdiskwrite [-u] generic-pc-xxx.img • 目的碟 > 800 MB 時,請加 –u • 請小心選擇正確的磁碟機 • 寫入影像至CF或IDE硬碟(容量> 5 MB)

  14. Physdiskwrite執行時畫面

  15. 使用光碟開機(加軟碟) • 下載 ISO 影像檔 • 將 ISO 影像檔寫入至CD-R (或-RW) • Windows: 利用燒錄軟體(如:Nero)來寫入 ISO 影像檔 (2048 bytes/sector, Mode-1) • 取得一標準1.44 MB磁碟片,並格式化成MS-DOS/FAT。 • Windows: format A:

  16. 開機後,console畫面

  17. 安裝後相關注意事項 • 預設帳號/密碼為admin/ mono • 詳細設定須以web來設定 • 電腦須連接至 LAN Port,以DHCP取得IP來進行設定。 • 預設IP為192.168.1.1(可由console變更,預設Gateway) • 密碼、IP及相關設定可利用 console 重設。

  18. 一般設定(一)

  19. 一般設定(二)

  20. 進階設定(一)

  21. 進階設定(二)

  22. Making a custom SSL certificate for the HTTPS webGUI • openssl req -new -nodes > cert.csr • openssl x509 -in cert.csr -out cert.pem \ -req -signkey privkey.pem -days 365 • The certificate can then be found in cert.pem and the private key in privkey.pem

  23. 複製pem時注意事項 • 複製時,請複製整個檔案(從 - 至 - )後貼上。 -----BEGIN CERTIFICATE----- ……… -----END CERTIFICATE----- -----BEGIN RSA PRIVATE KEY----- ………………. -----END RSA PRIVATE KEY-----

  24. 進階設定(三)

  25. Interface設定 • Interfaces(assign) • Interface assignments • VLANs • LAN • IP Address設定 • WAN • Static • DHCP • PPPoE • PPTP • BigPond • 設定是否阻隔private networks

  26. Firewall • Rules • NAT • Inbound • Server NAT • 1:1 • Outbound • Traffice shaper • Rules • Pipes • Queues • Magic shaper wizard • Aliases

  27. Services • DNS forwarder • Dynamic DNS • DHCP server • DHCP relay • SNMP • Proxy ARP • Captive portalWake on LAN

  28. Captive portal • Captive portal • Pass-through MAC • Allowed IP addresses

  29. Captive portal(一)

  30. Captive portal(二)

  31. Captive portal(三)

  32. Captive portal注意事項 • 套用變更設定時,會將所有的client斷線。 • 請記得啟用 DHCP。 • 注意default/maximum DHCP lease time 要比這裡的timeout時間長。 • 請起動DNS forwarder的功能,client才可被重導至認證畫面(使用者不可以使用自定的DNS)。

  33. Pass-through MAC • 以MAC為判斷標準。 • 在表中者,可以不經認證直接使用網路。 • 通常使用於用戶端。 • 有time-out的限制。

  34. Allowed IP addresses • 以IP為判斷標準。 • 在表中者,可以不經認證直接使用網路。 • 通常使用於伺服器,以利使用者查看相關網頁。 • 如:學校網頁,無線網路使用方法等。 • 注意:此IP所有的PORT皆可存取不受限制。

  35. VPN • IPsec • PPTP • OpenVPN

  36. Status • System • Interfaces • Traffic graph • Wireless • Captive portal

  37. Diagnostics • System logs • DHCP leases • IPsec • Ping • Reset state • Backup/Restore • Factory defaults • Reboot system

  38. 低階訊息及執行命令 • http://<m0n0wall-ip>/status.php .可看一些低階訊息,也可觀看現在的XML 構造。 • http://<m0n0wall-ip>/exec.php,可在m0n0wall上直接執行命令。執行上要注意路徑的問題。

  39. 客製 m0n0wall 影像檔入門 • 參考 Jean-Francois Theroux<jf@theroux.ca> 2004.08.11 • 注意:這份資料參考FreeBSD 4.10 和 m0n0wall 1.1b 15。 如果使用不同的版本,可能會有所不同。 • 首先你需要安裝FreeBSD 4.10。可從這裡得到 ftp://ftp.freebsd.org。 • 這份資料不解釋怎樣安裝FreeBSD,相關的文件可在 (http://www.freebsd.org) 取得。 • 有了種工作環境,需要建立一個工作目錄。 • 建立 /devel 目錄以及一個change/system 子目錄。 # cd $HOME # mkdir devel # mkdir devel/change # mkdir devel/system • 進入你的新環境! # cd devel • 下載 m0n0wall 影像檔修改成為我們所需要的環境。可用 wget下載。wget可能未安裝,要安裝它可用 port 或 package 安裝。 # wget http://m0n0wall.cac.net/download/m0n0wall/generic-pc-1.1b15.img • 可客製的大多數檔案在 mfsroot.gz 影像檔中。接下來的例子將顯示怎樣編輯那些檔案。

  40. 將下載的檔案重新命名。 # mv generic-pc-1.1b15.img generic-pc-1.1b15.img.gz • 解壓縮。 # gzip -d generic-pc-1.1b15.img.gz • 在Linux上,使用 'mount -o loop imagefile /mount/point' mount 上影像檔。 • 在FreeBSD裡,建立一個虛擬裝置, 然後將檔案 mount 上虛擬的裝置。做法如下: # vnconfig -s labels -c vn0 generic-pc-1.1b15.img # mount /dev/vn0a system/ • 複製mfsroot.gz至另一目錄,以方便我們修改。 # cp system/mfsroot.gz change/ • 將影像檔 umount 。 #umount system/ • 移除虛擬裝置。 #vnconfig -u vn0

  41. 解壓縮 mfsroot.gz。 # gzip -d change/mfsroot.gz • 因為無法直接修改 mfsroot,須先掛上檔案系統。 # vnconfig -s labels -c vn0 change/mfsroot # mount /dev/vn0 system/ • 可以編輯 m0n0wall 影像檔了。 大多數有趣的檔案在 ~/usr/local/www 下。 • 修改後,回到 $HOME/devel。 # cd $HOME/devel • ***警告: 當在檔案系統時,如果這時 unmount 影像檔,會產生一些問題,可能必須重頭開始﹗ • 現在 unmount 並重新封裝這影像檔。 # umount system/ # vnconfig -u vn0

  42. 壓縮新 mfsroot 檔案系統,複製回影像檔。 # gzip -9 change/mfsroot # vnconfig -s labels -c vn0 generic-pc-1.1b15.img # mount /dev/vn0a system/ # cp change/mfsroot.gz system/ # umount system/ # vnconfig -u vn0 • 最後,重新壓縮影像檔。 # gzip -9 generic-pc-1.1b15.img # mv generic-pc-1.1b15.img.gz generic-pc-1.1b15.img • 可以準備把你的影像檔上載到 m0n0wall 機器了。

  43. 注意事項(一) • 如果你想要對預設進行修改,編輯影像檔 mfsroot.gz 中 conf/config.xml 和 config.xml。 • 如果你想要把更多 port 加進 NAT 中(如: SSH / HTTP / FTP)來建立 rules,請編輯 ~/usr/local/www/guiconfig.inc • -建議利用 diff 來建立 patches,以利將來的版本更容易修正。 如︰ • # diff -ur file.orig file > patch01

  44. 注意事項(一) • 登出視窗相關文字在/usr/local/captiveportal/index.php中 • 修改相關資料後,請移除無關的檔案,如:*~,*.bak 等。

  45. Firmware更新

  46. earlyshellcmd & shellcmd • 在 config.xml 使用,無法在 webgui 中加入 • earlyshellcmd 使用在 boot scripts 開始前執行特定的工作。 • shellcmd 用在 boot scripts 完成後,執行特定的工作。 • 上列兩個指令置於 config.xml 檔案中 <system>….. </system>之間,如 </system> …………….. <shellcmd>/sbin/ipf -D</shellcmd> <shellcmd>/sbin/ipnat -CF</shellcmd> ………………. </system>

  47. 備份/回復設定檔 • 在 Diagnostics – Backup/Restore 中

More Related