Research 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 do dynamic routing during link failure in wired network in NS2?


The link failure in the wired network leads to intolerable performance degradation. Therefore, it becomes necessary to use an efficient routing protocol that automatically recovers the link from the link failure. Distance Vector (DV) routing protocol automatically recovers the link failure by using alternative path for data transmission. In test8.tcl, the link between any two nodes can be failed using the command “rtmodel-at” along with keyword “down” with the time specification and the DV protocol recovers the link failure using dynamic route discovery mechanism.

Sample Code

# Filename: test8.tcl
# —————-Routing Protocol ————-#

$ns rtproto DV
$ns rtmodel-at 7.880511 down $ROU(1) $ROU(3)


$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"



Data Transmission

Link Failure

Data Transmission over alternative path

dynamic routing during link failure in wired network
Data Transmission
Link Failure and Data Transmission over alternative path