5-Jul-141 S.Pushpalatha, Associate Professor, PSNACET.

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.
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 παρουσίαση Κων/νος Τρούλος.
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
Wireless and Mobile Computing Simulations Lecture 27.
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.
NS-2 網路模擬器介紹與使用 吳賢明國立中興大學 計算機及資訊網路中心中華民國九十三年十月二十七日.
How to Add a New Protocol in NS2 Xu Leiming CSCW Lab. at CS Dept., Tsinghua Univ. June 1, 2001.
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.
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.
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)
EECS122 - UCB1 Measurements and Modeling Table of Contents 1. Measurements Measurements 2. Modeling and its Shortcomings Modeling and its Shortcomings.
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.
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.
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)
Network Simulator Tutorial
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Introduction to NS Srinath Perur.
Ns By Kulveer Singh.
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

5-Jul-141 S.Pushpalatha, Associate Professor, PSNACET

What is ns? Object-oriented, discrete event-driven network simulator Written in C++ and OTcl By VINT: Virtual InterNet Testbed 5-Jul-142 S.Pushpalatha, Associate Professor, PSNACET

Extending ns – In OTcl – In C++ TK8.0OTcltclclTcl8.0ns-2nam-1 tcl extest lib... examples validation tests C++ code OTcl code ns-allinone mcast 5-Jul-143 S.Pushpalatha, Associate Professor, PSNACET

ns Architecture Separate data path and control path implementations. 5-Jul-144 S.Pushpalatha, Associate Professor, PSNACET

Hello World – Interactive mode bash-shell$ ns % set ns [new Simulator] _o3 % $ns at 1 “puts \“Hello World!\”” 1 % $ns at 1.5 “exit” 2 % $ns run Hello World! bash-shell$ 5-Jul-145 S.Pushpalatha, Associate Professor, PSNACET

Hello World – Batch mode simple.tcl set ns [new Simulator] $ns at 1 “puts \“Hello World!\”” $ns at 1.5 “exit” $ns run bash-shell$ ns simple.tcl Hello World! bash-shell$ 5-Jul-146 S.Pushpalatha, Associate Professor, PSNACET

Basic Tcl: ex-tcl.tcl 5-Jul-147 S.Pushpalatha, Associate Professor, PSNACET

Basic OTcl Class Mom Mom instproc greet {} { $self instvar age_ puts “ $age_ years old mom: How are you doing? ” } Class Kid -superclass Mom Kid instproc greet {} { $self instvar age_ puts “ $age_ years old kid: What ’ s up, dude? ” } set mom [new Mom] $mom set age_ 45 set kid [new Kid] $kid set age_ 15 $mom greet $kid greet 5-Jul-148 S.Pushpalatha, Associate Professor, PSNACET

NS-2 Generic Script Structure 1.Create Simulator object 2.Turn on tracing 3.Create topology 4.Setup packet loss, link dynamics 5.Create routing agents 6.Create application and/or traffic sources 7.Post-processing procedures (i.e. nam) 8.Start simulation 5-Jul-149 S.Pushpalatha, Associate Professor, PSNACET

Step1: Create Simulator Object Create event scheduler set ns [new Simulator] 5-Jul-1410 S.Pushpalatha, Associate Professor, PSNACET

Step2: Tracing Insert immediately after scheduler! Trace packets on all links set nf [open out.nam w] $ns namtrace-all $nf set nt [open out1.tr w] $ns trace-all $nt 5-Jul-1411 S.Pushpalatha, Associate Professor, PSNACET

Step2: Tracing 5-Jul-1412 S.Pushpalatha, Associate Professor, PSNACET

Step 3: Create network  Two nodes, One link n1 n0 5-Jul-1413 S.Pushpalatha, Associate Professor, PSNACET

Step 3: Create Network Nodes – set n0 [$ns node] – set n1 [$ns node] Links and queuing – $ns duplex-link $n0 $n1 1Mb 10ms RED – $ns duplex-link $n0 $n1 – : DropTail, RED, etc. n1 n0 5-Jul-1414 S.Pushpalatha, Associate Professor, PSNACET

Creating a larger topology for {set i 0} {$i < 7} {incr i} { set n($i) [$ns node] } for {set i 0} {$i < 7} {incr i} { $ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms RED } 5-Jul-1415 S.Pushpalatha, Associate Professor, PSNACET

Step 4: Network Dynamics Link failures – Hooks in routing module to reflect routing changes $ns rtmodel-at up|down $n0 $n1 For example: $ns rtmodel-at 1.0 down $n0 $n1 $ns rtmodel-at 2.0 up $n0 $n1 5-Jul-1416 S.Pushpalatha, Associate Professor, PSNACET

