(Modified from Polly Huang’s and last year’s original)

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

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.
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.
NS2 Chapter 5. Node A node is an OTcl class, but most of its components are TclObjects. All node contain at least the following components An address.
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.
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.
NS2 Tutorial Aga Zhang Dependable Computing Lab. Outline Introduction Fundamental Skills - Tcl and OTcl Network Simulator - ns-2 Study Project - Mobile.
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 ns-2 Noun Choi Oct. 11, Outline Background ns-2 Internals Short demo Troubleshooting Reference links Q & A.
NS2 Tutorial for CS740 Jianming Wu *modified from Aga Zhang.
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.
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.
1 ns-2 Tutorial Polly Huang AT&T Labs Research 11 August, 1999.
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 
1 Part II: ns Internals. USC INFORMATION SCIENCES INSTITUTE 2 Outline Fundamental concept Split object: C++/OTcl linkage Plumbing Wired Wireless Scaling.
(Tue) 1 Network Simulator 2 - Introduction for Beginners CNLAB ns - 2 seminar.
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
1 NS-2: the network simulator 15 September 2005 Network Lab., SNU Changjee Joo.
© 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.
Overview of VANET Project(2011) on NS2 Perspective Part 1 of 2 Jae-Myeong Lee Human-centric Mobile Computing Lab.
ECE 6610 Sandeep Kakumanu GNAN research Lab
DMET 602: Networks and Media Lab
Network Simulator Tutorial
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Introduction to NS Srinath Perur.
Ns Tutorial: Case Studies
Ns By Kulveer Singh.
Karthik Sadasivam Banuprasad Samudrala
Network Performance modelling and simulation
Introduction to ns-2 Noun Choi Oct. 11, 2007.
Aga Zhang Dependable Computing Lab
Presentation transcript:

(Modified from Polly Huang’s and last year’s original) ns-2 Tutorial Deepak Bansal bansal@mit.edu http://nms.lcs.mit.edu/~bansal 15 September, 2000 (Modified from Polly Huang’s and last year’s original)

Why ns? Ubiquity of Tcl, C, C++ languages Access to source code Discrete event simulator Protocols TCP, UDP, FTP, HTTP, DSR, Wired and wireless media Topology generation Nam visualization tool Standard in research community

What is ns? ns is a language object-oriented tcl (otcl) + extensions for building network simulations. Otcl: object oriented support tclcl: C++ and otcl linkage objects otcl C++ objects Base language Tcl Give an historical perspective? You should probably mention nam here or even on the next page. tclcl ns

nam-1

ns on Athena Sun workstations Accessing the course locker: add 6.899 type “ns” or “nam” at your prompt /mit/6.899/software/ns-allinone-2.1b6/bin runs on Linux platforms only (not on Sun!) on Sun, older version of ns exists in sipbnet. For more information, see course web page.

Tutorial Roadmap Programming in Tcl and Otcl Creating simulations in ns Adding new primitives to ns Tracing

Tcl and Otcl Language Basics

Basic tcl athena% ns % proc occur {value list} { set count 0 % set a 24 % set b 15 % set c [expr $a + $b] % set colors {red green blue purple} % proc occur {value list} { set count 0 foreach el $list { if $el == $value { incr count } return $count % set nblues [occur blue $colors] % puts “I have $nblues blues” I have 1 blues Ask who has ever used Tcl? How many people have ever extended the Tcl interpreter before? I think, give everything with the interpreter. Then mention that, of course, you could put all of these commands together into a file. Pass them to ns and ns will execute them sequentially.

Basic otcl % Class Bagel % Bagel instproc toast {} { .% set abagel [new Bagel] _o11 % $abagel info class Bagel % Bagel info instances % Bagel instproc init {args} { $self instvar toasted_ set toasted_ 0 eval $self next $args } % Bagel instproc toast {} { $self instvar toasted_ incr toasted_ if {$toasted>1} then { error "something's burning!" } return {} % $abagel toast something's burning! May consider adding another slide to this to illustrate superclasses.

Basic ns-2

Creating Event Scheduler Create scheduler set ns [new Simulator] Schedule event $ns at <time> <event> <event>: any legitimate ns/tcl commands Start scheduler $ns run

Creating a Network Nodes Links & Queuing set n0 [$ns node] $ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type> <queue_type>: DropTail, RED, CBQ, FQ, SFQ, DRR

Creating a simple simulation # Create a topology Set ns [new Simulator] set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail # Add agents set tcp [$ns create-connection Agent/TCP $n0 Agent/TCPSink $n1 0] set ftp [$tcp attach-app FTP] # Create a schedule $ns at 0.5 "$ftp start" $ns at 4.5 "$ftp stop" #Run the simulation $ns run FTP TCP FTP How are you going to fit this whole thing onto one slide? Consider making one slide for the topology, one time to schedule the events. TCP 1Mb n0 n1 10ms

ns-2 Internal

Routing n0 n1 1 1 Addr Classifier Port Classifier classifier_ dmux_ entry_ Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 1 Link n0-n1 Link n1-n0

Transport n0 n1 1 1 Port Classifier Port Classifier dst_=1.0 dst_=0.0 Addr Classifier Agent/TCP Addr Classifier Agent/TCPSink agents_ agents_ 1 1 dmux_ dmux_ Link n0-n1 entry_ entry_ classifier_ classifier_ Link n1-n0

Application n0 n1 1 1 Port Classifier Application/FTP Port Classifier dst_=1.0 dst_=0.0 Addr Classifier Agent/TCP Addr Classifier Agent/TCPSink agents_ agents_ 1 1 dmux_ dmux_ Link n0-n1 entry_ entry_ classifier_ classifier_ Link n1-n0

Packet Flow n0 n1 1 1 Port Classifier Application/FTP Port Classifier dst_=1.0 dst_=0.0 Addr Classifier Agent/TCP Addr Classifier Agent/TCPSink 1 1 Link n0-n1 entry_ entry_ Link n1-n0

Extending ns-2 Simulator

otcl and C++: The Duality C++ for data per packet action otcl for control periodic or triggered action

Adding New Classes variables procedures New Class otcl New Class bind() command() otcl TclClass() New Class variables procedures C++

TclClass TclObject Agent Agent/FBI FBIAgent NsObject ?? OTcl C++ mirroring Static class FBIClass : public TclClass { public: FBIClass() : TclClass(“Agent/FBI”) {} TclObject* create(int, const char*const*) { return (new FBIAgent()); } } class_fbi;

TclObject: bind() C++ otcl FBIAgent::FBIAgent() { } bind(“age_”, age_); … } otcl Agent/FBI set age_ 10

TclObject: command() C++ otcl Int FBIAgent::command(int argc, const char*const* argv) { if (argc == 3) { if (strcomp(argv[1], “mature”) == 0) { age_ += atoi(argv[2]); … return(TCL_OK); } return (Agent::command(argc, argv); otcl set mulder [new Agent/FBI] $mulder mature 20

Tracing Trace all packets on all links $ns trace-all [open out.w w] <event> <time> <from> <to> <pkt> <size> - - <flowid> <src> <dst> <seqno> <aseqno> Trace all packets on all links in nam-1 format $ns namtrace-all [open out.w w]