Download presentation
Presentation is loading. Please wait.
Published byDion Sane Modified over 10 years ago
1
1 NS-2 Tutorial COMP 7810 09R2 University of Manitoba March 4, 2009
2
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
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
4 My First Tcl Script
5
5 Test it out! Go to http://www.cs.umanitoba.ca/~yliu/TEACH/NS 2/TUTORIAL
6
6 My First OTcl Script
7
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
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
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
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
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
12 Writing An OTcl Script Use NS-2, take a look at “ns-simple.tcl”
13
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
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
15 Run The Simulation Plug in the trace file names
16
16 Run the Simulation to Collect Traces Entire packet level event trace dump to file
17
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
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
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
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!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.