Network Simulator 2: Introduction

Similar documents
Network Simulator 2: Introduction

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

An Introduction to NS-2

DMN1 : COMMUNICATION PROTOCOL SIMULATION. Faculty of Engineering Multimedia University

Project Network Simulation CSE 5346/4346

PART A SIMULATION EXERCISES

Mohammad Hossein Manshaei 1393

Simulations: ns2 simulator part I a

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

EE 122: Computer Networks Network Simulator ns2

ns-2 Tutorial Exercise (1)

NS-2 Tutorial. Kumar Viswanath CMPE 252a.

The Network Simulator Fundamentals. Downloads and further info at:

Simple Data Link Protocols

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

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

The Transport Control Protocol (TCP)

Part 3. Result Analysis

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

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

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

Part 6. Confidence Interval

LAMPIRAN. set ns [new Simulator]

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

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

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

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

USE OF THE NETWORK SIMULATOR NS-2 TOOL IN LECTURES

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

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

Part 3: Network Simulator 2

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

S Ns2 simulation exercise

Comparing ad-hoc wireless to wiredwireless

FACULTY OF ENGINEERING

[1] Chowdhury, A. K., Ibrahim, M., Shanmugam, V., Singh, A. K. (2013). [2] Chowdhury, A. K., Raj, N., Singh, A. K., Area efficient MAX operator for

QoS in Network Simulator 2

Part 5. Wireless Network

Wireless Networks - Preliminaries

S Ns2 simulation exercise

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

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

Brief Overview and Background

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

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

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

A STUDY ON AODV AND DSR MANET ROUTING PROTOCOLS

Performance analysis of QoS-Oriented Distributed Routing protocols for wireless networks using NS-2.35

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

Evaluation Strategies. Nick Feamster CS 7260 February 26, 2007

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

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

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

Network Simulator Version 2 for VANET

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

Performance analysis of aodv, dsdv and aomdv using wimax in NS-2

A Performance Comparison of Multi-Hop Wireless Ad Hoc Network Routing Protocols. Broch et al Presented by Brian Card

ANALYSIS OF SMART DEVICE GAME PROTOCOL

A Study on the Behaviour of SAODV with TCP and SCTP Protocols in Mobile Adhoc Networks

Performance Evaluation of Routing Protocols for Mobile Ad Hoc Networks

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

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

NS-2: A Free Open Source Network Simulator

Analysis QoS Parameters for Mobile Ad-Hoc Network Routing Protocols: Under Group Mobility Model

Analysis and Performance Evaluation of Routing Protocols in MANETS

Implementation of Feedback Mechanism into AODV based on NS2

VANS: Visual Ad hoc Network Simulator

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

Report: Simulation of ECOFRAME MAC layer in ns Bogdan Ušćumlić, Annie Gravey, Michel Morvan, and Philippe Gravey

Implementation of Wired and Wireless Networks, Analysis Simulation and Result Comparison Using Ns2

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

Network Simulator 2 (NS2)

NSIS for NS-2. N4 TCP connection. Figure 1: TCP connection reuse

A Simulation study : Performance comparison of AODV and DSR

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

Implementation of AODV Routing Protocol in NS2: A comparison with DSDV routing protocol

QoS Based Evaluation of Multipath Routing Protocols in Manets

A COMPARISON OF IMPROVED AODV ROUTING PROTOCOL BASED ON IEEE AND IEEE

Introduction to QualNet

Analysis of Routing Protocols in MANETs

S Ns2 simulation exercise

Simulation in Cyber Security

AVC College of Engineering, Mayiladuthurai, India

Comparison of Different Network Simulation Tools. University of Bremen Communication Networks

A Performance Comparison of Multi-Hop Wireless Ad Hoc Network Routing Protocols

Design and Simulation Implementation of an Improved PPM Approach

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

Simulating Well-Known Protocols

Analysis of Network Traffic in Ad-Hoc Networks based on DSDV Protocol

