1 / 20

NS-2 Tutorial

NS-2 Tutorial. COMP 7810 09R2 University of Manitoba March 4, 2009. Goal and Outline. Goal of this tutorial Lead you to get started using NS-2 Outline Introduction - What’s NS? Steps in Using NS-2 (through examples) Development and Your Project. What’s NS?.

reba
Télécharger la présentation

NS-2 Tutorial

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 Tutorial COMP 7810 09R2 University of Manitoba March 4, 2009

  2. Goal and Outline • Goal of this tutorial • Lead you to get started using NS-2 • Outline • Introduction - What’s NS? • Steps in Using NS-2 (through examples) • Development and Your Project

  3. What’s NS? • NS is a packet-level simulator • Started with Keshav’s REAL in 1989 • Been revised in Berkeley, then others • Overview • Major engine (network components) written in C++ • User-interface is tcl script

  4. My First Tcl Script

  5. Test it out! • Go to http://www.cs.umanitoba.ca/~yliu/TEACH/NS2/TUTORIAL

  6. My First OTcl Script

  7. NS-2 Simulated Components • Protocols • TCP, UDP, DCCP, SCTP, TFRC, Wi-Fi, etc. • Network model • Nodes, links, topology, channel schedulers, buffer management, etc. • Traffic model • Applications: FTP, CBR, MPEG, etc. • Traffic traces

  8. NS-2 Simulated Components (II) • All implemented by students/researchers like you and me • Each release has a few more contributed components added • Many are still being developed • Well documented steps to use and to add to NS-2

  9. General Steps In Using NS-2 • Obtaining NS-2 (made available for you) • Writing an OTcl script. E.g., “a.tcl” • Run the simulation. Just type “ns a.tcl” • Post-process the trace generated • Plot graphs and include in your papers

  10. Obtaining NS-2 • Available to you here in CS • Linux version 2.33 installed on neram-02 (a networks lab Linux machine) • Each student is given a separate complete copy of NS-2 • Email me if you don’t know how to access yours

  11. Obtaining NS-2 (for your home PC) • Available for both Linux and Windows • For Windows, you need VMware or cygwin • For Linux, install all-in-one package requires only four commands • tar xzvf ns-allinone-2.33.tar.gz • cd ns-allinone-2.33 • ./install • source setup.csh (Note this script was written by our system admin Gilbert, you may need to copy it over and “customize” it a little bit) • You are ready to go

  12. Writing An OTcl Script • Use NS-2, take a look at “ns-simple.tcl”

  13. Writing An OTcl Script (II) • Add to NS-2 • Write a new network layer component • Write a new transport layer protocol • Write a new application • Steps • Writing new components in .cc and .h (often free implementations are available) • Add to existing header files in package • Add to Makefile and re-compile

  14. Add To NS-2 • Step-by-step instructions for a few examples available in “NS by Example” from WPI • On Transport, Application, and Network Layers respectively • Web site • http://nile.wpi.edu/NS/

  15. Run The Simulation • Plug in the trace file names

  16. Run the Simulation to Collect Traces • Entire packet level event trace dump to file

  17. Post-Process the Trace Generated • Through scripting languages such as Perl, awk, (ba)sh (shell scripts) • Or spread sheet such as Excel • See example “ns-simple-trace.tcl” to generate trace “out.tr” • Perl and awk combined to produce “jitter.txt”

  18. Plot the Graphs • Gnuplot, very handy tool to give nice graphs • See example “gp”, a Gnuplot script that I wrote • The generated .ps file can be easily added to LaTeX for paper / report writing

  19. Development • Editor (you need a comfortable way to edit files under Linux) • Vi, Emacs, pico, … what else do people use? • Make • A very simple utility to automate compilation

  20. Your Course Project • Some tools to play with • OTcl, editor, make, perl, gnuplot • nam to avoid (an animator not essential to simulation) • Need to add to NS-2? • Search for existing implementations on the net first • Have fun!

More Related