ECE 6610 Sandeep Kakumanu GNAN research Lab

Slides:



Advertisements
Similar presentations
Vacha Dave, University of Texas at Austin 1 Network Simulator Tutorial Advanced Computer Networks (CS378)
Advertisements

Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems.
1 The ns-2 Network Simulator H Plan: –Discuss discrete-event network simulation –Discuss ns-2 simulator in particular –Demonstration and examples: u Download,
1 NS-2 Tutorial COMP R2 University of Manitoba March 4, 2009.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2004) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
NS2 Tutorial – Part II Internet Computing KUT Youn-Hee Han.
Wireless Communication : LAB 3
NS-2 (network simulator) NS by example παρουσίαση Κων/νος Τρούλος.
Introduction to Network Simulator NS-2 Part I
1 ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides)
Network Simulation One tool to simulation network protocols for the Internet is the network simulator (NS) The simulation environment needs to be set-
An Introduction to NS-2 * Gayatri Swamynathan CS 276 TA *some slides are from a presentation by Haobo Yu & Nader Salehi, USC/ISI.
NS-2 Shahin Shayandeh December 2004 Session 2. Ns programming  Create the event scheduler  Turn on tracing  Create network  Setup routing  Insert.
Brief Intro to ns2: The most widely used Network Simulator COMP5416 Advanced Network Technologies Based on: Marc Greis's
Ns-2 Tutorial Exercise (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Adopted from Nicolas’s slides Jianping Wang,
LAB 3 NS2 Preliminaries. Contents TCL/OTCl Fundamentals Creating Network Setting Connections Generating Traffic Inserting Errors Configuring for multicast.
Ns-2 tutorial Karthik Sadasivam Banuprasad Samudrala CSCI 5931 Network Security Instructor : Dr. T. Andrew Yang.
Network Simulator (NS) Prof. Nelson L. S. da Fonseca State University of Campinas, Brazil.
How to Add a New Protocol in NS2 Xu Leiming CSCW Lab. at CS Dept., Tsinghua Univ. June 1, 2001.
5-Jul-141 S.Pushpalatha, Associate Professor, PSNACET.
Introduction to NS. Information Main website Documentation, mailing list archive, tutorial Location of Source codes –C++ files.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2003) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
CprE 543x – ns-2 Tutorial Zak Abichar, Dept of Electrical and Computer Engineering Iowa State University Ames,
Day 3 Outline Multicast example (from Day 2) Wireless Misc. utilities
EECS122 - UCB1 Project 3: ns Simulation of Application-Level Routing Improve the application performance by user-level / application-level routing. Understand.
1 Modified Schedule Day 2 Network AniMator (nam) Examples simple.tcl mcast.tcl Day 3 Wireless (ad-hoc)
Writing Tcl Scripts Outline Goal Reading Syntax Data Types
EECS122 - UCB1 Measurements and Modeling Table of Contents 1. Measurements Measurements 2. Modeling and its Shortcomings Modeling and its Shortcomings.
Network Simulator (NS2) 1 Tutorial on Network Simulator (NS2) Hemant Kumar Rath Infonet Lab, Dept of Electrical Engineering IIT Bombay, Mumbai
Wireless Networking and Systems CSE 590 ns2 tutorial.
10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann1 NS Tutorial, Class 10 CSci551: Computer Networks SP2002 Friday Section John Heidemann.
Redes Inalámbricas Máster Ingeniería de Computadores 2008/2009 Tema 7.- CASTADIVA PROJECT Performance Evaluation of a MANET architecture.
Introduction to NS2 -Network Simulator- -Prepared by Changyong Jung.
Date : 2010/11/23 Speaker : Chia-Wen Lu 1.  Network Simulation  Introduction to NS2  Simple Simulation Example 2.
NS2 - Appendix Ming-Feng Yang. 2 2 Outline NS2 Models NS2 Directory Structure Extending NS2 in OTcl Extending NS2 in C++ NS2 related links.
JIA-HUI HUANG INSTITUTE OF COMPUTER SCIENCE AND INFORMATION ENGINEERING NATIONAL TAIPEI UNIVERSITY OF TECHNOLOGY Network Simulator – NS-2 1.
Network Simulator-2 Sandeep singla 1998A2A7540. NS-2 A discrete event simulator Focused on modeling network protocols –Wired, wireless –TCP,UDP,unicast,multicast.
NetFlow Very useful for traffic analysis Very useful for traffic analysis Standard sampler: Standard sampler: –Cisco Netflow –Juniper Traffic Sampling.
1 Network Simulator Tutorial. 2 Network Simulation * Motivation: Learn fundamentals of evaluating network performance via simulation Overview: fundamentals.
Internet Computing KUT Youn-Hee Han
NS-2 Tutorial. Motivation What’s NS-2 Network simulator –Discrete event simulator It covers multiple layers –Application layer, transport layer, network.
Quality evaluation of MPEG4 video transmission over GPRS networks.. Presented by: Abdullah M. Rana Multimedia Communication.
1 NS Fundamentals. USC INFORMATION SCIENCES INSTITUTE 2 OTcl and C++: The Duality C++ OTcl Pure C++ objects Pure OTcl objects C++/OTcl split objects ns.
Ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1.
1 Introduction to NS-2 r Tutorial overview of NS m Create basic NS simulation r Walk-through a simple example m Model specification m Execution and trace.
Lab 2, Network Simulator ns2 Shiv Kalyanaraman Yong Xia (TA) Satish Raghunath Sept 4,
Network Simulator Tutorial Wireless Networks. Acknowledgements Material is taken from the presentations by Jim Kurose, University of Massachusetts, Amherst.
Network Simulator 2. Introduction Open source network simulator NS uses two languages: C++ and OTcl  C++ is fast to run but slower to change Kernel 
The Creation of NS2 Simulated Environment ( 1 ) LI Chengbo
TNK092: Network Simulation - Nätverkssimulering Lecture #1: Course basics and a first taste of NS2 Vangelis Angelakis Ph.D.
NS-2 Shahin Shayandeh December 2004 Session 1. Ns-2, the Network Simulator  A discrete event simulator Simple model  Focused on modeling network protocols.
Network Simulator 2 Network Simulator 2 Practice SungKyunKwan-Univ Mobile Computing LAB ( 안혜환
Lab 2, Network Simulator ns2
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
NS-2 Training 12/12/2011. Introduction  NS-2: Network Simulator Generation 2  Latest Release: 2.35 / Nov. 4, 2011 
An Introduction To Tcl Scripting John Ousterhout Sun Microsystems Laboratories Tcl/Tk Tutorial, Part II.
NS-2 Simulator 최 종 훈 Contents  About NS  Installation  Based on Linux  Based on Windows  Architecture  Using NS-2  Example  References.
Overview of VANET Project(2011) on NS2 Perspective Part 1 of 2 Jae-Myeong Lee Human-centric Mobile Computing Lab.
DMET 602: Networks and Media Lab
(Modified from Polly Huang’s and last year’s original)
Network Simulator Tutorial
NS-2 Training 4/12/2011.
Basics of NS-2 Training in TCL script
Mobicom ‘99 Per Johansson, Tony Larsson, Nicklas Hedman
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Introduction to NS Srinath Perur.
Bluetooth: Tutorial & Simulation
Karthik Sadasivam Banuprasad Samudrala
Ns-3 Tutorial Xin Li.
Presentation transcript:

ECE 6610 Sandeep Kakumanu GNAN research Lab Network Simulator - ns2 ECE 6610 Sandeep Kakumanu GNAN research Lab

Announcements T-Square wiki is up: Go to https://t-square.gatech.edu/portal Login with your prism ID. Select ECE6610 tab. Use wiki to post questions on class/assignments/ns2/others. Groups have been formed. Assignment 1 has been posted.

Outline Discrete event Simulations ns-2 architecture Working with Tcl Working with C++ Important files Trace analysis Miscellaneous Assignment 1 overview

Classification of simulation paradigms Computer simulation Discrete models Continuous time models event driven time-stepped

Discrete event simulations: As-fast-as-possible execution of simulation as opposed to scaled real-time simulation. Event based scheduling. A single queue of events. Each event has a time stamp. Chronological execution of events. An event might create more events. These new events are inserted into the queue.

Ns-2: Introduction NS-2: network simulator version 2 Discrete event simulator Packet level simulation Features Open source Scheduling, routing and congestion control Wired networks: P2P links, LAN Wireless networks: terrestrial (ad-hoc, cellular; GPRS, UMTS, WLAN, Bluetooth), satellite Emulation and trace

Ns-2 Paradigm Object-oriented programming Protocol layering Modularity and extensibility Large scale simulation Maintenance and reusability Split-language programming Scripting language (Tcl) System programming language (C++)

Ns-2: Split Languages Tcl scripts (Tcl/OTcl) Interpreted (interactive) Setup and configuration C codes (C/C++) Compiled (efficient) Algorithms and protocols TclCL (OTcl/C++) Link Tcl/OTcl scripts and C/C++ codes Provide a layer of C++ glue over OTcl

OTcl/C++ split objects NS-2: Split Objects OTcl/C++ split objects Pure OTcl objects Pure C++ objects TclCL linkage OTcl C++ NS-2

NS-2: Directory Structure ns-allinone ... Tcl8 TK8 OTcl TclCL ns-2 nam-1 tcl ... C++ code ex test lib mcast ... examples validation tests OTcl code

Structure of a wired node

Structure of a wired simplex link

A wired LAN

A wireless node

Setting up ns-2 Requirements: Linux box with at least 500 MB free space. Download the latest ns-allinone-2.33.tar.gz from the ns-2 website (google ns-2). Untar the archive: > tar –xvfz ns-allinone-2.33.tar.gz Install: > cd ns-allinone-2.33 > ./install Setup the environment variables in the bash or csh script. Close xterm and open again. ns-2 should work now.

Setting the environment variables Bash: $ vi .bashrc export PATH=$PATH:/path_to_ns-allinone-2.33/bin:/path_to_ns- allinone-etc/ export LD_LIBRARY_PATH=$PATH:/path_to_ns-allinone…etc/ export TCL_LIBRARY=$PATH:/path_to_ns-allinone…etc/ Csh: > vi .cshrc setenv PATH /path_to_ns-allinone-2.33/bin:/path_to_ns-allinone- etc/:$PATH

Working with tcl Tcl is the front-end in ns-2. Define node configurations, node topology, agents etc. Agents can be UDP/TCP, CBR/FTP/VBR/Webtraffic/... For wired nodes: setup links, define link delays, link errors, define LAN configurations, buffer sizes... For wireless nodes: node positions, node mobility, chose from different MAC, routing protocols. Simple procedures for printing aggregated results like total throughput, total simulation time etc.

Working with tcl (cont'd) A command consists of words cmdName arg1 arg2 … cmdName: core command or procedure set, puts, expr, open, if, for, … All words are considered as strings White space (space/tab) separates arguments Newline or semicolon (;) terminates a command Command evaluation: parsing and execution The interpreter does “substitution” and “grouping” (parsing) before running a command Every command returns a result string after execution

Basic Tcl commands: puts - tcl equivalent of printf Ex – puts $a; #will print the value of a set – set value to variable Ex – set a 3; #set value of a=3 expr – evaluate a mathematical expression Ex – expr $a+2 ; #add 2 to a. Complex groupings: set rate [expr 5*$a]; #compute a*5 and set to rate

Tcl: procedures Procedures are like functions in C. Variables defined outside a procedure are invisible inside it. Global variables are visible everywhere. Variable length of arguments using args. Examples proc add args { set s 0 foreach i $args {incr s $i} return $s } proc inc {var {dv 1}} { set a [expr $var+$dv] return $a }

Tcl Core commands Control flow if, switch, while, for, foreach File access open, close, flush, puts, gets String manipulation glob-style and regular expression List manipulation llength, lindex, linsert, lreplace lappend

A simple tcl script set ns [new Simulator] set nf [open out.tr w];$ns trace-all $nf for {set i 0} {$i<2} {incr i} { ;# create the nodes set n($i) [$ns node]} $ns duplex-link $n(0) $n(1) 1Mb 10ms DropTail set udp(0) [new Agent/UDP] # Create a UDP agent $ns attach-agent $n(0) $udp(0) set null0 [new Agent/LossMonitor] $ns attach-agent $n(1) $null0 set cbr(0) [new Application/Traffic/CBR] $cbr(0) set packetSize_500 $cbr(0) set rate_ 100kb $cbr(0) attach-agent $udp(0) $ns connect $udp(0) $null0 $ns at 0.0 "$cbr(0) start" $ns at 10.0 "$cbr(0) stop" proc finish {} { global ns nf $ns flush-trace; close $nf } $ns at 10.0 "finish" $ns run

Working with C++ All protocols are written in C++. Everything is an object. Otcl will attach the necessary C++ objects. All objects are inherited from tclclass. Every object has atleast one header (.h) file and one .cc file. Different objects talk to each other using packets. Every object has a recv() function which receives a packet, and has pointers to all the other attached objects known as targets (uptarget_, downtarget_ etc).

Packet Packets are events Can be scheduled to “arrive” Packets contain header section and data Header section is a cascade of all in-use headers Each packet contains a common header packet size (used to compute transmission time) packet type timestamp, uid, … All in-use headers are included when simulation starts Change packet size to reflect header cascading

Important files packet.h – defines all the headers for packets. scheduler.h,.cc – the C++ scheduler class. agent.h,.cc – the base class for all agents. tcp.h,.cc – TCP, udp.h,.cc – UDP, cbr_traffic.cc – cbr traffic, mac-802_11.h,.cc – 802.11 MAC. tcl/lib/ns-defaults.tcl – All the default parameters for configurations of the various protocols. tcl/lib/ns-lib.tcl – Otcl script connecting the various layers of the network stack in a single node.

Modifying C++ files Modify existing C++ files. C++ files are inside /path/ns-allinone-2.33/ns-2.33 directory. The directory also has a Makefile. When you edit only a .cc file: $ make When you edit a .h file: $ make clean

Traces Ns-2 simulations provide a number of traces. A trace file is used for post-processing of the simulation and find out what events happened at different times of the simulation. Traces for wired and wireless simulations have different format. Traces are text files. Trace formats at: http://nsnam.isi.edu/nsnam/index.php/NS- 2_Trace_Formats Different ways to parse the traces – C, awk, perl... Use anyone in which you are comfortable.

Sample trace + 0.0008 0 1 cbr 1000 ------- 0 0.0 2.0 1 1 - 0.0008 0 1 cbr 1000 ------- 0 0.0 2.0 1 1 + 0.0016 0 1 cbr 1000 ------- 0 0.0 2.0 2 2 - 0.0016 0 1 cbr 1000 ------- 0 0.0 2.0 2 2 + 0.0024 0 1 cbr 1000 ------- 0 0.0 2.0 3 3 - 0.0024 0 1 cbr 1000 ------- 0 0.0 2.0 3 3 r 0.0028 0 1 cbr 1000 ------- 0 0.0 2.0 0 0 + 0.0028 1 2 cbr 1000 ------- 0 0.0 2.0 0 0 - 0.0028 1 2 cbr 1000 ------- 0 0.0 2.0 0 0 + 0.0032 0 1 cbr 1000 ------- 0 0.0 2.0 4 4 - 0.0032 0 1 cbr 1000 ------- 0 0.0 2.0 4 4 r 0.0036 0 1 cbr 1000 ------- 0 0.0 2.0 1 1 + 0.0036 1 2 cbr 1000 ------- 0 0.0 2.0 1 1 - 0.0036 1 2 cbr 1000 ------- 0 0.0 2.0 1 1 + 0.004 0 1 cbr 1000 ------- 0 0.0 2.0 5 5

Miscellaneous utlities nam – Network animator: Used to animate the network events after the simulation has finished. nam will parse a name trace and show the animation. cbrgen – create traffic patterns. setdest – generate wireless topologies and set up mobility patterns using random waypoint model.

More help Marc Greis tutorial (Chapters I-VI & VIII-XI). ns-2 manual. ns-2 mailing list. T-square wiki.

Puzzle Are there two dogs in world with the same number of hairs ? (Make reasonable assumptions)