Step 5: Creating UDP connection set udp [new Agent/UDP] set null [new Agent/Null] $ns attach-agent $n0 $udp $ns attach-agent $n1 $null $ns connect $udp $null n1 n0 udp null 5-Jul-1417 S.Pushpalatha, Associate Professor, PSNACET

Step 6: Creating Traffic (On Top of UDP) CBR – set cbr [new Application/Traffic/CBR] – $cbr set packetSize_ 500 – $cbr set interval_ – $cbr attach-agent $udp n1 n0 udp cbr null 5-Jul-1418 S.Pushpalatha, Associate Professor, PSNACET

Creating TCP connection set tcp [new Agent/TCP] set tcpsink [new Agent/TCPSink] $ns attach-agent $n0 $tcp $ns attach-agent $n1 $tcpsink $ns connect $tcp $tcpsink n1 n0 tcp sink 5-Jul-1419 S.Pushpalatha, Associate Professor, PSNACET

Step 6: Creating Traffic (On Top of TCP) FTP – set ftp [new Application/FTP] – $ftp attach-agent $tcp Telnet – set telnet [new Application/Telnet] – $telnet attach-agent $tcp n1 n0 tcp ftp sink 5-Jul-1420 S.Pushpalatha, Associate Professor, PSNACET

Post-Processing Procedures Add a 'finish' procedure that closes the trace file and starts nam. proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } 5-Jul-1421 S.Pushpalatha, Associate Professor, PSNACET

Run Simulation Schedule Events $ns at – : any legitimate ns/tcl commands $ns at 0.5 "$cbr start" $ns at 4.5 "$cbr stop “ Call ‘finish’ $ns at 5.0 "finish" Run the simulation $ns run 5-Jul-1422 S.Pushpalatha, Associate Professor, PSNACET

Recall: Generic Script Structure 1.set ns [new Simulator] 2.[Turn on tracing] 3.Create topology 4.[Setup packet loss, link dynamics] 5.Create routing agents 6.Create application and/or traffic sources 7.Post-processing procedures (i.e. nam) 8.Start simulation Examples 5-Jul-1423 S.Pushpalatha, Associate Professor, PSNACET

Visualization Tools nam-1 (Network AniMator Version 1) – Packet-level animation – Well supported by ns xgraph – Simulation results 5-Jul-1424 S.Pushpalatha, Associate Professor, PSNACET

5-Jul-1425 S.Pushpalatha, Associate Professor, PSNACET

nam Interface: Nodes Color $node color red Shape (can’t be changed after sim starts) $node shape box (circle, box, hexagon) Label (single string) $ns at 1.1 “ $n0 label \ ” web cache 0\ ”” 5-Jul-1426 S.Pushpalatha, Associate Professor, PSNACET

nam Interfaces: Links Color $ns duplex-link-op $n0 $n1 color "green" Label $ns duplex-link-op $n0 $n1 label “ backbone" 5-Jul-1427 S.Pushpalatha, Associate Professor, PSNACET

nam Interface: Topology 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 5-Jul-1428 S.Pushpalatha, Associate Professor, PSNACET

Simulation Example 5-Jul-1429 S.Pushpalatha, Associate Professor, PSNACET

OTcl and C++: The Duality C++ OTcl Pure C++ objects Pure OTcl objects C++/OTcl split objects ns 5-Jul-1430 S.Pushpalatha, Associate Professor, PSNACET

TclObject: Hierarchy and Shadowing TclObject Agent Agent/TCP Agent/TCP OTcl shadow object _o123 Agent/TCP C++ object *tcp TclObject Agent TcpAgent OTcl class hierarchy C++ class hierarchy 5-Jul-1431 S.Pushpalatha, Associate Professor, PSNACET

Extending ns in OTcl If you don’t want to compile – source your changes in your sim scripts Modifying exisiting code – Recompile Adding new files – Change Makefile (NS_TCL_LIB), – Update tcl/lib/ns-lib.tcl – Recompile 5-Jul-1432 S.Pushpalatha, Associate Professor, PSNACET

Extending ns in C++ Modifying code – `make depend` – Recompile Adding code in new files – Change Makefile – `make depend` – Recompile 5-Jul-1433 S.Pushpalatha, Associate Professor, PSNACET

OTcl Linkage Lets create a new agent “MyAgent” – Dummy agent – Derived from the “Agent” class 5-Jul-1434 S.Pushpalatha, Associate Professor, PSNACET

Step 5: Compile Save above code as “ ex-linkage.cc ” Open " Makefile ", add " ex-linkage.o " at the end of object file list. Re-compile NS using the " make " command. 5-Jul-1435 S.Pushpalatha, Associate Professor, PSNACET