Daniele Messina, Ilenia Tinnirello



Similar documents
ns-2 Tutorial Exercise

Evaluation and Comparison of Wired VoIP Systems to VoWLAN

Network simulation and simulators. Lecturer: Dmitri A. Moltchanov

Network Simulator: ns-2

Network Simulator: A Learning Tool for Wireless Technologies

Comparative Study of Performance Evaluation for Mobile Ad hoc networks using a proxy node

Exercises on ns-2. Chadi BARAKAT. INRIA, PLANETE research group 2004, route des Lucioles Sophia Antipolis, France

TCP Performance Simulations Using Ns2. Johanna Antila 51189d TLT

Performance Analysis on VoIP over LTE network Website:

Ad-hoc and Hybrid Networks Performance Comparison of MANET Routing Protocols in Ad-hoc and Hybrid Networks

Capacity Estimation of VOIP Channels on Wireless Networks

SystemC - NS-2 Co-simulation using HSN

Tutorial: The ns-2 Network Simulator. Outline. Michael Welzl Institute of Computer Science University of Innsbruck, Austria

Outline. Tutorial: The ns-2 Network Simulator. Some thoughts about network simulation. What to use it for. Michael Welzl

Study of Active Queue Management Algorithms ----Towards stabilize and high link utilization

Energy-Aware Performance Metric for AODV and DSDV Routing Protocols in Mobile Ad-Hoc Networks

SJBIT, Bangalore, KARNATAKA

A Comparison Study of Qos Using Different Routing Algorithms In Mobile Ad Hoc Networks

IASTED ASM 2004 Tutorial:

NetworkPathDiscoveryMechanismforFailuresinMobileAdhocNetworks

COMPARATIVE ANALYSIS OF ON -DEMAND MOBILE AD-HOC NETWORK

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer

Energy Consumption analysis under Random Mobility Model

Final for ECE374 05/06/13 Solution!!

Simulation and Evaluation for a Network on Chip Architecture Using Ns-2

Energy Efficiency of Load Balancing in MANET Routing Protocols

Multiple Fault Tolerance in MPLS Network using Open Source Network Simulator

Step by Step Procedural Comparison of DSR, AODV and DSDV Routing protocol


How To Monitor Performance On Eve

Behavior Analysis of TCP Traffic in Mobile Ad Hoc Network using Reactive Routing Protocols

Network Emulation as a Basis for Performance Analysis of Groupware. Prof. Dr. rer. nat. habil. Dr. h. c. Alexander Schill Dipl. Inf.

Applications. Network Application Performance Analysis. Laboratory. Objective. Overview

Performance Analysis of Load Balancing in MANET using On-demand Multipath Routing Protocol

Homework 3 TCP/IP Network Monitoring and Management

OPNET Network Simulator

A Secure Intrusion detection system against DDOS attack in Wireless Mobile Ad-hoc Network Abstract

1 M.Tech, 2 HOD. Computer Engineering Department, Govt. Engineering College, Ajmer, Rajasthan, India

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Implementation, Simulation of Linux Virtual Server in ns-2

10CS64: COMPUTER NETWORKS - II

EECS 489 Winter 2010 Midterm Exam

Practical Network Forensics

A Pythagorean Tree based Key Generation Algorithm for Secure Group Communication in MANETs

Performance Analysis of AQM Schemes in Wired and Wireless Networks based on TCP flow

Network Load Balancing

Measuring Wireless Network Performance: Data Rates vs. Signal Strength

TCP/IP Protocol Suite. Marshal Miller Chris Chase

Load Balancing. Final Network Exam LSNAT. Sommaire. How works a "traditional" NAT? Un article de Le wiki des TPs RSM.

Assignment #3 Routing and Network Analysis. CIS3210 Computer Networks. University of Guelph

Hyacinth An IEEE based Multi-channel Wireless Mesh Network

Transport and Network Layer

Introduction To Computer Networking

Introduction VOIP in an Network VOIP 3

Lecture 2.1 : The Distributed Bellman-Ford Algorithm. Lecture 2.2 : The Destination Sequenced Distance Vector (DSDV) protocol

Route Discovery Protocols

Performance Comparison of AODV, DSDV, DSR and TORA Routing Protocols in MANETs

SECURE DATA TRANSMISSION USING INDISCRIMINATE DATA PATHS FOR STAGNANT DESTINATION IN MANET

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Optimization of VoIP over e EDCA based on synchronized time

Technical Support Information Belkin internal use only

STUDY OF COMPUTER NETWORK ISSUES AND IMPROVISING DROP RATE OF TCP PACKETS USING NS2

