How to Start Fully Connected Topology Projects Using NS2

To stimulate the Fully Connected Topology in NS2 (Network Simulator 2) has replicate the network in which every node is connected directly for each node. This network topology is frequently used to classify the robust and high-redundancy network like as small-scale wireless networks or tightly coupled systems.

Here’s a step-by-step guide to simulate a Fully Connected Topology project in NS2:

Steps to Start Fully Connected Topology Projects Using NS2

  1. Understand Fully Connected Topology
  • Fully Connected Topology:
    • Each node has linked the directly for other nodes.
    • Delivers the maximum redundancy and fault tolerance.
  • Advantages:
    • High reliability during the several paths.
    • Minimal data transfer delays.
  • Disadvantages:
    • Difficult and expensive for execute the large number of nodes.
  1. Set up NS2
  1. Install NS2:
    • Install NS2 and assure for operates the correctly.
    • Validate through process for a basic TCL script:

ns example.tcl

  1. Tools for Analysis:
    • Visualization the NAM (Network Animator) for network topology.
    • Trace File Analysis tools like AWK for performance metrics.
  1. Plan the Fully Connected Topology
  • Topology Design:
    • Define a set of nodes.
    • Generate a duplex connection among the every pair of nodes.
  • Traffic Pattern:
    • Congestion flows among all nodes for validate the full connectivity.
  1. Write the Simulation Script

Step 4.1: Create the TCL Script

Store the file as fully_connected_topology.tcl.

Step 4.2: Initialize the Simulator

Starts through initializing the replicator for ensure the tracing:

set ns [new Simulator]

set tracefile [open trace.tr w]

$ns trace-all $tracefile

set namfile [open fully_connected_topology.nam w]

$ns namtrace-all $namfile

Step 4.3: Create Nodes

Describe the nodes for the topology:

# Create 5 nodes for the fully connected topology

set n1 [$ns node]

set n2 [$ns node]

set n3 [$ns node]

set n4 [$ns node]

set n5 [$ns node]

Step 4.4: Configure Links

Link the every node for other nodes:

# Fully connected links

$ns duplex-link $n1 $n2 1Mb 10ms DropTail

$ns duplex-link $n1 $n3 1Mb 10ms DropTail

$ns duplex-link $n1 $n4 1Mb 10ms DropTail

$ns duplex-link $n1 $n5 1Mb 10ms DropTail

$ns duplex-link $n2 $n3 1Mb 10ms DropTail

$ns duplex-link $n2 $n4 1Mb 10ms DropTail

$ns duplex-link $n2 $n5 1Mb 10ms DropTail

$ns duplex-link $n3 $n4 1Mb 10ms DropTail

$ns duplex-link $n3 $n5 1Mb 10ms DropTail

$ns duplex-link $n4 $n5 1Mb 10ms DropTail

Step 4.5: Configure Traffic

It configures the congestion among the nodes:

# Traffic from n1 to n2

set udp1 [new Agent/UDP]

$ns attach-agent $n1 $udp1

set null1 [new Agent/Null]

$ns attach-agent $n2 $null1

$ns connect $udp1 $null1

set cbr1 [new Application/Traffic/CBR]

$cbr1 attach-agent $udp1

$cbr1 set packetSize_ 512

$cbr1 set rate_ 100kb

$ns at 1.0 “$cbr1 start”

# Traffic from n2 to n3

set udp2 [new Agent/UDP]

$ns attach-agent $n2 $udp2

set null2 [new Agent/Null]

$ns attach-agent $n3 $null2

$ns connect $udp2 $null2

set cbr2 [new Application/Traffic/CBR]

$cbr2 attach-agent $udp2

$cbr2 set packetSize_ 512

$cbr2 set rate_ 100kb

$ns at 2.0 “$cbr2 start”

Repeat the same congestion setting for other pairs of nodes.

Step 4.6: Finalize the Script

Increase the replication of end conditions and complete the configuration:

$ns at 10.0 “finish”

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam fully_connected_topology.nam &

exit 0

}

$ns run

  1. Run the Simulation
  1. Protect the script as fully_connected_topology.tcl.
  2. Process for the script:

ns fully_connected_topology.tcl

  1. Go to the NAM file for envision the topology:

nam fully_connected_topology.nam

  1. Analyze Results
  • Trace File Analysis:
    • Examine the trace.tr for performance metrics such as throughput, latency, and packet delivery ratio.
    • Sample AWK script for throughput:

awk ‘{if ($1 == “r” && $4 == “udp”) sum += $8} END {print “Throughput: “, sum}’

  • Key Metrics:
    • Throughput: Amount of data has successfully delivered.
    • Latency: Normal delay for packet delivery.
    • Packet Delivery Ratio (PDR): Ratio of delivered packets for forwards the packets.
  1. Expand the Simulation
  1. Simulate Node Failures:
    • Establish the node or connection failures and follow the effects:

$ns at 5.0 “$ns link-fail $n1 $n2”

  1. Vary Traffic Patterns:
    • Improve the design for TCP or FTP in congestion for diverse environment:

set tcp [new Agent/TCP]

$ns attach-agent $n3 $tcp

  1. Increase Network Size:
    • Enhance further nodes and connection for discover the scalability.
  1. Document the Project
  • Objective: Define the purpose for replicate a Fully Connected Topology.
  • Setup: The settings are specific nodes, connection, and congestion setting.
  • Results: Now the results are view the graphs and performance of metrics for throughput, latency, and PDR.
  • Conclusions: Summarize the detection and refer the improvements.

Finally, we clearly discussed about the fully connected topology and their explanations and also we provide all kinds of connected topology using ns2 environment. Any uncertainties about the project will be addressed in a follow-up manual.