Dear All,

I am running Link State Protocol on a very simple three node topology.
having designed a topology with three nodes. I have also defined the link
cost between all the nodes. (Costs of the links are: n0-n1 : 1.5, n1-n2 :
1.5, n0-n2 : 10). When I run the simulation, according to the traffic goes
from node n0 to n2 directly. Although the total cost of node n0-n1-n2 is
less the total cost of n0-n2 directly. According to my knowledge, it should
not behave like this. If the accumulative cost of the links is less then the
direct link, traffic should traverse the lowest cost path.

I unable to grasp what is going on.  I am pasting the script below for your
convenience, if you can see the script and tell me where am I wrong or if
there is anything missing in the script.

Also please tell me how should I write the script if I am wrong in the
script

#Create a simulator object
set ns [new Simulator]

#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
set f0 [open sp1.tr w]
$ns trace-all $f0

#Initialising Link-State routing Protocol 
$ns rtproto LS

#Define a 'finish' procedure
proc finish {} {
        global ns nf f0
        $ns flush-trace
        #Close the trace file
        close $nf
        close $f0
        #Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

#Create three nodes
set n0 [$ns node]

set n1 [$ns node]

set n2 [$ns node]


#Create links between the nodes
$ns duplex-link $n0 $n1 7Mb 10ms DropTail
#Giving cost to the link in both directions
$ns cost $n0 $n1 1.5
$ns cost $n1 $n0 1.5
$ns duplex-link $n1 $n2 7Mb 10ms DropTail
$ns cost $n1 $n2 1.5
$ns cost $n2 $n1 1.5

$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns cost $n0 $n2 10
$ns cost $n2 $n0 10

#Create a UDP agent and attach it to node n0
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0

# Create a exponential traffic source and attach it to udp0
set expo [new Application/Traffic/Exponential]
$expo set packetSize_ 210
$expo set burst_time_ 500ms
$expo set idle_time_ 500ms
$expo set rate_ 100k

$expo attach-agent $udp0

#Create a Null agent (a traffic sink) and attach it to node n2
set null0 [new Agent/Null]
$ns attach-agent $n2 $null0

#Connect the traffic source with the traffic sink
$ns connect $udp0 $null0  

#Schedule events for the expo agent and the network dynamics
$ns at 0.5 "$expo start"
#$ns rtmodel-at 1.0 down $n0 $n2
#$ns rtmodel-at 2.0 up $n0 $n2
$ns at 4.5 "$expo stop"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"

#Run the simulation
$ns run

-----
Regards,

Bilal A. Khan
-- 
View this message in context: 
http://old.nabble.com/Links-State-Routing-Protocol-Probelm---Please-HELP-tp26495639p26495639.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to