Amazing technological breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to use Distance Vector Routing (DV) protocol in NS2?


In Distance Vector (DV), each node sends periodic route updates for every 2 seconds. Apart from the periodic updates, each node/agent sends triggered updates as a result of changes in the forwarding table in the node if any. This occurs either due to changes in the network topology or the node received a route update and as a result, it composes a fresh route. The test7.tcl shows the sample tcl code that runs the application with DV routing protocol.

Sample Code

# Filename: test7.tcl

#———— Routing Protocol —————#

$ns rtproto DV

$ns at 0.0 "Tranmission"
proc Tranmission {} {
global C ROU R ns

set now [$ns now]
set time 10.0
set x 3
set y 4

set tcp1 [$ns create-connection TCP $C($x) TCPSink $R($y) 1]
$ns at $now "$ns trace-annotate \"Time: $now Pkt Transfer between Client($x) Receiver($y)..\""
$tcp1 set class_ 1
$tcp1 set maxcwnd_ 16
$tcp1 set packetsize_ 4000
$tcp1 set fid_ 1
set ftp1 [$tcp1 attach-app FTP]
$ftp1 set interval_ .005
$ns at $now "$ftp1 start"
$ns at [expr $now+$time] "$ftp1 stop"



Routing process

Data Transmission

Distance Vector Routing (DV) protocol in NS2
Routing process in NS2