Network Simulator (NS2) 1 Tutorial on Network Simulator (NS2) Hemant Kumar Rath Infonet Lab, Dept of Electrical Engineering IIT Bombay, Mumbai - 400076.

Slides:



Advertisements
Similar presentations
Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems.
Advertisements

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.
Wireless Communication : LAB 3
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,
Ns-2 tutorial Karthik Sadasivam Banuprasad Samudrala CSCI 5931 Network Security Instructor : Dr. T. Andrew Yang.
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.
Dongsoo S. Kim 1.
Winter 2008 Evaluation Tools1 Brief Overview of Networking Evaluation Methods and Tools.
NS TUTORIAL Padma Haldar USC/ISI 09/04/02.
15-744: Computer Networking ns-2 Tutorial Based on slides from John Heidemann, Polly Huang, and Amit Manjhi.
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,
Computer Networks NS. Features F Event driven simulator –developed at UC Berkeley F Network Topologies –nodes (connectivity), links (bandwidth, delay)
1 Ns Tutorial Alhussein A. Abouzeid Elect. Eng. Dept./U. of Washington Parts of this educational presentation use examples available.
Day 3 Outline Multicast example (from Day 2) Wireless Misc. utilities
15-744: Computer Networking L-3 The network simulator ns-2 Slides loosely based on a tutorial by Polly Huang, ETH Zurich.
1 Modified Schedule Day 2 Network AniMator (nam) Examples simple.tcl mcast.tcl Day 3 Wireless (ad-hoc)
Submitters: Stella Pantofel Michael Halperin Igor Berman
1 Network Simulator (NS-2) Tutorial These slides can be downloaded from:
EECS122 - UCB1 Measurements and Modeling Table of Contents 1. Measurements Measurements 2. Modeling and its Shortcomings Modeling and its Shortcomings.
Ns Simulation of IEEE SC546 Project (Fall 2002) SOO IL KIM JISUN YOON
Network Simulator 2(NS2) Yingyue Xu 8/25/2015. Overview: The Network simulator (NS): discrete event simulator for networks. supports wired, wireless,
QualNet 2014/05/ 尉遲仲涵. Outline Directory Structure QualNet Basic Message & Event QualNet simulation architecture Protocol Model Programming.
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.
Introduction to NS2 -Network Simulator- -Prepared by Changyong Jung.
1 Introduction to Ns-2 Zhibin WU WINLAB, ECE Dept. Rutgers U.
Date : 2010/11/23 Speaker : Chia-Wen Lu 1.  Network Simulation  Introduction to NS2  Simple Simulation Example 2.
Bridging the Gap: Turning a Network Simulation into an Emulation Mac Newbold.
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.
TNK092: Network Simulation - Nätverkssimulering Lecture 3: TCP Vangelis Angelakis.
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.
1 Network Simulation and Testing Polly Huang EE NTU
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 
CDA6530: Performance Models of Computers and Networks Chapter 10: Introduction to Network Simulator (NS2) TexPoint fonts used in EMF. Read the TexPoint.
University of Texas at Arlington CSE 5346/4346 High Performance Networks 1 NS-2 Tutorial Choe, Hyun Jung (Stella) Spring 2008 Spring 2008 High Performance.
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.
July 7, 2003 Building a Wireless LAN traffic test case in ns2 Radio Science Laboratory Department of Electrical and Computer Engineering The University.
NS-2 Shahin Shayandeh December 2004 Session 1. Ns-2, the Network Simulator  A discrete event simulator Simple model  Focused on modeling network protocols.
Lab 2, Network Simulator ns2
© Algirdas Pakstas CS3026N Network Analysis, Design and Simulation 1 CT3020: Network Planning and Simulation Week 6b Prof.DrTech. Algirdas Pakštas.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
NS-2 Simulator 최 종 훈 Contents  About NS  Installation  Based on Linux  Based on Windows  Architecture  Using NS-2  Example  References.
ECE 6610 Sandeep Kakumanu GNAN research Lab
DMET 602: Networks and Media Lab
(Modified from Polly Huang’s and last year’s original)
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Ns By Kulveer Singh.
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

