Mohammad Hossein Manshaei 1393

Similar documents
Network Simulator 2. Telematica I (CdL Ing. INF) Ing. Giuseppe Piro.

DMN1 : COMMUNICATION PROTOCOL SIMULATION. Faculty of Engineering Multimedia University

John Heidemann, USC/ISI and Polly Huang, ETH-Zurich 14 March 2002

Simulations: ns2 simulator part I a

The Network Simulator Fundamentals. Downloads and further info at:

Network Simulator 2: Introduction

PART A SIMULATION EXERCISES

An Introduction to NS-2

Part 3: Network Simulator 2

EE 122: Computer Networks Network Simulator ns2

Introduction. Ns Tutorial Ns Goals. SAMAN and CONSER Projects. Ns Status. Ns functionalities

Network Simulator 2. Reti di Telecomunicazioni (CdL Ing. TLC) Telematica I (CdL Ing. INF) Ing. Carla Passiatore.

CDA6530: Performance Models of Computers and Networks. Chapter 10: Introduction to Network Simulator (NS2)

Eexercise5: How to do Data Transmission between Nodes Using TCP in NS2

Tutorial Schedule. Introduction Ns fundamentals Ns programming internal Extending ns-2 Simulator. Sep. 25,

Network Simulator 2 (NS2)

Part 6. Confidence Interval

Modeling of data networks by example: ns-2 (I)

REVA INSTITUTE OF TECHNOLOGY AND MANAGEMENT. Kattigenahalli, Jala Hobli, Yelahanka, Bangalore

Part 5. Wireless Network

Simple Data Link Protocols

Simulation with NS-2 and CPN tools. Ying-Dar Lin Department of Computer Science, National Chiao Tung University

FACULTY OF ENGINEERING

ns-2 Tutorial Exercise (1)

Comparing ad-hoc wireless to wiredwireless

Part 3. Result Analysis

S Quality of Service in Internet. Introduction to the Exercises Timo Viipuri

S Ns2 simulation exercise

Brief Overview and Background

The Transport Control Protocol (TCP)

NS-2 Tutorial. Kumar Viswanath CMPE 252a.

Project Network Simulation CSE 5346/4346

ANALYSIS OF SMART DEVICE GAME PROTOCOL

ns-2 Tutorial Contents: Today Objectives of this week What is ns-2? Working with ns-2 Tutorial exercise ns-2 internals Extending ns-2

1 What is network simulation and how can it be useful?

Analysis and Performance Evaluation of Routing Protocols in MANETS

S Ns2 simulation exercise

IJESRT INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY INVESTIGATION ON THE INTERNET OF THINGS Jin Wang *, Yi bin Hou *

USE OF THE NETWORK SIMULATOR NS-2 TOOL IN LECTURES

ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1

Flow Control Packet Marking Scheme: to identify the sources of Distributed Denial of Service Attacks

Wireless Networks - Preliminaries

Babak Shahabi ( ), Shaoyun Yang ( ) Team # 7

Executive Overview. D1.3.2-VanetMobiSim/Ns-2: A VANET simulator for CARLINK

Introduction to Network Simulators

Network Simulator 2: Introduction

Comparison of Different Types of Sources of Traffic Using SFQ Scheduling Discipline

LAN-WAN-LAN end-to-end Network Simulation with NS2

ICE 1332/0715 Mobile Computing (Summer, 2008)

Performance Evaluation. of Input and Virtual Output Queuing on. Self-Similar Traffic

LAMPIRAN. set ns [new Simulator]

NS-2: A Free Open Source Network Simulator

Network Simulator Version 2 for VANET

WIRELESS NETWORK STUDY AND ANALYSIS USING NS2 SIMULATOR

ENSC 427: COMMUNICATION NETWORKS SPRING 2014 FINAL PROJECT

Performance of a Wi-Fi Network as a function of Distance and Number of Connections in a School Environment

CSE 573S Protocols for Computer Networks (Spring 2005 Final Project)

4. Simulation Model. this section, the simulator and the models used for simulation are discussed.

