1 / 72

實驗 ( 三 ) 學習如何 使用 NS-2 和 NSG2

實驗 ( 三 ) 學習如何 使用 NS-2 和 NSG2. 計算機網路 Computer Network . 實驗步 驟. 安裝 VirtualBox ( 載點 http ://goo.gl/KaAV5u ) 到 ubuntu 正體中文站下載 ubuntu 的映像檔 用 VirtualBox 安裝 Ubuntu 或 直接灌 Ubuntu( 則 1 省略 ) 安裝 NS2 ,用 NS2 去執行 NAM=> 模擬結果視覺化 下載 NSG2 ,利用它產生所產生的 tcl 檔 + 公式程式檔 => 用 gnuplot 繪圖,把結果畫出來.

Télécharger la présentation

實驗 ( 三 ) 學習如何 使用 NS-2 和 NSG2

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. 實驗(三)學習如何使用NS-2和NSG2 計算機網路Computer Network 

  2. 實驗步驟 • 安裝VirtualBox(載點 http://goo.gl/KaAV5u) • 到ubuntu正體中文站下載ubuntu的映像檔 • 用VirtualBox安裝Ubuntu 或直接灌Ubuntu(則1省略) • 安裝NS2,用NS2去執行NAM=>模擬結果視覺化 • 下載NSG2,利用它產生所產生的tcl檔+公式程式檔=>用gnuplot繪圖,把結果畫出來

  3. NS2(Network Simulator,verion2) • 是一套物件導向的網路模擬器。他能模擬真實網路系統 的架構和特性。 • 而NS2是由C++和OTcl作為開發語言,簡而言之,NS2就 是一個OTcl的腳本解釋器,他把使用者所寫好的腳本進行解讀後,產生出模擬的結果,進而對結果進行分析,或者透過NAM工具程式把模擬的過程視覺化呈現出來。

  4. Install NS2(1) • 先下載 Ns-allinone2.35.tar.gz (http://goo.gl/Kdf9mp) nam-1-20090106.tar.gz (http://goo.gl/03RLfK) • 把這兩個壓縮檔放到家目錄底下

  5. Install NS2(2) • 點選左上角DASH主目錄 • 搜尋terminal • 點選終端機

  6. Install NS2(3) • sudo:讓我們切換身分(系統管理員)來進行某項任務 • apt get update : 更新最新套件 => • sudo apt-get update

  7. Install NS2(4) • ls:列出檔案 • ls –a:列出所有檔案 包含隱藏檔 • ls –f:直接列出結果, 而不進行排序 • ls

  8. Install NS2(5) • tar:打包、解壓縮 -x 解壓縮或解打包的功能 -v 在壓縮過程中,將正在處理的檔 名顯示出來 -z 透過gzip的支援進行解壓縮 -f filename 後面接上立即被處理的檔名 => tar xvfz ns-allinone-2.35.tar.gz

  9. Install NS2(6) • apt-get install **** 安裝****這個套件 • 在這裡我們需要安裝 build-essential autoconf antomake libxmu-dev=>sudo apt-get install build-esstialautoconfautomakelibxmu-dev

  10. Install NS2(7) • cd: (change directory) • cd:到上一層目錄 • cd XXX/:到XXX這個目錄 => • cd ns-allinone-2.35/

  11. Install NS2(8) • ./install執行install安裝

  12. Install NS2(9) • 先打cd回到上一層目錄gedit xxx打開xxx文件來編輯 • gedit .bashc 加入環境變數 • Path ( http://goo.gl/li9pwj)

  13. Install NS2(10) • 環境變數可能的錯誤 home/user 須改成自己設定的名稱 Ex: home/user/ =>home/jimEpc/

  14. Install NS2(11) • mv:move • mv AAAA BBBB 把AAAA搬移到BBBB這個目錄下 • mv nam-1-20090106.tar.gz ns-allinone-2.35

  15. Install NS2(12) • cd ns-allinone-2.35 到ns-allinone-2.35的目錄下

  16. Install NS2(13) • tar –zxvf nam-1-20090106.tar.gz 解壓縮nam-1-20090106.tar.gz這個檔案

  17. Install NS2(14) • reboot 重新開機 • sudo reboot

  18. Install NS2(15) • 安裝 ns2 nam套件、指令 • sudo apt-get install ns2 • sudo apt-get install nam

  19. Install NS2(16) • ns ns-allinone2.35/ns-2.35/tcl/ex/simple.tcl • 執行 ns-allinone2.35/ns-2.35/tcl/ex/裡的simple.tcl檔

  20. Install NS2(17) • 看到這個畫面,代表你安裝成功了 • Ns2會去執行nam程式,把模擬結果視覺化

  21. Install NS2(18) • sudo apt-get update • tar xvfzns-allinone-2.35.tar.gz • sudo apt-get install build-esstialautoconfautomakelibxmu-dev • cd ns-allinone-2.35/ • ./install • Cd • gedit .bashc • mv nam-1-20090106.tar.gz ns-allinone-2.35 • cd ns-allinone-2.35 • tar –zxvf nam-1-20090106.tar.gz • sudo reboot • sudo apt-get install ns2 • sudo apt-get install nam • ns ns-allinone2.35/ns-2.35/tcl/ex/simple.tcl

  22. Install NS2(19) • 影片教學網址 • 1. Install Ubuntu over VirtualBoxhttp://www.youtube.com/watch?v=IWZP1tV5hJY • 2.NS2 + Nam over Ubuntu http://www.youtube.com/watch?v=ZQ_TkLWqRIU

  23. Install NS2(cygwin) • Cygwin(一個模擬linux的軟體) • NS2(2.28, 2.30, 2.31 等) • 中文安裝解釋流程(柯志亨) http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm • 可能遇到的問題: 使用名稱  路徑不可有空白 ex: kennychouX 不能有中文 ex: 周世剛 X

  24. Install NS2(cygwin) • 執行桌面上的cygwin小圖示,然後在此視窗下,輸入startxwin.bat,會產生另外一個視窗,這視窗是在繪圖模式。 • 在新視窗中輸入cd ~/ns-allinone-2.xx/ns-2.xx/ns-tutorial/examples/ • 輸入ns example2.tcl • NS2會去執行NAM程式,把模擬結果視覺化。如下圖,

  25. Install NS2(cygwin)

  26. Network Scenario Generator (NSG) • NSG是ㄧ個專門為NS2所設計的劇本產生器,目前最近版本為NSG2,除了原本支援的無線網路之外,還有支援有線網路

  27. How to use NSG2 • NSG2下載網址︰http://goo.gl/XoQrnv • 在執行NSG2之前必須先確定電腦中裝有Java Runtime Environment(JRE)或Java SE Development Kit(JDK) • 昇陽的JAVA官方網站︰http://java.sun.com/javase/downloads/index.jsp

  28. Ubuntu java安裝 • sudo add-apt-repository ppa:webupd8team/java

  29. Ubuntu java安裝 • sudo apt-get update

  30. Ubuntu java安裝 • sudo apt-get install oracle-java7-installer

  31. Ubuntu java安裝 • java –version測試所安裝的JAVA版本

  32. Ubuntu java安裝 • 1. 安裝指令 • 1-1.sudo add-apt-repository ppa:webupd8team/java1-2. sudo apt-get update1-3. sudo apt-get install oracle-java7-installer • 2. 看看是否安裝成功 • java –version • 參考網站: • http://apexu.com/apexu/tw/modules/publisher/item.php?itemid=35

  33. The Network Topology

  34. NSG2(1)

  35. NSG2(2) • 按右鍵以 Oracle Java 7 Runtime 開啟 nsg 2.1

  36. NSG2(3) • Scenario -> New wirelsee scenario

  37. NSG2(4) • NODE

  38. NSG2(5) • Duplex-link

  39. NSG2(6) • Duplex-link

  40. NSG2(7) • Duplex-link

  41. NSG2(8) • TCP

  42. NSG2(9) • TCPSink

  43. NSG2(10)

  44. NSG2(11) • UDP

  45. NSG2(12) • NULL

  46. NSG2(13)

  47. NSG2(14) • FTP

  48. NSG2(15) • CBR

  49. NSG2(16) • Simulation Parameters setup

  50. NSG2(17) • TCL

More Related