How to Start Switched Mesh Topology Projects Using NS2
To start a Switched Mesh Topology project using NS2 (Network Simulator 2), we have to replicate a mesh network in which switches are handle interaction among the nodes. This topology is frequently utilised within scalable and fault-tolerant networks such as data centers and industrial systems.
Below is a common procedure on how to configure and replicate a Switched Mesh Topology project in NS2:
Steps to Start Switched Mesh Topology Projects in NS2
- Understand Switched Mesh Topology
- Switched Mesh Topology:
- Nodes are linked within a mesh structure including switches are handling the interaction.
- It offers high redundancy and fault tolerance.
- Applications:
- Industrial IoT systems.
- High-performance computing networks.
- Data centers.
- Key Features:
- It supports to handle the interaction by switches.
- Redundant paths for fault tolerance.
- Set Up NS2
- Install NS2:
- We can set up and confirm the NS2 environment to utilise an example script:
ns example.tcl
- Tools for Analysis:
- NAM (Network Animator) is designed for topology visualization.
- Trace Analysis Tools are utilised to examine the performance parameters such as latency, throughput, and packet delivery ratio (PDR).
- Plan the Switched Mesh Topology
- Topology Structure:
- We can define the topology with mesh links among the switches and nodes.
- According to the logical or physical connections, changes forward packets.
- Metrics to Analyze:
- Latency.
- Network throughput.
- Packet delivery ratio (PDR).
- Write the Simulation Script
Step 4.1: Create the TCL Script
We will need to store the tcl simulation script like switched_mesh_topology.tcl in NS2.
Step 4.2: Initialize the Simulator
Configure the simulator:
# Initialize the simulator
set ns [new Simulator]
set tracefile [open trace.tr w]
$ns trace-all $tracefile
set namfile [open switched_mesh_topology.nam w]
$ns namtrace-all-wireless $namfile
Step 4.3: Create Nodes and Switches
Describe the switches and end nodes:
# Create switches
set switch1 [$ns node]
set switch2 [$ns node]
set switch3 [$ns node]
# Create end nodes
set node1 [$ns node]
set node2 [$ns node]
set node3 [$ns node]
set node4 [$ns node]
Step 4.4: Configure Links
In a mesh and link nodes, associate the switches into switches:
# Switch-to-Switch Mesh Links
$ns duplex-link $switch1 $switch2 1Gb 10ms DropTail
$ns duplex-link $switch2 $switch3 1Gb 10ms DropTail
$ns duplex-link $switch3 $switch1 1Gb 10ms DropTail
# Node-to-Switch Links
$ns duplex-link $node1 $switch1 100Mb 5ms DropTail
$ns duplex-link $node2 $switch1 100Mb 5ms DropTail
$ns duplex-link $node3 $switch2 100Mb 5ms DropTail
$ns duplex-link $node4 $switch3 100Mb 5ms DropTail
Step 4.5: Configure Traffic
Configure traffic flows among the nodes:
# Traffic from node1 to node4
set udp1 [new Agent/UDP]
$ns attach-agent $node1 $udp1
set null1 [new Agent/Null]
$ns attach-agent $node4 $null1
$ns connect $udp1 $null1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packetSize_ 512
$cbr1 set rate_ 50Mb
$ns at 1.0 “$cbr1 start”
# Traffic from node2 to node3
set udp2 [new Agent/UDP]
$ns attach-agent $node2 $udp2
set null2 [new Agent/Null]
$ns attach-agent $node3 $null2
$ns connect $udp2 $null2
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set packetSize_ 512
$cbr2 set rate_ 50Mb
$ns at 2.0 “$cbr2 start”
Step 4.6: Enable Routing Protocol
- Make use of a routing protocol which is appropriate for mesh topologies like AODV:
# Enable AODV Routing Protocol
$ns rtproto AODV
Step 4.7: Finalize the Script
Integrate the simulation end conditions to finish the script:
# End simulation
$ns at 10.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam switched_mesh_topology.nam &
exit 0
}
$ns run
- Run the Simulation
- We require storing the tcl script like switched_mesh_topology.tcl.
- Then, execute the simulation script with NS2:
ns switched_mesh_topology.tcl
- Go to NAM for envisioning the topology:
nam switched_mesh_topology.nam
- Analyze Results
- Trace File Analysis:
- Compute the performance metrics like throughput, latency, and PDR to utilise trace.tr.
- Example AWK script for estimating the throughput:
awk ‘{if ($1 == “r” && $4 == “udp”) sum += $8} END {print “Throughput: “, sum}’
- Metrics:
- Packet Delivery Ratio (PDR): Calculate the rate of packets that are delivered in network reliability.
- Latency: Examine the delays within interaction.
- Throughput: Measure the data delivery effectiveness.
- Expand the Simulation
- Simulate Link Failures:
- Launch link failures to experiment the fault tolerance:
$ns at 5.0 “$ns link-fail $switch1 $switch2”
- Increase Network Size:
- Integrate additional switches and nodes to balance the network.
- Compare Routing Protocols:
- Experiment the performance with various routing protocols such as DSDV or DSR.
- Test Different Traffic Patterns:
- Set up various traffic models like bi-directional or multicast traffic.
- Document the Project
- Objective: Define the project’s goals of replicating a switched mesh topology.
- Setup: Specify the network structure, routing protocols, and traffic sets up.
- Results: It provides performance parameters such as throughput, latency, and PDR.
- Conclusions: Sum up outcomes and recommend enhancements.
This guide should deliver strong basics to start and simulate the Switched Mesh Topology project in NS2 platform through above method. Additional details will appear in upcoming manual.