Documentos de Académico
Documentos de Profesional
Documentos de Cultura
#In the following network, the host named Annie is transmitting data
over a reliable, connection-oriented communication to the host named
Peter at a rate of 0.1Mbps in 1000 bytes long packets. The link state
algorithm is followed for routing and a sliding window protocol with
a window size of 8 is used for a reliable data transfer. It has been
found that the link between the host1 and Peter goes down at 1.0 sec
and that between the host3 and host4 goes down at 2.0 sec. The link
host3-host4 comes up again at 4.5 sec and the link host1-Peter, up
again at 6.5 sec. It is desired that, while the present path is
unavailable due to a link failure, the traffic should take the next
available shortest path in the network.
#At the same time the host Peter is transmitting data to the host
Annie over an unreliable, connectionless communication at a rate of
0.1Mbps in 500 bytes long packets. The link state algorithm is
followed for routing. It has been found that the queue of the link
host6-host5 goes down to zero at 3.3 sec and comes up to 50 again at
3.4 sec and that of the link host4-host3 goes down to 0 at 1.3 sec
and comes up to 50 again at 1.4 sec. The above-said transmissions
exist totally for 10.0 secs.
#Set the queue size of all links to 50 packets. Orient the nodes as
shown in the figure. Set labels for transmitting and receiving nodes
as Annie and Peter respectively as shown in the figure. Set label for
each link indicating its bandwidth, and delay as shown in the figure.
Set the shape of the transmitting and receiving nodes to hexagon and
box, and color, to red and blue, respectively. Set the color of the
traffic flow from Annie to Peter to red and that from Peter to Annie
to blue. Set nam and .tr tracings. Analyze the .tr trace file to get
details on dropped packets during this transmission scenario.
#create new simulator object
set ns [new Simulator]
#set nam and .tr tracings
set nf [open Q44.nam w]
$ns namtrace-all $nf
set tf [open Q44.tr w]
$ns trace-all $tf
#finish procedure
proc finish {} {
global ns nf tf
$ns flush-trace
close $nf
close $tf
exec nam Q44.nam &
exit 0
}
#add nodes
for {set i 0} {$i<8} {incr i} {
set n($i) [$ns node]
}
#set node parameters
$n(0) shape hexagon
$n(0) color red
$ns at 0.0 "$n(0) label \"Annie\""
$n(2) shape box
$n(2) color blue
$ns at 0.0 "$n(2) label \"Peter\""
$ns
$ns
$ns
$ns
$ns
$ns
at
at
at
at
at
at
0.0
0.0
0.0
0.0
0.0
0.0
"$n(1)
"$n(3)
"$n(4)
"$n(5)
"$n(6)
"$n(7)
#add links
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
label
label
label
label
label
label
$n(0)
$n(1)
$n(0)
$n(3)
$n(4)
$n(0)
$n(5)
$n(6)
$n(7)
\"host1\""
\"host3\""
\"host4\""
\"host5\""
\"host6\""
\"host7\""
$n(1)
$n(2)
$n(3)
$n(4)
$n(2)
$n(5)
$n(6)
$n(7)
$n(2)
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
100ms
100ms
100ms
100ms
100ms
100ms
100ms
100ms
100ms
$n(1)
$n(2)
$n(3)
$n(4)
$n(2)
$n(5)
$n(6)
$n(7)
$n(2)
orient
orient
orient
orient
orient
orient
orient
orient
orient
$ns
$ns
$ns
$ns
$ns
$ns
$ns
$ns
$ns
$n(1)
$n(2)
$n(3)
$n(4)
$n(2)
$n(5)
$n(6)
$n(7)
$n(2)
label
label
label
label
label
label
label
label
label
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
$n(0)
$n(1)
$n(0)
$n(3)
$n(4)
$n(0)
$n(5)
$n(6)
$n(7)
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
right
right
right-up
right
right-down
right-down
right
right
right-up
"\
"\
"\
"\
"\
"\
"\
"\
"\
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
0"
50"
0"
50"