Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
#There are two LANs each comprising 4 hosts. These LANs are connected
via a router as shown in the figure. Each LAN is having a bandwidth
of 2Mbps and a delay of 100ms. These LANs use CSMA/CD (IEEE 802.3) as
LAN protocol.
#The host named Annie on LAN1 is transmitting data to the host named
Peter on LAN2 over a reliable, connection-oriented communication at a
rate of 0.1Mbps in 1000 bytes long packets. A sliding window protocol
with a window size of 8 is used for a reliable data transfer. It has
been found that the queue of the link router1-host4 goes down to 0 at
1.65 sec and comes up again to 100 at 1.80 sec and that of the link
router1-host3, down to 0 at 7.15 sec and up again to 100 at 7.19 sec.
#Set the queue size of all links to 100 packets. Orient the nodes as
shown in the figure. Set labels for transmitting and receiving nodes
as Annie and Peter 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. 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 Q77.nam w]
$ns namtrace-all $nf
#finish procedure
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam Q77.nam &
exit 0
}
#add nodes
for {set i 0} {$i<9} {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(7) shape box
$n(7) color blue
$ns at 0.0 "$n(7) label \"Peter\""
$ns
$ns
$ns
$ns
$ns
$ns
$ns
at
at
at
at
at
at
at
0.0
0.0
0.0
0.0
0.0
0.0
0.0
"$n(1)
"$n(2)
"$n(3)
"$n(4)
"$n(5)
"$n(6)
"$n(8)
label
label
label
label
label
label
label
\"host1\""
\"host2\""
\"host3\""
\"host4\""
\"host5\""
\"host6\""
\"router1\""
#add links
$ns duplex-link $n(3) $n(8) 1Mb 100ms DropTail
$ns duplex-link $n(8) $n(4) 1Mb 100ms DropTail
$n(8)
$n(8)
$n(8)
$n(8)
$n(4)
$n(4)
$n(3)
$n(3)
0"
100"
0"
100"