introduction to network simulator-2(ns-2)

26
Network Simulator (NS-2) Presented By: Praveen Kumar Sheri

Upload: praveenkumar-sheri

Post on 07-Aug-2015

79 views

Category:

Engineering


6 download

TRANSCRIPT

Page 1: Introduction to Network Simulator-2(NS-2)

Network Simulator (NS-2)

Presented By:

Praveen Kumar Sheri

Page 2: Introduction to Network Simulator-2(NS-2)

2

Agenda Overview of NS-2 History Current Status Platforms Supported Discrete Event Simulator NS-2 Environment NS-2 Hierarchy NS-2 Architecture

Node Architecture Multicast Node Architecture Packet Structure Links Traffic Flow

Example

Page 3: Introduction to Network Simulator-2(NS-2)

3

Overview of NS-2

Discrete Event Simulator Packet level Modeling Network protocols

Collection of Various protocols at multiple layers TCP(reno, tahoe, vegas, sack) MAC(802.11, 802.3, TDMA) Ad-hoc Routing (DSDV, DSR, AODV, TORA) Sensor Network (diffusion, gaf) Multicast protocols, Satellite protocols, and many

others

Page 4: Introduction to Network Simulator-2(NS-2)

4

Overview of NS-2 Maintained through VINT project NS2 :collaborative simulation environment

Freely distributed and open source Supports NT research and education

Protocol design , traffic analysis etc. Provides common reference

Page 5: Introduction to Network Simulator-2(NS-2)

5

History

1995 : Developed by LBL through support of DARPA

1996: NS was extended and distributed by VINT project

1997: Satellite models added @ UCB 1999: Wireless models added @ CMU Recent incorporation of emulation

Page 6: Introduction to Network Simulator-2(NS-2)

6

Current status

Releases: Periodic releases (currently 2.35,NS-3) Daily snapshots (probably compiles and works,

but “unstable”) Available from: USC/ISI, UC Berkeley, UK mirror More than 10k users from hundreds of univs

Page 7: Introduction to Network Simulator-2(NS-2)

7

Platforms supported Most UNIX and UNIX-like systems

FreeBSD Linux Solaris

Windows 98/2000/2003/XP Cygwin required Some work , some doesnt

Page 8: Introduction to Network Simulator-2(NS-2)

8

NS-2 : Components NS – Simulator NAM – Network AniMator

visual demonstration of NS output Preprocessing

Handwritten TCL or Topology generator

Post analysis Trace analysis using Perl/TCL/AWK/MATLAB

Page 9: Introduction to Network Simulator-2(NS-2)

9

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.

Page 10: Introduction to Network Simulator-2(NS-2)

10

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

1 2

Time: 1.5 sec Time: 1.7 sec

Time: 1.8 secTime: 2.0 sec

Page 11: Introduction to Network Simulator-2(NS-2)

© Varaprasad Reddy 11

Event Scheduler

Non-Real time schedulers Implementations : List , Heap , Calender Calender is default

Real time schedulers Used for emulation for direct interaction with

real NT. Basic use of an event scheduler:

schedule simulation events, such as when to start an FTP application, when to finish a simulation, or for simulation scenario generation prior to a simulation run.

Page 12: Introduction to Network Simulator-2(NS-2)

12

NS-2 Environment

Simulation Scenario

Tcl Script

C++ Implementation

1 2

set ns_ [new Simulator]

set node_(0) [$ns_ node]

set node_(1) [$ns_ node]

class MobileNode : public Node {

friend class PositionHandler;public: MobileNode();

••

}

Page 13: Introduction to Network Simulator-2(NS-2)

13

NS-2 Hierarchy

A d dr

R e p lica to r

M C a s t

M P a th

H a sh

C la ss ife r

D e la y

A ge nt

A p p lica tion

Q ue ue

T ra ce

C o n ne c to r

N S O je ct

T c lO b je ct

Page 14: Introduction to Network Simulator-2(NS-2)

14

NS-2 Hierarchy

U D P

R B P

R e no

R B P

V eg as

S a ck1

N e w R e no

T ap

S in k

F u llT C P

A d ap tive

S R M

T C P D S D V A O D V T O R A D S R

A ge nt

T e ln e t

E xpo n en tia l

P are to

C B R

T ra ce

T ra ff ic

F T P

A p p lica tion

D ro p ta il

R E D

F Q

S F Q

D R R

C B Q

Q ue ue

E nq

D eq

D ro p

T ra ce

Page 15: Introduction to Network Simulator-2(NS-2)

15

NS-2 Directory Structure

sim

tk8.0 otcl Tcltcl8.0 ns-2 nam-1

tcl

ex test lib

...

...

tcl code

example

validation test

C++ code

tcl code core

Page 16: Introduction to Network Simulator-2(NS-2)

16

Node Architecture

Classifier

Classifier Agent

Link

Agent

Agent

Node

Addr

Port

Node entry point

Local

Link Link

Page 17: Introduction to Network Simulator-2(NS-2)

17

NS-2 : C++ / OTCL NS-2 Code contains two sets of

languages, namely C++ and OTcl.

C++ is used for the creation of objects because of speed and efficiency.

OTcl is used as a front-end to setup the simulator, configure objects and schedule events because of its ease of use.

Page 18: Introduction to Network Simulator-2(NS-2)

18

Why two languages? (Tcl & C++)

C++: Detailed protocol simulations require systems programming language byte manipulation, packet processing, algorithm

implementation Run time speed is important Turn around time (run simulation, find bug, fix bug,

recompile, re-run) is slower Tcl: Simulation of slightly varying parameters

or configurations quickly exploring a number of scenarios iteration time (change the model and re-run) is

more important

Page 19: Introduction to Network Simulator-2(NS-2)

19

Tcl or C++?

TclSimple Configuration, Setup, Scenario If it’s something that can be done without

modifying existing Tcl module. C++

Anything that requires processing each packet

Needs to change behavior of existing module

Page 20: Introduction to Network Simulator-2(NS-2)

20

Shadowing

TclObject

Agent

Agent/DSDV

Agent/DSDV OTcl shadow object

Agent/DSDV C++ object

TclObject()

Agent()

DSDVAgent()

OTcl classhierarchy

C++ classhierarchy

Page 21: Introduction to Network Simulator-2(NS-2)

21

Making Changes in C++ Space

Existing coderecompile

Additionchange Makefile and recompile

Page 22: Introduction to Network Simulator-2(NS-2)

22

Making Changes in otcl Space

Existing coderecompilesource

Additionsourcechange Makefile (NS_TCL_LIB), tcl/ns-

lib.tcl (source) and recompile

Page 23: Introduction to Network Simulator-2(NS-2)

23

Installation Unix variants

Download NS-allinone-2.27 package Contains

TCL/TK 8.4.5 oTCL 1.8 Tclcl 1.15 Ns2 Nam -1

Page 24: Introduction to Network Simulator-2(NS-2)

24

Installation After successful downloading and unzipping

install allinone package , install NS by install by calling ~/ns-allinone-2.27/install

After successful installation , Validate the scripts by running ./validate in ~/ns-allinone-2.27/ns-2.27/

Its now all set to work with NS

Page 25: Introduction to Network Simulator-2(NS-2)

25

Final topology Generated

Page 26: Introduction to Network Simulator-2(NS-2)

THANK YOU

Contact me on:

[email protected]

9742510339