Dongsoo S. Kim 1.

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.
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.
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)
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-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.
NS TUTORIAL Padma Haldar USC/ISI 09/04/02.
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.
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
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.
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.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_b Protocol Layering Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof.
Network Simulator-2 Sandeep singla 1998A2A7540. NS-2 A discrete event simulator Focused on modeling network protocols –Wired, wireless –TCP,UDP,unicast,multicast.
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 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 Simulation Motivation: r learn fundamentals of evaluating network performance via simulation Overview: r fundamentals of discrete event simulation.
Network Simulator Tutorial Wireless Networks. Acknowledgements Material is taken from the presentations by Jim Kurose, University of Massachusetts, Amherst.
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.
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)
Simulators for Sensor Networks
Mobicom ‘99 Per Johansson, Tony Larsson, Nicklas Hedman
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
NS2 (and possible directions for mobile routing simulation) Kevin Fall
Introduction to NS Srinath Perur.
Ns By Kulveer Singh.
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

Dongsoo S. Kim 1

 Support networking research and education ◦ Protocol design, traffic studies, etc ◦ Protocol comparison  Provide a collaborative environment ◦ Freely distributed, open source  Share code, protocols, models, etc ◦ Allow easy comparison of similar protocols ◦ Increase confidence in results  More people look at models in more situations  Experts develop models  Multiple levels of detail in one simulator 2

 Wired world ◦ Routing DV, LS, PIM-SM ◦ Transport: TCP and UDP ◦ Traffic sources: web, ftp, telnet, cbr, stochastic ◦ Queuing disciplines:drop-tail, RED, FQ, SFQ, DRR ◦ QoS: IntServ and Diffserv ◦ Emulation  Wireless ◦ Ad hoc routing and mobile IP ◦ Directed diffusion, sensor-MAC  Tracing, visualization, various utilities 3

 Ns, the simulator itself  Nam, the network animator ◦ Visualize ns (or other) output ◦ Nam editor: GUI interface to generate ns scripts  Pre-processing: ◦ Traffic and topology generators  Post-processing: ◦ Simple trace analysis, often in Awk, Perl, Tcl, Matlab, C, or your choice 4

 Traffic models and applications: ◦ Web, FTP, telnet, constant-bit rate, real audio  Transport protocols: ◦ unicast: TCP (Reno, Vegas, etc.), UDP ◦ Multicast: SRM  Routing and queueing: ◦ Wired routing, ad hoc rtg and directed diffusion ◦ queueing protocols: RED, drop-tail, etc  Physical media: ◦ Wired (point-to-point, LANs), wireless (multiple propagation models), satellite 5

 A discrete time event-driven simulator ◦ Simple model  Focused on modeling network protocols ◦ Wired, wireless, satellite ◦ TCP, UDP, multicast, unicast ◦ Web, telnet, ftp ◦ Ad hoc routing, sensor networks ◦ Infrastructure: stats, tracing, error models, etc 6

 Model world as events ◦ Simulator has list of events in a queue ordered on time ◦ Process: take next one, run it, until the queue is empty ◦ Each event happens in an instant of virtual (simulated) time, but takes an arbitrary amount of real time  Ns uses simple model ◦ single thread of control  no locking or race conditions ◦ No parallelization results in a long simulation time 7

 Two nodes on a Ethernet 8 AB Simple queuing model: LAN dequeues the pkt and triggers B Detailed CSMA/CD model: B’s NIC concludes pkt. B’s NIC passes pkt to app A enqueues a pkt on LAN A sends pkt to NIC. A’s NIC starts carrier sense A’s NIC concludes CS, starts TX B’s NIC begins receiving the pkt

 Object-oriented (C++, OTcl)  Modular approach ◦ Fine-grained object composition + Reusability + Maintenance – Performance (speed and memory) – Careful planning of modularity 9

 “data” / control separation ◦ C++ for “data”:  per packet processing, core of ns  fast to run, detailed, complete control ◦ OTcl for control:  Simulation scenario configurations  Periodic or triggered action  Manipulating existing C++ objects  fast to write and change + running vs. writing speed – Learning and debugging (two languages) 10

 OTcl (object variant of Tcl) and C++ share class hierarchy  TclCL is glue library that makes it easy to share functions, variables, etc 11 C++ otcl C++/OTcl split objects

