How to Start Hybrid Topology Projects Using NS2
To simulate a Hybrid Topology project in NS2 (Network Simulator 2) has been involve the relating the several network topologies for sample star, mesh, bus, ring in single network to discover the benefits of every architecture. Hybrid topologies are frequently used in large-the scale of heterogeneous networks.
Here’s how you can set up and run a Hybrid Topology project in NS2:
Steps to Start Hybrid Topology Projects Using NS2
- Understand Hybrid Topology
- Hybrid Topology:
- Associate the two or more simple topologies for sample Star + Mesh, Ring + Bus.
- Used the topology for scalable and modular networks for instance corporate or campus networks.
- Advantages:
- It has provided the flexible and scalable.
- It includes the fault tolerance and redundancy.
- Disadvantages:
- Difficult the settings and management.
- Set Up NS2
- Install NS2:
- Assure the NS2 tool is correctly installed and operates.
- Validate the installation by a simple replication of script:
ns example.tcl
- Tools:
- The tool is NAM (Network Animator) for envision.
- Trace Analysis tools like AWK for performance metrics.
- Plan the Hybrid Topology
- Example Setup:
- A Star Topology at the assign the layer.
- A Mesh Topology intended for interrelating the central nodes.
- A Bus Topology designed for backbone communication.
- Metrics to Analyze:
- The hybrid topology has considered the performance of parameter metrices Throughput, latency, and fault tolerance.
- Write the Simulation Script
Step 4.1: Create a TCL Script
Store the script as hybrid_topology.tcl.
Step 4.2: Initialize the Simulator
Start through describing the replicator and tracing:
set ns [new Simulator]
set tracefile [open trace.tr w]
$ns trace-all $tracefile
set namfile [open hybrid_topology.nam w]
$ns namtrace-all $namfile
Step 4.3: Create Nodes
- Access Layer (Star Topology):
# Star topology with hub and peripheral nodes
set hub1 [$ns node]
set node1 [$ns node]
set node2 [$ns node]
set node3 [$ns node]
$ns duplex-link $hub1 $node1 1Mb 10ms DropTail
$ns duplex-link $hub1 $node2 1Mb 10ms DropTail
$ns duplex-link $hub1 $node3 1Mb 10ms DropTail
- Core Layer (Mesh Topology):
# Mesh topology interconnecting hubs
set hub2 [$ns node]
set hub3 [$ns node]
$ns duplex-link $hub1 $hub2 1Mb 5ms DropTail
$ns duplex-link $hub1 $hub3 1Mb 5ms DropTail
$ns duplex-link $hub2 $hub3 1Mb 5ms DropTail
- Backbone Layer (Bus Topology):
# Bus topology backbone
set backbone1 [$ns node]
set backbone2 [$ns node]
$ns duplex-link $hub2 $backbone1 10Mb 2ms DropTail
$ns duplex-link $hub3 $backbone2 10Mb 2ms DropTail
$ns duplex-link $backbone1 $backbone2 10Mb 2ms DropTail
Step 4.4: Configure Traffic
- Enhance the congestion sources and destinations:
# Traffic from node1 to node3
set udp1 [new Agent/UDP]
$ns attach-agent $node1 $udp1
set null1 [new Agent/Null]
$ns attach-agent $node3 $null1
$ns connect $udp1 $null1
# Add CBR traffic
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packetSize_ 512
$cbr1 set rate_ 100kb
$ns at 1.0 “$cbr1 start”
$ns at 5.0 “$cbr1 stop”
Step 4.5: Enable Routing
- Use the dynamic routing protocols such as AODV:
$ns rtproto DV
Step 4.6: Finalize the Script
- Enhance the replication of environments:
$ns at 10.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam hybrid_topology.nam &
exit 0
}
$ns run
- Run the Simulation
- Store the script as hybrid_topology.tcl.
- It process for the implementation:
ns hybrid_topology.tcl
- Open the NAM file for visualization:
nam hybrid_topology.nam
- Analyze Results
- Trace File Analysis:
- Examine the files trace.tr for metrics like as throughput and delay.
- Sample AWK script for estimate the throughput:
awk ‘{if ($1 == “r” && $4 == “tcp”) sum += $8} END {print “Throughput: “, sum}’
- Key Metrics:
- Throughput: Measure the data transfer rates.
- Latency: It measures the delays in data transmission.
- Packet Delivery Ratio: Check the effectiveness for data delivery.
- Expand the Simulation
- Add Failure Scenarios:
- It replicate the connection or node failures and monitor the effect:
$ns at 3.0 “$ns link-fail $hub1 $hub2”
- Use Different Traffic Patterns:
- Enhance the TCP, FTP, or voice traffic for replicate the diverse applications.
- Increase Network Size:
- Increase the further nodes and topologies for scale the network.
- Document the Project
- Objective: Describe why selected the Hybrid Topology.
- Setup: Define the related for topologies.
- Results: Current outcomes performance for metrics and observations.
- Conclusions: Summarize conclusions and suggestions for optimization.
The given above is the fundamental approach that was illustrated with sample coding for hybrid topology project that were simulated across the ns2 environment. Additional queries regarding this project will be addressed in another document.