Introduction to Network Simulator NS-2 Part I

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,
Network Simulator (NS-2)
1 NS-2 Tutorial COMP R2 University of Manitoba March 4, 2009.
Introduction to nam Tim Buchheim 21 November 2002 ns tutorial - fall 2002.
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 παρουσίαση Κων/νος Τρούλος.
Ns Tutorial 成功大學電機所電腦與網路組 博士候選人 柯志亨
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
Wireless and Mobile Computing Simulations Lecture 27.
1 ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides)
1 NS Fundamentals (contd..) Padma Haldar USC/ISI.
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 Tutorial (For CMPE 252 A) By Duy Nguyen 10/25/2012.
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.
NS-2 網路模擬器介紹與使用 吳賢明國立中興大學 計算機及資訊網路中心中華民國九十三年十月二十七日.
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.
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 Modified Schedule Day 2 Network AniMator (nam) Examples simple.tcl mcast.tcl Day 3 Wireless (ad-hoc)
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.
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
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.
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 
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)
Network Simulator Tutorial
Basics of NS-2 Training in TCL script
Speaker Dr. Saloua CHETTIBI Lecturer at University of Jijel
Network Simulators.
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Bluetooth: Tutorial & Simulation
Karthik Sadasivam Banuprasad Samudrala
Ns-3 Tutorial Xin Li.
Presentation transcript:

Introduction to Network Simulator NS-2 Part I King Fahd University of Petroleum and Minerals Computer Engineering Department Introduction to Network Simulator NS-2 Part I Wireless Mobile Ad hoc Networks COE 549 Anas Alroubaiey

Outlines Overview Installation An example Incorporate C++ modules into NS2

Overview: A Study of Computer Networks • Is your proposed solution great? – Experiment: Put all routers together and let people use them (realistic but expensive) – Mathematic model: probability theories, apply numerical methods (too many assumptions) Preferable for simple and small systems – Simulation: Use programming (e.g., C++, java, OPNET or NS2) to represent routers ( cheep and easy)

Overview: NS2 versus OPNET License Needed free open source No Yes documentation A lot Less pre-implemented algorithms & protocols Many Preferable Network operators Network researchers

Network Representation in OPNET and NS2

Overview: Network Simulation 3 simulation main steps: 1. Design • Algorithm • Assumptions • Performance measure 2. Simulation • Network Configuration Phase • Simulation Phase 3. Results • Debugging and Tracing • Compute performance measures

Overview: What is NS2 NS2 = Network Simulator 2 Event driven packet level network simulator Version 1 of NS was developed in 1995 and with version 2 released in 1996. It is an open source software package Available for Windows and Linux platforms Wired and wireless networks

Overview: NS2 Architecture • Consists of – C++: Internal mechanism – OTcl: User interface – TclCL: Connecting C++ to OTcl TCL: Tool Command Language

Overview: NS2 Invocation Syntax >> ns [<filename>] [<args>] - ns is the executable file of NS2 - <filename> = Tcl script file (net. Configurations and scenarios) - In the Tcl file, <args> is stored in the internal variable ( $argv ). Example ns myfirst_ns.tcl –dsr –seed 2

Outlines • Overview • Installation • An Example • Incorporate C++ Modules into NS2

Installation: NS2 1. Go to NS2 web page: – NS2 Webpage: http://www.isi.edu/nsnam/ns/ – Download Link: http://www.isi.edu/nsnam/ns/ns- build.html#allinone1. 2. Get all-in-one package – NS2, Tcl/Tk, OTcl, TclCL – NAM, Zlib, Xgraph

Installation: NS2 3. Unzip all the files 4. Use the installation package “./install” Follow the instruction NS2 is designed for Unix For windows, also install Cygwin Cygwin = Linux emulation for windows

Installation: Cygwin 1. Go to Cygwin Webpage: http://www.cygwin.com/ 2. Get the package 3. Install the basic package 4. Install the following additional packages:

Outlines • Overview • Installation • An Example • Incorporate C++ Modules into NS2

A Network Simulation Example

TCL Simulation Script • Filename “myfirst_ns.tcl” Create a simulator Set ns [new Simulator] Create trace objects # Create a trace file set mytrace [open out.tr w] $ns trace-all $mytrace set myNAM [open out.nam w] $ns namtrace-all $myNAM

Example (cont…) Define a “finish” procedure # Define a procedure finish proc finish { } { global ns mytrace myNAM $ns flush-trace close $mytrace close $myNAM exe nam out.nam & exit 0 }

Example (cont…) Create nodes # Create Nodes set n0 [$ns node]

Example (cont…)

Example (cont…) Connect nodes with “ duplex” links # Connect nodes with links $ns duplex-link $n0 $n2 100Mb 5ms DropTail $ns duplex-link $n1 $n2 100Mb 5ms DropTail $ns duplex-link $n2 $n4 54Mb 10ms DropTail $ns duplex-link $n2 $n3 54Mb 10ms DropTail $ns duplex-link $n3 $n4 10Mb 15ms DropTail $ns queue-limit $n2 $n3 40

Example (cont…)

Example (cont…) Create a flow from n0 to n3 Create UDP flow set udp [new Agent /UDP] $ns attach-agent $n0 $udp set null [new Agent /Null] $ns attach-agent $n3 $null $ns connet $udp $null $udp set fid_ 1 Attach a CBR source to the UDP flow set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set packetSize_ 1000 $cbr set rate_ 2Mb

Example (cont…) Create a flow from n1 to n4 Create a TCP flow set tcp [new Agent/TCP] $ns attach-agent $n1 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n4 $sink $ns connet $tcp $sink $tcp set fid_ 2 Attach an FTP source to the TCP flow Set ftp [new Application/FTP] $ftp attach-agent $tcp

Example (cont…)

Example (cont…) Schedule Events Start Simulation $ns at 0.05 “$ftp start” $ns at 0.1 “$cbr start” $ns at 60.0 “$ftp stop” $ns at 60.5 “$cbr stop” $ns at 61 “finish” Start Simulation $ns run

Trace File: Out.tr

Trace File: Out.tr Identifier Type In post-simulation analysis Four possible events for packets r (received) + (enqueued) - (dequeued) d (dropped) In post-simulation analysis Extract the subset of interest data Analyze it Using AWK language: text files processing language

Outlines • Overview • Installation • An Example • Incorporate C++ Modules into NS2

New Modules Directory structure of NS2 Put the new modules on the same folder where you are working

New Modules New Modules – Need to recompile and links all NEW modules – Use make utility • “Make” contains a set of things that will be done when “make” is executed from the command prompt.

Make Utility • Make usage >> make [-f <filename>] – Executed what specified in filename> – <filename> is called a “file descriptor” – No file is given use file “Makefile” • File descriptor – Syntax <target1> [<target2> …] : [<dep1> <dep2> …] <command> – Targets are remade if any of the dependency is changed – The change is specified in the command.

Makefile for NS2 • Located in ~ns • Key components: – INCLUDES = : Directory – OBJ_CC = : All NS2 object files – NS_TCL_LIB : All NS2 OTcl files • Put your files in these three components

References Textbook: T.Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. Slides in http://www.ece.ubc.ca/~teerawat/NS2.htm http://www.cs.nuim.ie/research/reports/2004/nuim-cs-tr-2004-05.pdf Gilberto, “OPNET Modeler and Ns-2: Comparing the Accuracy Of Network Simulators for Packet- Level Analysis using a Network Testbed”, http://privatewww.essex.ac.uk/~fleum/weas.pdf