ICE 1332/0715 Mobile Computing (Summer, 2008)

COMPARISON OF DIFFERENT VERSIONS OF TCP IN

Congestions control through cloud computing with MANET

Keywords- NS2, OPNET, NETSIM, JSIM

1. The Internet 2. Principles 3. Ethernet 4. WiFi 5. Routing 6. Internetworking 7. Transport 8. Models 9. WiMAX & LTE 10. QoS 11. Physical Layer 12.

Implementation of a Multi-Channel Multi-Interface Ad-Hoc Wireless Network

Routing Protocols in MANETs

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

Performance of DSDV Protocol over Sensor Networks

What is an Ad Hoc Network?

Performance Improvement of Wireless Network Using Modern Simulation Tools

Transcription:

Network Simulator 2: Introduction Presented by Ke Liu Dept. Of Computer Science SUNY Binghamton Spring, 2006 1

NS-2 Overview 2

NS-2 Developed by UC Berkeley Maintained by USC Popular simulator in scientific environment Other popular network simulators QualNet: based on GloMoSim Others: GloMoSim, OPNET, etc 3

NS2 Goals To support networking research and education Protocol design, traffic studies, etc. Protocol comparison; New architecture designs are also supported. To provide collaborative environment Freely distributed, open source; Increase confidence in result 4

Two Languages: C++, OTcl OTcl: short for MIT Object Tcl, an extension to Tcl/Tk for object-oriented programming. Used to build the network structure and topology which is just the surface of your simulatoion; Easily to configure your network parameters; Not enough for research schemes and protocol architecture adaption. 5

Two Languages (Con t) C++: Most important and kernel part of the NS2 To implement the kernel of the architecture of the protocol designs; From the packet flow view, the processes run on a single node; To change or comment out the existing protocols running in NS2; Details of your research scheme. 6

Why 2 Languages? 2 requirements of the simulator Detailed simulation of Protocol: Run-time speed; Varying parameters or configuration: easy to use. C++ is fast to run but slower to code and change; OTcl is easy to code but runs slowly. 7

Protocols/Models supported by NS2 Wired Networking Routing: Unicast, Multicast, and Hierarchical Routing, etc. Transportation: TCP, UDP, others; Traffic sources: web, ftp, telnet, cbr, etc. Queuing disciplines: drop-tail, RED, etc. QoS: IntServ and Diffserv Wireless Networking Ad hoc routing and mobile IP Routing Protocol: AODV, DSDV, DSR, etc. MAC layer Protocol: TDMA, CDMA(?), IEEE Mac 802.x, etc. Physical layers: different channels(?), directional attena Sensor Networks 8

Researches based on NS2 Intserv/Diffserv (QoS) Multicast: Routing, Reliable multicast Transport: TCP Congestion control Application: Web caching Multimedia Sensor Networks: LEACH, Directed Diffusion, etc. etc. 9

NS2 research actions NS2: the simulator itself, now version: ns-2.29 We will work with the part mostly. NAM: Network animator. Visualized trace tool(not really). My recommendation is that Don t use nam at all. Pre-processing: Traffic and topology generators Post-processing: Simple trace analysis, often in Awk, Perl(mostly), or Tcl 10

Living under NS2 11

The NS2 Directory Structure 12

Warning Try to avoid using ns2 with version before 2.27 DO NOT use gcc 4.x, suggestion: gcc3.3 If you work with MAC layer protocols, please be careful for the versions 13

A Simple Simulation We just need one Tcl script to do so. 14