Network Simulator (NS2) 1 Tutorial on Network Simulator (NS2) Hemant Kumar Rath Infonet Lab, Dept of Electrical Engineering IIT Bombay, Mumbai

Network Simulator (NS2) 2 Introduction  Discrete event simulator targeted at networking research and education  Protocol design, traffic studies, etc  Protocol comparison  Wired and wireless networks  Back end is in C++ and front end is in oTcl  Provide a collaborative environment  Open source, Freely distributed Share code, protocols, models, etc No code guarantee  Easy comparison of similar protocols

Network Simulator (NS2) 3 Simulation Network  Wired Network  Routing: Distance Vector, Link State  Transportation: TCP and UDP  Queuing disciplines: drop-tail, RED, FQ, SFQ, DRR, RR  QoS: IntServ and DiffServ  Wireless  Ad-hoc routing and mobile IP: AODV  Sensor-MAC, WiMAX (new)  Power control in wireless networks  Tracing, Visualization, Analysis, Other utilities

Network Simulator (NS2) 4 NS2 Functionalities  Traffic models and applications  Web, FTP, Telnet, CBR, real time traffic  Transport protocols  Unicast: TCP (Reno, New-Reno, Vegas, etc.), UDP  Multicast: SRM  Routing and queuing  Wired and ad-hoc routing and directed diffusion  Queuing protocols: RED, drop-tail, etc  Physical media  Wired (point-to-point, LANs), wireless (multiple propagation models), error models, satellite

Network Simulator (NS2) 5 How to work in NS2 ?  Download the software  Install NS2 in your home directory  Compile the latest version of NS2  Validate NS2  Create your topology  Need to understand the real topology and the directory structure in NS2  Modify the existing codes C++ and/or.tcl files  Create your own.tcl script for this  Execute the script  Analyze your result

Network Simulator (NS2) 6 Download and Installation of NS2  Select the Operating System  NS2 is available for both Windows and Linux  Linux is desirable as C++ compiler is free and easy to debug  Check your Hardware  Processor speed, RAM, home directory space Minimum 400 MB space is required  Download the appropriate source file  Available locally in the course home page  Read the instructions in details before installation

Network Simulator (NS2) 7 Download and Installation of NS2  Install NS2 in your home directory  Follow the instructions given in the course home page  For trouble shooting refer to the links provided in the course home page  Else, do a google search  Solutions to most of the problems are available in the NS2 mailing list 

Network Simulator (NS2) 8 Create your Topology  Decide what do you want to simulate  Wired or wireless network  What are the protocols?  How many nodes, what are the measuring parameters?  What are the applications involved, etc?  Make a rough sketch of the topology  Figure out the concerned files (C++ or.tcl)  Based on the requirement do the following Edit the existing C++ files and/or the.tcl files You can create new C++ files

Network Simulator (NS2) 9 Data and Control Separation  oTCL in the Front End  Control part of NS2  Topology (Simulation scenario) configurations  Event driven Periodic or Triggered action  Manipulates existing C++ objects  Easy to write and edit  C++ in the Back End  Core of NS2, data part of NS2  Easy to modify the code Not fully layered and structured  Packet processing and execution

Network Simulator (NS2) 10 Directory Structure  Main directories  bin, ns-2xx, lib, man, include, etc in ns2 home  ns-2.xx  Readme file  Makefile, installation file, tutorial, etc  Source files related to the protocols All.cpp and.h files related needed for editing  Need understanding of interaction among the functions/sub routines  Not fully layered like QualNet

Network Simulator (NS2) 11 Compiling NS2  Create / Modify the C++ file  If you are creating new C++ file, include the name of the new files in the Makefile  If you are editing the existing C++ files, keep a copy of the original file  Add comments to your modifications with date  Compile NS2  After creation/editing, compile NS2 using (make clean;) make; Check for errors, if any and rectify