First Midterm for ECE374 02/25/15 Solution!!

An Implementation of Secure Wireless Network for Avoiding Black hole Attack

OPNET - Network Simulator

Micro Mobility and Internet Access Performance for TCP Connections in Ad hoc Networks

CROSS LAYER BASED MULTIPATH ROUTING FOR LOAD BALANCING

TFTP TRIVIAL FILE TRANSFER PROTOCOL OVERVIEW OF TFTP, A VERY SIMPLE FILE TRANSFER PROTOCOL FOR SIMPLE AND CONSTRAINED DEVICES

Mobile Computing/ Mobile Networks

IP Routing Features. Contents

A Performance Comparison of Routing Protocols for Large-Scale Wireless Mobile Ad Hoc Networks

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

CCNA Discovery Networking for Homes and Small Businesses Student Packet Tracer Lab Manual

Application. Transport. Network. Data Link. Physical. Network Layers. Goal

QualNet 4.5 Network Emulation Interface Model Library

IJMIE Volume 2, Issue 7 ISSN:

A Seamless Handover Mechanism for IEEE e Broadband Wireless Access

TCP in Wireless Mobile Networks

Network Layer IPv4. Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS. School of Computing, UNF

Performance Evaluation of AODV, OLSR Routing Protocol in VOIP Over Ad Hoc

Remote Monitoring Quick Start Guide

TCP for Wireless Networks

Performance Monitoring on Networked Virtual Environments

Slide 1 Introduction cnds@napier 1 Lecture 6 (Network Layer)

Performance Evaluation of Wired and Wireless Local Area Networks

Wireless Mesh Networks Impact on Voice over Internet Protocol. Mohammad Tariq Meeran PhD Student Institute of Informatics, Tallinn University

Internet Control Protocols Reading: Chapter 3

OSBRiDGE 5XLi. Configuration Manual. Firmware 3.10R

A NOVEL RESOURCE EFFICIENT DMMS APPROACH

SIMULATION STUDY OF BLACKHOLE ATTACK IN THE MOBILE AD HOC NETWORKS

Cross Layer TCP Congestion Control Load Balancing Technique in MANET

LAB THREE STATIC ROUTING

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Transcription:

!"! #$ %& ' %&

traffic source agent node link n0 ftp tcp sink 2mbps 10 ms n2 1.7mbps, 20 ms n3 cbr udp n1 2mbps 10 ms null pktsize 1KB, rate 1mbps

#Create a simulator object set ns [new Simulator] $ $ #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the NAM trace file close $nf #Execute NAM on the trace file exec nam out.nam & exit 0 }