A Simple Simulation, part 1: set up $ns_ use-scheduler Heap set ns [new Simulator] $ns color 1 Blue $ns color 2 Red set nf [open out.nam w] $ns namtrace-all $nf set tf [open trace.tr w] $ns trace-all $tf proc finish {} { global ns nf tf $ns flush-trace ;#Specify the scheduler, default: List Scheduler ;#Create a simulator object ;#Define different colors for data flows (for NAM) ;#Create trace files for simulation ;#Define a finish procedure #Close the NAM trace file close $nf #Close the ns2 trace file close $tf } exit 0 15

#Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes A Simple Simulation, part 2: n/w structure $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 10 #Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right #Monitor the queue for link (n2-n3). (for NAM) $ns duplex-link-op $n2 $n3 queuepos 0.5 16

A Simple Simulation, part 3: Transport and Traffic #Setup a TCP connection: from node 0 to node 3 set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n3 $sink $ns connect $tcp $sink $tcp set fid_ 1 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP ;#for Nam #Setup a UDP connection: from node 1 to node 3 set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n3 $null $ns connect $udp $null $udp set fid_ 2 17

#Setup a CBR over UDP connection A Simple Simulation, part 4: traffic set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr ;#used by Nam set packet_size_ 1000 $cbr set rate_ 1mb $cbr set random_ false ;#generating traffic periodically #Schedule events for the CBR and FTP agents $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at 4.0 "$ftp stop" $ns at 4.5 "$cbr stop" #Detach tcp and sink agents (not really necessary) $ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink" #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" #Run the simulation $ns run 18

Steps in writing a simulating script Create the event scheduler Turn on tracing Create network Setup routing Insert errors Create transport connection Create traffic Transmit application-level data 19

The trace file Turn on tracing on specific links $ns_ trace-queue $n0 $n1 Each line in the trace file is in the format: < event > < time > < from > < to > < pkt type > < pkt size > < flags > < fid > < src.port > < dst.port > < seq > < unique pkt id > Trace example: + 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0-1 0 2 cbr 210 ------- 0 0.0 3.1 0 0 r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0 Event: s send, r receive, + enqueue, dequeue, d drop, f forward, 20

The network Topology 21

The Node Architecture 22

The Packet Flow 23

Extending to NS2 24

Class Hierarchy in NS2(Partial, C++ code) 25

Create New Component for NS2 Your research needs you to do so, no escaping(crying!!!). Extending ns in Otcl source your changes in your simulation scripts Extending ns in C++ Change Makefile (if created new files) make depend recompile Makefile is in the ns-2.29 directory 26

Adding New Class 27

C++ Code Architecture of a Mobile Node (DSDV) entry_ addr demux IP address defaulttarget_ port demux 255 Src/Sink RTagent (DSDV) uptarget_ LL target_ arptable_ ARP downtarget_ IFq downtarget_ mac_ MAC uptarget_ downtarget_ uptarget_ Radio Propagation Model propagation_ NetIF channel_ uptarget_ Channel 28

A component at some layer of each node Up target: except the highest layer component Down target: even the lowest layer component Timers: triggering some actions Send: either to up or down neighbor Recv: from either up or down neighbor 29

Assigments Finish the following sections of the tutorial on link http://nile.wpi.edu/ns/ Purpose Overview Basics Post Simulation Extending NS: where to Find What? Understand how to simulate the DSR and DSDV routing with ns2. You may use the NS2 manual. Optional: A document showing how to code a new routing agent http://masimum.dif.um.es/nsrt-howto/html/nsrt-howto.html 30

Project Assignment 1 1000 800 600 400 200 0 200 200 0 200 400 600 800 1000 31

Project Assignment 1: requirement Wireless simulation: using BOTH DSDV and DSR routing; You should trace Agent, Routing Agent, Mac; You DON T need to create nam trace; Create 9 CBR flows upon UDP transportation to one node. CBR Packet Size: 1024 Bytes, interval 1.0 sec, Simulation(Traffic) Time: 120 sec; No other parameter s default value should be changed; All 9 flows start at the same time, so as end. 32

How to code a new Routing Agent 33

Steps Packet header design Packet header globalizing Routing Agent design Timer Design Tcl script commands Design Tcl linkage 34

Thank You! My email: kliu@cs.binghamton.edu 35