#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

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

Social List

How to do dynamic routing during link failure in wired network in ns2?

Description

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)

# —————-ESTABLISHING COMMUNICATION ————-#

#————–TCP CONNECTION BETWEEN NODES—————#
$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"

}


Screenshots

Data Transmission

Link Failure

Data Transmission over alternative path