In this post I have included the NS2 Script (TCL Script) for simulating link failure in wired networks.
$ns rtmodel-at 1.0 down $n1 $n2
The code given above will fail the link between Node n1 and Node n2 at time 1.0.
$ns rtmodel-at 2.0 up $n1 $n2
The code given above will reconnect the link between Node n1 and Node n2 at time 2.0.
Executing the TCL Script
Simulated Network in NAM
Initial Traffic Flow Simulation in NAM
Link Between Node1 and Node2 Failed
Traffic Flow through a Different Path
Link Between Node1 and Node2 is Up Again