Class Person # constructor: Person instproc init {age} { $self instvar age_ set age_ $age } # method: Person instproc greet {} { $self instvar age_ puts “$age_ years old: How are you doing?” } # subclass: Class Kid -superclass Person Kid instproc greet {} { $self instvar age_ puts “$age_ years old kid” } set a [new Person 45] set b [new Kid 15] $a greet $b greet 12 can easily make variations of existing things (TCP, TCP/Reno)

 Class Tcl: instance of OTcl interpreter Tcl& tcl = Tcl::instance(); tcl.evalc(“puts stdout hello world”); tcl.result() and tcl.error  Class TclObject and TclClass ◦ Variable bindings bind(“rtt_”, &t_rtt_) ◦ Invoking command method in shadow class $tcp advanceby 10 13

 Some important objects: ◦ NsObject: has recv() method ◦ Connector: has target() and drop() ◦ BiConnector: uptarget() & downtarget() 14

15 Problem Simulation model Setup/run simulation with ns Result analysis Modify ns

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

 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 17

 Event: at-event and packet  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” 18

19 Discreate Event Scheduler time_, uid_, next_, handler_ head_ -> handler_ -> handle() time_, uid_, next_, handler_ insert head_ ->

20 Hello World – Example Interactive mode: vlsi:~ > ns % set ns [new Simulator] _o3 % $ns at 1 “puts \“Hello World!\”” 1 % $ns at 1.5 “exit” 2 % $ns run Hello World! vlsi:~ > Batch mode: vlsi:~ > simple.tcl set ns [new Simulator] $ns at 1 “puts \“Hello World!\”” $ns at 1.5 “exit” $ns run vlsi:~ > ns simple.tcl Hello World! vlsi:~ >

 Packet tracing: ◦ On all links: $ns trace-all [open out.tr w] ◦ On one specific link: $ns trace-queue $n0 $n1$tr cbr cbr r cbr ◦ a new trace format is available as well.  Event tracing (support TCP right now) ◦ Record “event” in trace file: $ns eventtrace-all E TCP slow_start

 Queue monitor set qmon [$ns monitor-queue $n0 $n1 $q_f $sample_interval] ◦ Get statistics for a queue $qmon set pdrops_ ◦ Record to trace file as an optional  Flow monitor set fmon [$ns_ makeflowmon Fid] $ns_ attach-fmon $slink $fmon $fmon set pdrops_ 22

 Visualize trace in nam $ns namtrace-all [open test.nam w] $ns namtrace-queue $n0 $n1  Variable tracing in nam Agent/TCP set nam_tracevar_ true $tcp tracevar srtt_ $tcp tracevar cwnd_  Monitor agent variables in nam $ns add-agent-trace $tcp $tcp $ns monitor-agent-trace $tcp $srm0 tracevar cwnd_ …… $ns delete-agent-trace $tcp 23

 Nodes set n0 [$ns node] set n1 [$ns node]  Links and queuing $ns $n0 $n1  : duplex-link, simplex-link  : DropTail, RED, CBQ, FQ, SFQ, DRR, diffserv RED queues 24

$ns make-lan : LL : Queue/DropTail, : MAC/802_3 : Channel 25

 Unicast $ns rtproto : Static, Session, DV, cost, multi-path  Multicast (right after [new Simulator]) $ns mrtproto$ns multicast : CtrMcast, DM, ST, BST  Other types of routing supported: source routing, hierarchical routing 26

 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 27

 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 [ ] 28

 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/Exponential] set src [new Application/Traffic/Pareto] 29

 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 30

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

 Features ◦ Build on top of existing transport protocol ◦ Transmit user data, e.g., HTTP header  Two different solutions ◦ TCP: Application/TcpApp ◦ UDP: Agent/Message 32

 More abstract (much simpler): ◦ No addresses, just global variables ◦ Connect them rather than name lookup/bind/listen/accept  Easy to change implementation Set tsrc2 [new agent/TCP/Newreno] Set tsrc3 [new agent/TCP/Vegas] 33

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 34

 Color  Node manipulation  Link manipulation  Topology layout  Protocol state  Misc 35

 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 36

 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\”” 37

 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  Asymmetric links not allowed 38

 “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 39

 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" 40

 Getting the pieces ◦ Tcl/TK 8.x (8.3.2 preferred): ◦ Otcl and TclCL: ◦ ns-2 and nam-1:  Other utilities ◦ ◦ Tcl-debug, GT-ITM, xgraph, … ◦ Trgraph: available at ~dskim/share/Tracegraph205_unix.tar 41

 Ns and nam build questions ◦  Ns mailing list:  Ns manual and tutorial (in distribution)  TCL:  Otcl tutorial (in distribution): ftp://ftp.tns.lcs.mit.edu/pub/otcl/doc/tutor ial.html ftp://ftp.tns.lcs.mit.edu/pub/otcl/doc/tutor ial.html 42