Presentation is loading. Please wait.

Presentation is loading. Please wait.

DMET 602: Networks and Media Lab

Similar presentations


Presentation on theme: "DMET 602: Networks and Media Lab"— Presentation transcript:

1 DMET 602: Networks and Media Lab
Amr El Mougy Yasmeen Essam Mohamed Karam

2 Exp 8: NS2

3 What is a Simulation? “It is the imitation of the operation of a real-world process or system over time. The act of simulating something first requires that a model be developed; this model represents the key characteristics or behaviors/functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation represents the operation of the system over time.” Wikipedia Highly valuable tool for research and analysis

4 What is NS2 Object-oriented, discrete event-driven network simulator
Written in C++ and OTcl Separates control path from data path implementations By VINT: Virtual InterNet Testbed

5 Goals of NS2 Support networking research and education
Protocol design, traffic studies, etc Protocol comparison Provide a collaborative environment Freely distributed, open source Share code, protocols, models, etc Allow easy comparison of similar protocols Increase confidence in results More people look at models in more situations Experts develop models Multiple levels of detail in one simulator

6 Functionalities of NS2 Wired world Wireless
Routing DV, LS, PIM-SM Transportation: TCP and UDP Traffic sources: web, ftp, telnet, cbr, stochastic Queuing disciplines: drop-tail, RED, FQ, SFQ, DRR QoS: IntServ and Diffserv Emulation Wireless Ad hoc routing and mobile IP Sensor networks, vehicular networks Tracing, visualization, various utilities

7 NS Components NS, the simulator itself Nam, the network animator
Visualize ns (or other) output Nam editor: GUI interface to generate ns scripts Pre-processing: Traffic and topology generators Post-processing: Simple trace analysis, often in Awk, Perl, or Tcl

8 NS Models Traffic models and applications: Transport protocols:
Web, FTP, telnet, constant-bit rate, real audio Transport protocols: unicast: TCP (Reno, Vegas, etc.), UDP Multicast: SRM Routing and queueing: Wired routing, ad hoc rtg and directed diffusion queueing protocols: RED, drop-tail, etc Physical media: Wired (point-to-point, LANs), wireless (multiple propagation models), satellite

9 Discrete Event Simulator
Model world as events Simulator has list of events Process: take next one, run it, until done Each event happens in an instant of virtual (simulated) time, but takes an arbitrary amount of real time simple queuing model: Consider two nodes on an Ethernet: t=1, A enqueues pkt on LAN t=1.01, LAN dequeues pkt and triggers B A B

10 C++ and oTCL Sepatarion
“data” / control separation C++ for “data”: per packet processing, core of ns fast to run, detailed, complete control OTcl for control: Simulation scenario configurations Periodic or triggered action Manipulating existing C++ objects fast to write and change running vs. writing speed Learning and debugging (two languages)

11 NS Programming Create the event scheduler Turn on tracing
Create network Setup routing Insert errors Create transport connection Create traffic Transmit application-level data

12 Creating an Event Scheduler
Create event scheduler set ns [new Simulator] Schedule events $ns at <time> <event> <event>: any legitimate ns/tcl commands $ns at 5.0 “finish” Start scheduler $ns run Example: simple.tcl set ns [new Simulator] $ns at 1 “puts \“Hello World!\”” $ns at 1.5 “exit” $ns run bash-shell$ ns simple.tcl Hello World! bash-shell$ Transport Layer

13 Tracing set nf [open out.nam w] $ns trace-all $nf $ns namtrace-all $nf
Insert immediately after scheduler! Trace packets on all links set nf [open out.nam w] $ns trace-all $nf $ns namtrace-all $nf

14 Tracing

15 Creating a Simple Network
Nodes set n0 [$ns node] set n1 [$ns node] Links and queuing $ns duplex-link $n0 $n1 1Mb 10ms RED $ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type> <queue_type>: DropTail, RED, etc. n0 n1 Transport Layer

16 Queuing Methods Drop Tail: When the buffer is full drop any newly arriving packets Has global TCP congestion problem  all nodes stop and start at the same time Random Early Detection (RED): Starts dropping before the buffer is full. The more data sent by a node, the higher the dropping probability Stochastic Fairness Queuing: Supports QoS by supporting multiple queues. Packets are taken in a round robin fashion

17 Creating a Larger Topology
for {set i 0} {$i < 7} {incr i} { set n($i) [$ns node] } $ns duplex-link $n($i) $n([expr($i+1)%7]) 1Mb 10ms RED

18 Network Dynamics Link failures
Hooks in routing module to reflect routing changes $ns rtmodel-at <time> up|down $n0 $n1 For example: $ns rtmodel-at 1.0 down $n0 $n1 $ns rtmodel-at 2.0 up $n0 $n1

19 Creating a UDP Link set udp [new Agent/UDP] set null [new Agent/Null]
$ns attach-agent $n0 $udp $ns attach-agent $n1 $null $ns connect $udp $null

20 Creating Traffic on top of UDP
cbr null Constant Bit Rate set cbr [new Application/Traffic/CBR] $cbr set packetSize_ 500 $cbr set interval_ 0.005 $cbr attach-agent $udp

21 Creating a TCP Connection
set tcp [new Agent/TCP] set tcpsink [new Agent/TCPSink] $ns attach-agent $n0 $tcp $ns attach-agent $n1 $tcpsink $ns connect $tcp $tcpsink n1 n0 tcp sink

22 Creating Traffic on top of TCP
ftp sink FTP set ftp [new Application/FTP] $ftp attach-agent $tcp Telnet set telnet [new Application/Telnet] $telnet attach-agent $tcp

23 Inserting Packet Loss Creating Error Module Inserting Error Module
set loss_module [new ErrorModel] $loss_module set rate_ 0.01 $loss_module unit pkt $loss_module ranvar [new RandomVariable/Uniform] $loss_module drop-target [new Agent/Null] Inserting Error Module $ns lossmodel $loss_module $n0 $n1

24 Post-Processing Procedure
Add a 'finish' procedure that closes the trace file and starts nam. proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 }

25 Network Animator

26 Network Visualization: Nodes and Links
Color $node color red Shape (can’t be changed after sim starts) $node shape box (circle, box, hexagon) Label (single string) $ns at 1.1 “$n0 label \”web cache 0\”” Links $ns duplex-link-op $n0 $n1 color "green" Label $ns duplex-link-op $n0 $n1 label “backbone"

27 Topology Example Manual” layout: specify everything
$ns duplex-link-op $n(0) $n(1) orient right $ns duplex-link-op $n(1) $n(2) orient right $ns duplex-link-op $n(2) $n(3) orient right $ns duplex-link-op $n(3) $n(4) orient 60deg If anything missing  automatic layout

28 Simulation Example


Download ppt "DMET 602: Networks and Media Lab"

Similar presentations


Ads by Google