Mesh Topology
A network setup where each computer and network device is interconnected with one another, allowing for most transmissions to be distributed, even if one of the connections go down. This topology is not commonly used for most computer networks as it is difficult and expensive to have redundant connection to every computer. However, this topology is commonly used for wireless networks. Below is a visual example of a simple computer setup on a network using a mesh topology.
A mesh topology can be a full mesh topology or a partially connected mesh topology.
In a full mesh topology, every computer in the network has a connection to each of the other computers in that network. The number of connections in this network can be calculated using the following formula (n is the number of computers in the network): n(n-1)/2
Specifications:
i. A Mesh Topology of 5 nodes
ii. Full-duplex links, 1 Mb, delay 2ms and queue type: droptail
iii. Traffic TCP with CBR
iv. Orient the nodes to look like a mesh network
Write a TCL script to simulate mesh topology of 5 nodes.
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit0
}
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
$ns duplex-link $n0 $n1 1Mb 2ms DropTail
$ns duplex-link $n0 $n2 1Mb 2ms DropTail
$ns duplex-link $n0 $n3 1Mb 2ms DropTail
$ns duplex-link $n0 $n4 1Mb 2ms DropTail
$ns duplex-link $n1 $n2 1Mb 2ms DropTail
$ns duplex-link $n1 $n3 1Mb 2ms DropTail
$ns duplex-link $n1 $n4 1Mb 2ms DropTail
$ns duplex-link $n2 $n3 1Mb 2ms DropTail
$ns duplex-link $n2 $n4 1Mb 2ms DropTail
$ns duplex-link $n3 $n4 1Mb 2ms DropTail
$ns duplex-link-op $n0 $n4 orient right
$ns duplex-link-op $n1 $n0 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right-down
$ns duplex-link-op $n3 $n4 orient left-down
$ns duplex-link-op $n3 $n2 orient right-down
set tcp0 [new Agent/TCP]
set ftp0 [new Application/FTP]
set tcp1 [new Agent/TCPSink]
$ns attach-agent $n1 $tcp0
$ns attach-agent $n4 $tcp1
$ftp0 attach-agent $tcp0
$ns connect $tcp0 $tcp1
#Schedule events for the CBR agents
$ns at 0.5 "$ftp0 start"
$ns at 4.5 "$ftp0 stop"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"
#Run the simulation
$ns run
AWK Program
BEGIN {
PktRcd =0;
ByteRcd = 0;
ackCount=0;
}
{
if ($1=="r")
{
PktRcd += 1;
ByteRcd += $6;
}
if ($5=="ack")
{
ackCount += 1;
}
}
END {
printf ("\nPackets Received = %d\n Byte Received =%d \n Acknowledgementreceived =%d\n", PktRcd, ByteRcd, ackCount);
}
The display of Metric is given below: