NS-2 Shahin Shayandeh December 2004 Session 2. Ns programming  Create the event scheduler  Turn on tracing  Create network  Setup routing  Insert.

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.
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.
1 Multicast in ns-2 報告者 : 陳沐恩. 2 Multicast 簡介 3 Multicast Routing set ns [new Simulator] $ns multicast Or set ns [new Simulator – multicast on] set mproto.
Wireless Communication : LAB 3
NS-2 (network simulator) NS by example παρουσίαση Κων/νος Τρούλος.
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
Introduction to Network Simulator NS-2 Part I
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.
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.
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.
Dongsoo S. Kim 1.
NS TUTORIAL Padma Haldar USC/ISI 09/04/02.
1 ns-2 for Multicast Research Polly Huang AT&T Labs Research 12 August, 1999.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2003) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
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,
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.
Introduction to NS2 -Network Simulator- -Prepared by Changyong Jung.
1 Introduction to Ns-2 Zhibin WU WINLAB, ECE Dept. Rutgers U.
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 
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.
NS-2 Shahin Shayandeh December 2004 Session 1. Ns-2, the Network Simulator  A discrete event simulator Simple model  Focused on modeling network protocols.
Applications and transport agent API 許庭瑋.
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.
DMET 602: Networks and Media Lab
(Modified from Polly Huang’s and last year’s original)
Network Simulator Tutorial
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
NS2 (and possible directions for mobile routing simulation) Kevin Fall
Ns Tutorial: Case Studies
Ns By Kulveer Singh.
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

NS-2 Shahin Shayandeh December 2004 Session 2

Ns programming  Create the event scheduler  Turn on tracing  Create network  Setup routing  Insert errors  Create transport connection  Create traffic  Transmit application-level data

Creating Event Scheduler  Create event scheduler set ns [new Simulator]  Schedule events $ns at : any legitimate ns/tcl commands $ns at 5.0 “finish”  Start scheduler $ns run  Simulator User Interface Simulator instproc now # return scheduler's notion of current time Simulator instproc at args # schedule execution of code at specified time Simulator instproc at-now args # schedule execution of code at now Simulator instproc after n args # schedule execution of code after n secs Simulator instproc run args # start scheduler Simulator instproc halt # stop (pause) scheduler

Event Scheduler  Real-time, non-real-time  List scheduler: default Heap and calendar queue scheduler  Real-time scheduler Synchronize with real-time Network emulation set ns_ [new Simulator] $ns_ use-scheduler Heap $ns_ at “$self halt”

Discrete Event Scheduler

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

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 Dynamics  Link failures Hooks in routing module to reflect routing changes  Four models $ns rtmodel Trace $n0 $n1 $ns rtmodel Exponential { } $n0 $n1 $ns rtmodel Deterministic { } $n0 $n1 $ns rtmodel-at up|down $n0 $n1 Parameter list [ ] [ ] $ns rtmodel Deterministic { } $n0 $n1

Creating Connection and Traffic  UDP set udp [new Agent/UDP] set null [new Agent/Null] $ns attach-agent $n0 $udp $ns attach-agent $n1 $null $ns connect $udp $null  CBR set src [new Application/Traffic/CBR]  Exponential or Pareto on-off set src [new Application/Traffic/Exponenti al] set src [new Application/Traffic/Pareto]

Creating Connection and Traffic II  TCP set tcp [new Agent/TCP] set tcpsink [new Agent/TCPSink] $ns attach-agent $n0 $tcp $ns attach-agent $n1 $tcpsink $ns connect $tcp $tcpsink  FTP set ftp [new Application/FTP] $ftp attach-agent $tcp  Telnet set telnet [new Application/Telnet] $telnet attach-agent $tcp

Creating Traffic: Trace Driven  Trace driven set tfile [new Tracefile] $tfile filename set src [new Application/Traffic/Trace] $src attach-tracefile $tfile :  Binary format (native!)  inter-packet time (msec) and packet size (byte)

Summary: Generic Script Structure set ns [new Simulator] # [Turn on tracing] # Create topology # Setup packet loss, link dynamics # Create routing agents # Create: # - multicast groups # - protocol agents # - application and/or setup traffic sources # Post-processing procs # Start simulation

ns  nam Interface  Color  Node manipulation  Link manipulation  Topology layout  Misc

nam Interface: Color  Color mapping $ns color 40 red $ns color 41 blue $ns color 42 chocolate  Color  flow id association $tcp0 set fid_ 40;# red packets $tcp1 set fid_ 41;# blue packets

nam Interface: Nodes  Color $node color red  Shape (can’t be changed after sim starts) $node shape box;# circle, box, hexagon  Marks (concentric “shapes”) $ns at 1.0 “$n0 add-mark m0 blue box” $ns at 2.0 “$n0 delete-mark m0”  Label (single string) $ns at 1.1 “$n0 label \”web cache 0\””

nam Interfaces: Links  Color $ns duplex-link-op $n0 $n1 color "green"  Label $ns duplex-link-op $n0 $n1 label "abced"  Dynamics (automatically handled) $ns rtmodel Deterministic { } $n0 $n1

nam Interface: Topo Layout  “Manual” layout: specify everything $ns duplex-link-op $n(0) $n(1) orient right $ns duplex-link-op $n(1) $n(2) orient right $ns duplex-link-op $n(2) $n(3) orient right $ns duplex-link-op $n(3) $n(4) orient 60deg  If anything missing  automatic layout

nam Interface: Misc  Annotation Add textual explanation to your simulation $ns at 3.5 "$ns trace-annotate \“packet drop\"“  Set animation rate $ns at 0.0 "$ns set-animation-rate 0.1ms"