set ns [new Simulator]" %& $ " ( (%& %! "! " # #! $ $ $ $# % & '

$ $ n0 #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] 2mbps 10 ms n1 2mbps 10 ms n2 1.7mbps, 20 ms n3 #Create links between the nodes $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

$ns_ simplex-link <node1> <node2> <bw> <delay> <qtype> <args> %!% )*+, $ #!-#. #!! -.$ $ns_ duplex-link <node1> <node2> <bw> <delay> <qtype> <args> %% $ $ns_ simplex-link-op <n1> <n2> <op> <args> %!/$ %% %# $ $ns_ duplex-link-op <n1> <n2> <op> <args> %)! %#,!/$

$ $ #Setup a TCP connection 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 n0 ftp tcp n3 sink

#Setup a UDP connection 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 $ $ #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 1mb $cbr set random_ false cbr udp n1 pktsize 1KB, rate 1mbps n3 null

$ $ #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" #Print CBR packet size and interval puts "CBR packet size = [$cbr set packet_size_]" puts "CBR interval = [$cbr set interval_]" #Run the simulation $ns run

$ns trace-all $fd + 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610-1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610 r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600 r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602 + 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611-1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611 r 1.84609 0 2 cbr 210 ------- 0 0.0 3.1 225 610 + 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610 d 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610

" 0 %" " #( $ns_ use-scheduler Heap ) # " * # / / / /1!! 2

!!!!3 %!!!!!! " ( +!,! * -!, (, +! *! p(x)=k*(x m ) k /(x) k+1 (, * ( +. /. " " #!!

4*5!!! %&" 0 0 # 0 0 1 2 #! 0! 4*5!!% 6!" set e [new Application/Traffic/CBR] $e set packetsize_ 48 $e set rate_ 64Kb $e set random_ 1!4*5%&788 /$

9/!!!%&" 0 0 0 12 0 0 12 0 12 9/:!!!!% 6!" set e [new Application/Traffic/Exponential] $e set packetsize_ 210 $e set burst_time_ 500ms $e set idle_time_ 500ms $e set rate_ 100k 9/:!!%! % % %%88 ; %8$

<= <=%&%!4= %&$ $ftp start $ftp produce <n> $ftp stop $ftp attach agent $ftp producemore <count> 4!=" maxpkts

! $ %6!! $ 3 4, ), ( Agent/UDP set packetsize_ 1000 ;# max segment size

4= &!4=" " senders receivers (sink) " # " & 5, " 1 2 5, & 5, 6 " 16 2 5, & 5, % " 6 & 5, 7 " 5, 6 8 5. 9 7 : # & 5, ; " 5, ; & 5, 8 " 6 5, 1 2

4= " & 5, " 5, & 5 < & 5, 4 & " 5, & 5 < & 5, 7 " & 5 < 6 8 5. 9 7 : # & 5, 7 4 & " 7 4 &

4= Agent/TCP set window_ 100 ;# Changes the class variable $tcp set window_ 2.0 ;# Changes window_ for the $tcp object! 5, & 5, # & 5 < 5, & 5 < & 5 < Agent/TCPSink set packetsize_ 40 4 & 5 < 5, Agent/TCPSink/DelAck set interval_ 100ms & 5 < 5, " Agent/TCPSink set maxsackblocks_ 3

5 <" 4 ' 6!! $ >?! % $ns rtproto Static ;# Enable static route strategy for the simulation $ns rtproto Session ;# Enable session routing for this simulation $ns rtproto DV $n1 $n2 $n3 ;# Run DV agents on nodes $n1, $n2, and $n3 $ns rtproto LS $n1 $n2 ;# Run link state routing on specified nodes

'!! $'%! $ $ns cost $n1 $n2 10 ;# set cost of link from $n1 to $n2 to 10 $ns cost $n2 $n1 5 ;# set cost of link in reverse direction to 5 [$ns link $n1 $n2] cost? ;# query cost of link from $n1 to $n2 [$ns link $n2 $n1] cost? ;# query cost of link in reverse direction

5 " 3 4 = ", 8! #file:static-routing.tcl

5 " @A5):=:@A," 4 - "8 4 ; #. # ( changes in the topology received route update #files: session-routing.tcl dv-routing.tcl

5 B 5" $ns rtproto Manual set n1 [$ns node] set n2 [$ns node] $ns duplex-link $n1 $n2 10Mb 100ms DropTail [$n1 get-module "Manual"] add-route-to-adj-node -default $n2 [$n1 get-module "Manual"] add-route-to-adj-node $n2 [$n2 get-module "Manual"] add-route-to-adj-node -default $n1 #file:manual-routing.tcl

@ >?!% $ #<start> <on> <off> <end> $ns rtmodel Exponential 0.5 1.0 1.0 5.0 $n1 ;#apply to node $ns rtmodel Trace dynamics.trc $n2 $n3 ;#apply to link $ns rtmodel Deterministic 20.0 20.0 $node(1) $node(5) >?! B!$!$ $ns rtmodel-at 3.5 up $n0 $ns rtmodel-at 3.9 up $n3 $n5 $ns rtmodel-at 40 down $n4

C! $ns set-address-format hierarchical /. " */. / 7 9 *7 7 *7 7 # $ns set-address-format hierarchical <#n hierarchy levels> <#bits for level1> <#bits for level 2>...<#bits for nth level> The AddrParams class is used to store the topology hierarchy. AddrParams set domain_num_ 2 lappend cluster_num 2 2 AddrParams set cluster_num_ $cluster_num lappend eilastlevel 2 3 2 3 AddrParams set nodes_num_ $eilastlevel This defines a topology with 2 domains, say D1 and D2 with 2 clusters each (C11 & C12 in D1 and C21 & C22 in D2). Then number of nodes in each of these 4 clusters is specified as 2,3,2 and 3 respectively.

+ %!" > >? ' & 5, @ A %!" " set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(ant) Antenna/OmniAntenna ;# Antenna type set val(ll) LL ;# Link layer type set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type set val(ifqlen) 50 ;# max packet in ifq set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(rp) DSDV ;# ad-hoc routing protocol set val(nn) 2 ;# number of mobilenodes

+ + %&!!% %$ set topo [new Topography] B %!D;;ED;;$ + %& /! %)/FD;;FD;;," $topo load_flatgrid 500 500 #file:simple-wireless.tcl

+ / %&3!" create-god $val(nn) 3)3@," ) the next hop information is normally loaded into god object from movement pattern files.

