Internet Computing KUT Youn-Hee Han

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 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.
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)
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.
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)
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.
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 - Wireless Network Ming-Feng Yang. 2 2 Outline Basic wireless model Extensions wireless model Example - Ad hoc network Example – WLAN Example – Mobile.
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.
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.
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-2 Tutorial Haobo Yu, Nader Salehi USC/ISI
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.
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
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.
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)
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:

Internet Computing Laboratory @ KUT Youn-Hee Han NS2 Tutorial – Part I Internet Computing Laboratory @ KUT Youn-Hee Han

VINT and NS (Network Simulator) Virtual InterNet Testbed a collaborative project between USC/ISI, LBL/UC Berkeley, and Xerox PARC Goal to extend the ns simulator so that network researchers can study the complex interactions between network protocols (e.g., unicast routing, multicast routing, TCP, reliable multicast, integrated services, etc.) in complex topologies and with a rich set of traffic generators. ISI/USC: University of Southern California/Information Sciences Institute LBL/UC Berkeley: Lawrence Berkeley National Laboratory/University of California, Berkeley Data Structure

What is NS? http://www.isi.edu/nsnam NS version2 is a discrete-event driven and object-oriented network simulator Events  Packet and Timer Characteristics Freely distributed and open source Discrete event simulator Packet-level Event Wired and wireless Network Stacks from Layer 1 to Layer 7 Node mobility Data Structure

What is NS? History Columbia NEST UCB REAL ns-1 ns-2 100K lines of C++ Modified from REAL network simulator ns-2 100K lines of C++ 70K lines of OTcl 30K lines of test suite 20K lines of documentation Data Structure

Functionality of NS Wired world Wireless Point-to-point link, LAN Unicast/multicast routing QoS Intserve, Diffserv Transport TCP, UDP Congestion control Application layer Web Caching Mulimedia Wireless Mobile IP Ad hoc routing Tracing, visualization, various utilities Data Structure

NS Flatform Most UNIX and UNIX-like systems Window 95/98/NT Linux It is preferred Remote access with Xmanager FreeBSD or NetBSD Sun Solaris Window 95/98/NT with Cygwin Some of features are not supported Emulation only for FreeBSD for now VMWare Window host Linux guest Data Structure

NS Components ns-2 nam NS – Simulator NAM – Network AniMator visual demonstration of NS output Preprocessing Handwritten TCL or Topology generator Post analysis Trace analysis using Perl/TCL/AWK/GnuProt/MATLAB We just saw this… Now I will show you this… tcl script (specification of experiment) ns-2 trace file (output) nam Data Structure

Current Status Users from approximately Releases 600 institutes 50 countries Releases Periodic releases (currently 2.29_3) NS3 project just started (July 1, 2006) Available from: USC (University of Southern California)/ISI (Information Sciences Institute), UC Berkeley, UK mirror Data Structure

NS2 Language NS2 is written in C++ and OTcl OTcl = Tcl + OO C++ implements the code that executed frequently It implements the system behavior of NS2 (e.g., routing) OTcl configures the system (e.g., topology). Object-oriented (C++, OTcl) Fine-grained object composition Modular approach Data Structure

C++ and OTcl Separation C++ for “data/behavior” NS2 Core & packet processing Fast Execution Good for… Frequent Access & Less Compilation OTcl for “control” Periodic or triggered action Simulation Scenario setup Less Access & Frequent Configuration Pros. Compromise between composibility and speed Cons. Learning and debugging Data Structure

OTcl and C++: The Duality Pure C++ objects Pure OTcl objects C++/OTcl split objects C++ OTcl ns Data Structure

OTcl and C++: The Duality Simulation Scenario 1 2 set ns_ [new Simulator] set node_(0) [$ns_ node] set node_(1) [$ns_ node] Tcl Script class MobileNode : public Node { friend class PositionHandler; public: MobileNode(); • } C++ Implementation Data Structure

Object Correspondence Agent/DSDV Constructor Agent Constructor Invoke parent TclObject Constructor Invoke parent AgentDSDV() Constructor Create C++ init complete init complete OTcl shadow TCL C++ TclObject() Constructor Invoke parent Do nothing, return Agent() Constructor Invoke parent bind and return bind and return Data Structure

User’s Perspective From the user’s perspective, NS−2 is an OTcl interpreter that takes an OTcl script as input and produces a trace file as output Data Structure

Extending Tcl Interpreter Otcl object-oriented Tcl TclCL (Tcl with classes) C++ and OTcl linkage Discrete event scheduler Data network components Link layer and up Emulation support Event Scheduler Network Components TclCL OTcl Tcl C/C++ ns-2 Data Structure