Network Simulator (NS2) 12 Executing NS2  Create your.tcl script as per your topology  Run the.tcl file using ns command  Check which ns2 you are using  Create a huge output file (trace file) to analyze  Need to understand the file contents  Perl scripts are also available to analyze the trace file  Analyze using nam  Visual network animator  Single thread of control  No locking or race conditions to worry about

Network Simulator (NS2) 13 Functional Diagram of NS2 Problem Topology Setup/execute simulation with ns (.tcl) Result Analysis/debug Modify ns (.cpp/.tcl)

Network Simulator (NS2) 14 Simulation with NS2  Create a New Event Scheduler (simulator env.)  Turn on Tracing  Can use nam also  Topology Creation  Create Nodes, Network, Queuing, etc.  Setup Routing  Send Data Create Transport Connection, Create Traffic, Start Applications  Insert Errors  Analyze the Trace File

Network Simulator (NS2) 15 Event Scheduler  Event  Generation of a packet, start/finish of transmission  Create a New Event Scheduler set ns [new Simulator]  Schedule Events $ns at : any legitimate ns/tcl command $ns at 10.0 “finish”  Start Scheduler $ns run

Network Simulator (NS2) 16 Tracing and Analyzing  Packet Tracing  On all links $ns trace-all [open cwnd.tr w]  On one specific link $ns trace-queue $n0 $n1$tr cbr cbr r cbr  Event Tracing  Record “event” in trace file $ns eventtrace-all E TCP slow_start

Network Simulator (NS2) 17 Topology Creation  Create Nodes  set n0 [$ns node]  set n1 [$ns node]  Assign Links and Queuing  $ns $n0 $n1 : duplex-link, simplex-link : DropTail, RED, CBQ, FQ, SFQ, DRR, diffserv RED queues Viz: $ns duplexlink $n0 $n1 1Mb 10ms DropTail  Link between n0 and n1 is duplex, 1Mbps capacity, 10msec delay and queue is Drop Tail

Network Simulator (NS2) 18 Setup Routing  Unicast  $ns rtproto : Static, Session, DV, cost, multi-path  Multicast  $ns multicast (right after [new Simulator])  $ns mrtproto : CtrMcast, DM, ST, BST  Other Types of Routing Supported  Source routing, Hierarchical routing

Network Simulator (NS2) 19 Sending Data  Create UDP Agent and Attach  set udp0 [new Agent/UDP]  $ns attach-agent $n0 $udp0  Create CBR Traffic  set src [new Application/Traffic/CBR] set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ $cbr0 attachagent $udp0  Create Traffic Sink and Attach  set null [new Agent/Null]  $ns attach-agent $n1 $null

Network Simulator (NS2) 20 Sending Data  Create Exponential or Pareto on-off  set src [new Application/Traffic/Exponential]  set src [new Application/Traffic/Pareto  Connect two Agents  $ns connect $udp0 $null  Start and Stop of Data  $ns at 0.5 “$cbr0 start”  $ns at 4.5 “$cbr0 stop”  Create TCP Agent and Attach  set tcp0 [new Agent/TCP]  $ns attach-agent $n0 $tcp0

Network Simulator (NS2) 21 Sending Data  Create Traffic Sink and Attach  set null0 [new Agent/TCPSink]  $ns attach-agent $n1 $null0  Connect the Agents  $ns connect $tcp0 $null0  Traffic on Top of TCP  FTP set ftp [new Application/FTP] $ftp attach-agent $tcp0  Telnet set telnet [new Application/Telnet] $telnet attach-agent $tcp0

Network Simulator (NS2) 22 Inserting Errors  Creating Error Module  set loss_module [new ErrorModel]  $loss_module set rate_ 0.01  $loss_module unit pkt  $loss_module ranvar [new RandomVariable/Uniform]  $loss_module drop-target [new Agent/Null]  Inserting Error Module  $ns lossmodel $loss_module $n0 $n1

Network Simulator (NS2) 23 Analyze the Trace File  Trace files are huge in size  Only redirect the parameters you want to measure  Traces begin with a single character or abbreviation  It indicates the type of trace, followed by a fixed or variable trace format  Perl scripts are available to analyze trace files  Refer for the details 

Network Simulator (NS2) 24 Queries?