COMPARISON OF DIFFERENT VERSIONS OF TCP IN

Routing Protocols Simulation of Wireless Self-organized Network Based. on NS-2. Qian CAI

ENSC 427. Group 05 - Final Report UMTS Cellular & Wi- Fi Network Simulation in NS- 2 3/17/2012

QoS in Network Simulator 2

Simulation and Analysis of Impact of Buffering of Voice Calls in Integrated Voice and Data Communication System

The simulation and emulation verification that was based on NS-2

Performance Analysis of Wired, Wireless and Optical Network using NS2

S Ns2 simulation exercise

Performance Analysis of Routing Protocols

CHAPTER 3: LITERATURE REVIEW 3.1 NEED FOR SIMULATION ENVIRONMENT IN WSN

STUDY OF SOCKET PROGRAMMING AND CLIENT SERVER MODEL

ABSTRACT. socialize with nearby users of common interest, but there exists no pre-established session

CHAPTER 5. Simulation Tools. be reconfigured and experimented with, usually this is impossible and too expensive or

arxiv: v2 [cs.ni] 26 Jul 2010

Channabasaveshwara Institute of Technology. (An ISO 9001:2008 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur Karnataka.

Evaluation Strategies. Nick Feamster CS 7260 February 26, 2007

Tcl script 2

Modeling of data networks by example: NS-2 (II)

Simulation-Based Comparative Study of Routing Protocols for Wireless Ad-Hoc Network

TCP over Ad Hoc Networks : NS-2 Simulation Analysis. Ren Mao, Haobing Wang, Li Li, Fei Ye

CHAPTER 1 INTRODUCTION

Performance Analysis of Broadcast Based Mobile Adhoc Routing Protocols AODV and DSDV

NS internals. Velibor Markovski Communication Networks Laboratory School of Engineering Science Simon Fraser University

Assignment 3 Solutions 2/10/2012

Technical University of Crete Electronic & Computer Engineering Department TCP Performance over UMTS Network

GENERAL SELF-ORGANIZING TREE-BASED ENERGY BALANCE ROUTING PROTOCOL WITH CLUSTERING FOR WIRELESS SENSOR NETWORK

Hybrid Control and Switched Systems. Lecture #17 Hybrid Systems Modeling of Communication Networks

International Journal of Intellectual Advancements and Research in Engineering Computations. Efficient routing protocol for MANET using.

Measuring Application's network behaviour

Chapter 5. Simulation Environment. Chapter 5 Simulation Environment... V Network Simulator... V NS-2 Installation...

TKN. Technische Universität Berlin. Circuit Switching Module for ns-2. Filip Idzikowski. Berlin, March 2009

Appendix B. Standards-Track TCP Evaluation

A Hybrid Systems Modeling Framework for Fast and Accurate Simulation of Data Communication Networks. Motivation

Time-Step Network Simulation

Ns-Modbus: Integration of Modbus with ns-3 network simulator

Performance of DSDV Protocol over Sensor Networks

Network Simulator 2, Protocol Implementation Assignment for Telecommunications Laboratory Course

A Simulation study : Performance comparison of AODV and DSR

Appendix A. Methodology

Methods to Resolve Traffic Jams using VANET

II. ROUTING CATEGORIES

Investigations on TCP Behavior during Handoff

Transcription:

Mohammad Hossein Manshaei manshaei@gmail.com 1393

A brief Introduction to ns-2 2

Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation Results Analysis (Traces and NAM) 3

ns-2, the Network Simulator ² A simulator for communication networks, developed at Laurence Berkely National Laboratory (LBNL) within VINT Project ² It fast became a property of the research community ² Everyone could add its own modules and contribute to its development ² Downloadable Freely at: http://www.isi.edu/nsnam/ns ² Can be installed on Linux and Windows 4

ns-2, the Network Simulator v Academic project over 10 years old freely distributed, open source v Maintained by ISI (Information Science Institute - USC) DARPA + NSF projects v ~ 200K LoC, ~400 page manual v Large user base mostly academics v de facto standard in networking research 5

ns-2 Functionality v Discrete event simulator v Traffic models and applications Web, FTP, telnet, audio, sensor nets v Transport protocols TCP (Reno, SACK, etc), UDP, multicast v Routing and queuing static routing, DV routing, multicast, ad-hoc routing queuing disciplines: drop-tail, RED, FQ v Link layer wired, wireless, satellite v Infrastructure tracing, visualization, error models, modify or create your own modules 6

Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation Results Analysis (Traces and NAM) 7

ns-2 Components 1. Pre-processing: traffic and topology generators 2. nam, the Network AniMator visualize Ns (or other) output GUI input simple Ns scenarios 3. Post-processing: simple trace analysis, often in Awk, Perl, or Tcl Tutorial: http://www.isi.edu/nsnam/ns/tutorial 8

ns-2 Software Structure: C++ and OTCL Uses two languages: 1.C++ for packet-processing 1. per packet processing 2. fast to run, detailed, complete control 2.OTCL for control 1. simulation setup, configuration, occasional actions 2. fast to write and change 9

ns-2 Software Structure: C++ and OTCL v Object-oriented, discrete event-driven network simulator v Written in C++ and OTcl

Steps when using ns-2 v Create OTCL script with network model nodes, links, traffic sources, sinks, etc. v Parameterize simulation objects queue sizes, link speeds, TCP flavor and parameters (more than 30) v Collect statistics dump everything to trace, post process it gather stats during simulation within OTCL script modify Ns source code v Run Ns multiple times confidence intervals 11

Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation Results Analysis (Traces and NAM) 12

Creating a Basic Ns Model v Create the event scheduler v Create nodes and links v Create connection v Create traffic sources/sinks v Enable tracing 13

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

Creating Network (Nodes + Links) v Nodes set n0 [$ns node] set n1 [$ns node] v Links: connect together two nodes $ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type> <delay> determines propagation delay <queue_type> determines queueing policy DropTail, RED, CBQ, FQ, SFQ, DRR 15

Transport and Traffic Models v Two layer approach 1. Transports: TCP, UDP, multicast, etc. transport protocol instances attach to nodes 2. Traffic (applications): (known as agents) Web, ftp, telnet, audio, etc. application instances attach to transport protocol instances generates traffic into transport protocol 16

Creating Transport Channels: TCP v source and sink set t_src [new Agent/TCP/Newreno] set t_dst [new Agent/TCPSink] Newreno flavor of TCP v attach to nodes and each other $ns attach-agent $n0 $t_src $ns attach-agent $n1 $t_dst $ns connect $t_src $t_dst 17

Creating Traffic over TCP Channels v FTP v create traffic model set ftp [new Application/FTP] default is infinite file size v attach to TCP channel $ftp attach-agent $t_src v schedule start time $ns at <time> $ftp start 18

Creating Transport Channels: UDP v source and sink set u_src [new Agent/UDP] set u_dst [new Agent/NULL] v attach them to nodes, then connect to each other $ns attach-agent $n0 $u_src $ns attach-agent $n1 $u_dst $ns connect $u_src $u_dst 19

Creating Traffic over UDP Channels v CBR set cbr [new Application/Traffic/CBR] $cbr set packetsize_ 512 $cbr set interval_ 0.250 $cbr attach-agent $u_src $ns at <time> $cbr start 20

Other Classes and Variables: v Poisson Source: Set poisson [new Application/Traffic/Poisson] $poisson set interval average-time-between-packetsin-s $poisson set size packet-size-in-bytes v Uniform Random Variable: Set var [new RandomVariable/Uniform] $var set min_ left-edge $var set max_ right-edge Puts $var value // print on the screen a random v number The entire list of classes and variables can be obtained from the manual, the C++ codes, or the file ns-default.tcl (default values) 21

Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation Results Analysis (Traces and NAM) 22

Case Study: WiFi Simulation Ad Hoc Network 6 nodes and 3 connections CBR Traffic over UDP 23

Make Nodes and their Positions for {set i 1} {$i <= $opt(nn)} {incr i} {! set WT($i) [ $ns_ node $i ]! }! proc coord_proc {a} {! return [expr 10 * $a ]! }! for {set i 1} {$i <= $opt(nn)} {incr i} {! $WT($i) set X_ [coord_proc $i]! $WT($i) set Y_ [coord_proc $i]! $WT($i) set Z_ 0.0! }! 24

CBR sources over UDP Transport for {set i 1} {$i < $opt(nn)} {incr i 2} {!!set udp($i) [new Agent/UDP]!!$ns_ attach-agent $WT($i) $udp($i)!!set sink($i) [new Agent/Null]!!$ns_ attach-agent $WT([expr $i +1])!$sink($i)!!$ns_ connect $udp($i) $sink($i)!!set cbr($i) [new Application/Traffic/CBR]!!$cbr($i) set packetsize_ 1000!!$cbr($i) set interval_ 0.005!!$cbr($i) attach-agent $udp($i)!!$ns_ at [expr 20.0 * $i] "$cbr($i) start"!!$ns_ at $opt(stop) "$cbr($i) stop"! }! 25

Mobile Network Parameters $ns_ node-config -adhocrouting DumbAgent \! -lltype!ll \! -mactype!mac/802_11 \! -ifqtype!queue/droptail/priqueue \! -ifqlen!50 \! -anttype!antenna/omniantenna \! -proptype Propagation/FreeSpace \! -phytype!phy/wirelessphy \! -channeltype Channel/WirelessChannel \! -topoinstance $topo \! 26

Trace Definition -agenttrace ON \! -routertrace OFF \! -mactrace OFF \! -movementtrace OFF! 27

Contents 1. Introduction to ns-2 2. ns-2 Components 3. Create a Basic ns-2 Model 4. Case Study: WiFi Simulation 5. Simulation Results Analysis (Traces and NAM) 28

Tracing v Trace packets on individual links v Tracefile format: <event> <time> <from> <to> <pkt> <size>--<flowid> <src> <dst> <seqno> <aseqno> + 1 0 2 tcp 900 ------- 1 0.0 3.1 7 15-1 0 2 tcp 900 ------- 1 0.0 3.1 7 15 r 1.00234 0 2 tcp 900 ------- 1 0.0 3.1 7 15 + enqueue - dequeue r receive d drop time packet type nodes involved in this event packet flags packet length seq number flow ID source dest addresses packet ID 29

Ns Trace file : An Example...! + 11.533441 1 2 tcp 1440 ------- 12 1.2 2.4 96 2092! r 11.535694 1 2 tcp 1440 ------- 12 1.2 2.4 65 1527! - 11.537214 1 2 exp 180 ------- 100 0.2 2.13 284 1528! - 11.538654 1 2 cbr 1440 ------- 101 1.11 2.14 155 1530! r 11.547214 1 2 tcp 1440 ------- 12 1.2 2.4 66 1529! + 11.54728 1 2 tcp 1440 ------- 12 1.2 2.4 97 2095! r 11.548654 1 2 exp 180 ------- 100 0.2 2.13 284 1528! + 11.55 1 2 cbr 1440 ------- 101 1.11 2.14 211 2096! - 11.550174 1 2 tcp 1440 ------- 12 1.2 2.4 67 1534! r 11.560174 1 2 cbr 1440 ------- 101 1.11 2.14 155 1530! - 11.561694 1 2 exp 180 ------- 100 0.2 2.13 285 1532! + 11.56222 1 2 tcp 1440 ------- 12 1.2 2.4 98 2097! - 11.563134 1 2 tcp 1440 ------- 12 1.2 2.4 68 1537! r 11.571694 1 2 tcp 1440 ------- 12 1.2 2.4 67 1534! r 11.573134 1 2 exp 180 ------- 100 0.2 2.13 285 1532! - 11.574654 1 2 exp 180 ------- 100 0.2 2.13 286 1536!... 30

Throughput Calculation: Our Case 31

Graphical Tools 32

NAM (Network Animator) 33