Amazing technological breakthrough possible @S-Logix

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • +91- 81240 01111

Social List

How to use DSDV routing protocol in NS2?


Proactive routing protocol maintains constant and updated routing information for each pair of networking nodes by propagating route updates proactively at fixed interval of time. The periodic and event-driven messages are responsible for route establishment and route maintenance. The Destination-Sequenced Distance Vector (DSDV) protocol is the commonly used proactive routing protocol in mobile ad hoc network (MANET). In DSDV, each node maintains a routing table with one route entry for each destination in which the shortest path is recorded. It uses a destination sequence number to avoid routing loops. The sample17.tcl shows a node configuration for a wireless mobile node that runs DSDV as its adhoc routing protocol. Prior to the establishment of communication between the source and receiver node, the routing protocol should be mentioned to find the route between them. Data Transmission is established between nodes using UDP agent and CBR traffic. Routing process follows DSDV routing protocol.

Sample Code

#Filename: sample17.tcl #*******************DSDV ROUTING PROTOCOL****************# # Simulator Instance Creation set ns [new Simulator] #Fixing the co-ordinate of simulation area set val(x) 500 set val(y) 500 # Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 10 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 500 ;# Y dimension of topography set val(stop) 10.0 ;# time of simulation end # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) # general operational descriptor- storing the hop details in the network create-god $val(nn) # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON # Node Creation for {set i 0} {$i < 3} {incr i} { set node_($i) [$ns node] $node_($i) color black } #******************************Defining Communication Between node0 and all nodes ****************************8 for {set i 1} {$i < 10} {incr i} { # Defining a transport agent for sending set udp [new Agent/UDP] # Attaching transport agent to sender node $ns attach-agent $node_($i) $udp # Defining a transport agent for receiving set null [new Agent/Null] # Attaching transport agent to receiver node $ns attach-agent $node_(0) $null #Connecting sending and receiving transport agents $ns connect $udp $null 4 #Defining Application instance set cbr [new Application/Traffic/CBR] # Attaching transport agent to application agent $cbr attach-agent $udp #Packet size in bytes and interval in seconds definition $cbr set packetSize_ 512 $cbr set interval_ 0.1 # data packet generation starting time $ns at 1.0 "$cbr start" # data packet generation ending time #$ns at 6.0 "$cbr stop" }


use DSDV routing protocol in NS2