Discrete event simulator ns-2 is an discrete event driven simulation Physical activities are translated to events Events are queued and processed in the order of their scheduled occurrences Time progresses as the events are processed Time: 1.5 sec Time: 1.7 sec 1 2 Time: 2.0 sec Time: 1.8 sec Data Structure

Using NS2 Problem Result Simulation Modify analysis model ns Setup/run with ns Data Structure

OTcl overview programming language used for setting up simulation environment object oriented interpreted (slow) Used for Setting up topology Placing agents Injecting events Configuring tracing Examples: variables set x 10 puts “x is $x” expressions set y [pow x 2] set y [expr x+x*3] control if ($x>0) { return $x } else { return [expr -$x] } while ($x >0) { puts $x set x [eval x+1] } Data Structure

OTcl overview programming language used for setting up simulation environment object oriented interpreted (slow) Used for Setting up topology Placing agents Injecting events Configuring tracing Examples: variables set x 10 puts “x is $x” expressions set y [pow x 2] set y [expr x+x*3] control if ($x>0) { return $x } else { return [expr -$x] } while ($x >0) { puts $x set x [eval x+1] } Data Structure

Basic ns-2 Create scheduler Create node Create link Schedule event set ns [new Simulator] Create node set <var> [$ns node] example: set n0 [$ns node] Create link $ns <link-type> <node1> <node2> <bandwidth> <delay> <queuetype> example: $ns duplex-link $n0 $n1 10Mb 100ms DropTail Schedule event $ns at <time> <event> example: $ns at 10.0 “$ftp start” Start scheduler $ns run Data Structure

The 1st ns-2 script (two nodes, one link) set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } $ns at 5.0 "finish" $ns run Create the simulator object Open a file for nam trace data “finish” procedure Closes the trace file and starts nam Execute the finish procedure after 5.0 seconds Data Structure

The 1st ns-2 script (two nodes, one link) set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail Creates two nodes and assigns them to the handle “n0” and “n1” connect the nodes n0 and n1 with a duplex link with the bandwidth 1Megabit, a delay of 10ms and a DropTail queue Data Structure

The 1st ns-2 script (two nodes, one link) set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 set null0 [new Agent/Null] $ns attach-agent $n1 $null0 $ns connect $udp0 $null0 Create a UDP agent and attach it to node n0 Create a CBR traffic source and attach it to udp0 Create a Null agent and attach it to node n1 Connect the two agents Data Structure

The 1st ns-2 script (two nodes, one link) $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop" tell the CBR agent when to send data and when to stop sending Data Structure

The 2nd ns-2 script (three nodes, two links) set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } $ns at 10.0 "finish" $ns run Create the simulator object Open a file for nam trace data “finish” procedure Closes the trace file and starts nam Execute the finish procedure after 10.0 seconds Data Structure

The 2nd ns-2 script (three nodes, two links) Creates three nodes and assigns them to the handle “n0”, “n1”, and “n1” #Create three nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] #Create link between the nodes $ns duplex-link $n0 $n1 4Mb 10ms DropTail $ns duplex-link $n2 $n1 1Mb 10ms DropTail $ns queue-limit $n1 $n2 10 connect the nodes n0 and n1 with a duplex link with the bandwidth 4Megabit, a delay of 10ms and a DropTail queue connect the nodes n0 and n2 with a duplex link with the bandwidth 1Megabit, a delay of 10ms and a DropTail queue the maximum buffer size (#packets) of the queue in the link n0 n1 n2 Data Structure

The 2nd ns-2 script (three nodes, two links) #Create a TCP agent and attach it to node n0 set tcp0 [new Agent/TCP] $ns attach-agent $n0 $tcp0 #Create a TCP sink agent and attach it to node n2 set sink [new Agent/TCPSink] $ns attach-agent $n2 $sink #Connect both agents $ns connect $tcp0 $sink # create an FTP source set ftp [new Application/FTP] $ftp set maxpkts_ 1000 $ftp attach-agent $tcp0 #Inject starting events $ns at 0.0 "$ftp start" $ns at 10.0 "$ftp stop" $ns at 10.1 "finish" #Run the simulation $ns run Create a TCP agent and attach it to node n0 Create a TCP sink and attach it to node n2 Connect the two agents Create a FTP application and attach it to agent tcp0 The maximum number of packets generated by the source. ftp tcp tcp-sink n0 n1 n2 Data Structure