+ +!" # $ns_ node-config -addressingtype flat or hierarchical or expanded # -adhocrouting DSDV or DSR or TORA # -lltype LL # -mactype Mac/802_11 # -proptype "Propagation/TwoRayGround" # -ifqtype "Queue/DropTail/PriQueue" # -ifqlen 50 # -phytype "Phy/WirelessPhy" # -anttype "Antenna/OmniAntenna" # -channeltype "Channel/WirelessChannel" # -topoinstance $topo # -energymodel "EnergyModel" # -initialenergy (in Joules) # -rxpower (in W) # -txpower (in W) # -agenttrace ON or OFF # -routertrace ON or OFF # -mactrace ON or OFF # -movementtrace ON or OFF

+ # Create nodes: for {set i 0} {$i < $val(nn) } {incr i} { set node_($i) [$ns_ node ] $node_($i) random-motion 0;# disable random motion } # Provide initial (X,Y,Z) co-ordinates for node_(0) and node_(1) $node_(0) set X_ 5.0 $node_(0) set Y_ 2.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 390.0 $node_(1) set Y_ 385.0 $node_(1) set Z_ 0.0

+ # Produce some node movements # # Node_(1) starts to move towards node_(0) # command: $node setdest <x2> <y2> <speed> $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0" $ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0" # Node_(1) then starts to move away from node_(0) $ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"

+ # Tell nodes when the simulation ends # for {set i 0} {$i < $val(nn) } {incr i} { $ns_ at 150.0 "$node_($i) reset"; } $ns_ at 150.0001 "stop" $ns_ at 150.0002 "puts \"NS EXITING...\" ; $ns_ halt" #for # Tell {set nodes i 0} when {$i < the $val(nn) simulation } {incr ends $ns_ at 150.0 "$node_($i) reset"; i} { }$ns_ $ns_ proc at 150.0001 150.0002 "stop" global stop {} ns_ { tracefd "puts \"NS EXITING...\" ; $ns_ halt" }At time close 150.0s, $tracefd later And finally after resetting the command the simulation the to nodes. start shall The the procedure simulation, stop. The stop{} nodes are is called reset at to that flush time out and traces the and "$ns_ close halt" the is trace called file. at 150.0002s, a little puts $ns_ "Starting run Simulation..." proc stop {} { global ns_ tracefd close $tracefd } puts "Starting Simulation..." $ns_ run

+ MAC r 160.093884945 _6_ RTR --- 5 tcp 1492 [a2 4 6 800] ------- [65536:0 16777984:0 31 16777984] [1 0] 2 0 NETWORK TRANSPORT TCP packet received by routing agent of node 6 at time 160.09... UID: 5 size: 1492 Mac Layer fields: time src_addr dst_addr type (800: IP, 806: ARP) Network Layer fields: src_addr dst_addr TTL next_hop_addr Transport Layer fields: seq_no ack_no no_of_fwds opt_no_of_fwds

+< %% ns use-newtrace %! ", @ A

+ 9%!" set namtrace [open wireless1-out.nam w] $ns_ namtrace-all-wireless $namtrace $val(x) $val(y) "+ %B 4 / #file:wireless1.tcl

4!! % cd <ns_dir>/indep-utils/cmu-scen-gen/setdest./setdest [-v version of setdest] [-n num_of_nodes] [-p pausetime] [-s maxspeed] [-t simtime] [-x maxx] [-y maxy] > [outdir/movement-file]

4!! % 9/" setdest -n 5 -p 200 -s 0.1 -t 180 -x 50 -y 50 > nodes.tcl.in % ( B

+ wireless node WL0 wired node base station BS0 link 5mbps 2 ms W0 5.0mbps, 2 ms W1 BS1 5.0mbps 2 ms WL1 WL2 #file:wireless2.tcl

+ Domain 1 1.0.1 n0 1.0.0 Use hierarchical routing 3 domains BS0 0.0.0 0.0.1 2.0.1 2.0.0 BS1 W0 W1 Domain 0 n1 2.0.2 Domain 2 n2

9! % $! %! $ 9$ '!!! )/=/=== =,

9 + 6 %%!" $ns_ node-config... -energymodel $opt(energymodel) \ #EnergyModel -idlepower 1.0 \ #watts -rxpower 1.0 \ #watts -txpower 2.0 \ #watts -sleeppower 0.001 \ #watts -transitionpower 0.2 \ #watts -transitiontime 0.005 \ #seconds -initialenergy $opt(initialenergy) #joules

9 9/" -8.::/:$ "::$$::!::B $ " GHIH$HI;;;;$;I0;$;;;;$;;J;$;;KL " "'@9 " 99= " "