0% found this document useful (0 votes)
7 views2 pages

Prog 2

The document outlines a simulation setup for a 3-node point-to-point duplex link using a network simulator. It specifies the configuration of nodes, links, queue limits, and UDP connections, along with traffic generation parameters. Additionally, it includes an AWK script to count and report the number of packets received and dropped during the simulation.

Uploaded by

kiccha1223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Prog 2

The document outlines a simulation setup for a 3-node point-to-point duplex link using a network simulator. It specifies the configuration of nodes, links, queue limits, and UDP connections, along with traffic generation parameters. Additionally, it includes an AWK script to count and report the number of packets received and dropped during the simulation.

Uploaded by

kiccha1223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Implement a 3 node point to point duplex link Set queue size, vary the bandwidth and note the

no. of packets received and dropped.

#create the simulator


set ns [new Simulator]
set nf [open prog1.nam w]
$ns namtrace-all $nf
set nd [open prog1.tr w]
$ns trace-all $nd
proc finish { } {
global ns nf nd
$ns flush-trace
close $nf
close $nd
exec nam prog1.nam &
exec awk -f 3n.awk prog1.tr &
exit 0
}
# create 3 nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 756Kb 10ms DropTail
$ns queue-limit $n1 $n2 5
# Set up UDP Connection
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
set sink [new Agent/Null]
$ns attach-agent $n2 $sink
$ns connect $udp0 $sink

$ns at 0.2 "$cbr0 start"


$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"
$ns run
—-----------------------------------------------------AWK FILE—-------------------------------------
BEGIN{
dcount=0;
rcount=0;
}
{
event =$1;
if(event =="d")
{
dcount++
}
if(event =="r")
{
rcount++
}
}
END{
printf("The no.of packets dropped:%d\n", dcount)
printf("The no.of packets dropped:%d\n", rcount)
}

You might also like