How to Start Point to Multipoint Topology Projects Using NS2

To start Point-to-Multipoint Topology utilising NS2 (Network Simulator 2) that involves replicates a network in which one central node (source) interact with numerous end nodes. This topology is typically leveraged within broadcasting, multicast applications, and wireless interaction networks.

Below is a common approach to configure and simulate a Point-to-Multipoint Topology project in NS2:

Steps to Start Point-to-Multipoint Topology Projects in NS2

  1. Understand Point-to-Multipoint Topology
  • Point-to-Multipoint:
    • A single source interacts with numerous destinations.
    • It is frequently utilised in video broadcasting, sensor data distribution, or multicast interaction.
  • Key Characteristics:
    • This topology is effective for one-to-many interaction.
    • Make use of multicast or broadcast for minimizing network load.
  1. Set Up NS2
  1. Install NS2:
    • Make sure that we have installed NS2 and properly functioning.
    • Confirm installation by executing an example simulation script:

ns example.tcl

  1. Tools:
    • NAM (Network Animator) is designed for visualization process.
    • Trace File Analysis tools supports to examine the performance parameters.
  1. Plan the Topology
  • Nodes:
    • We define the topology that contains one central source node.
    • Several destination nodes.
  • Traffic:
    • Unicast or multicast traffic flow from the source to destinations nodes.
  1. Write the Simulation Script

Step 4.1: Create the TCL Script

We need to store the tcl simulation script like point_to_multipoint.tcl.

Step 4.2: Initialize the Simulator

Describe the simulator and finding the file:

set ns [new Simulator]

set tracefile [open trace.tr w]

$ns trace-all $tracefile

set namfile [open point_to_multipoint.nam w]

$ns namtrace-all $namfile

Step 4.3: Create Nodes

Specify the source and destination nodes:

# Source node

set src [$ns node]

# Destination nodes

set dst1 [$ns node]

set dst2 [$ns node]

set dst3 [$ns node]

Step 4.4: Configure Links

Associate the source to every single destination node:

# Links between source and destinations

$ns duplex-link $src $dst1 1Mb 10ms DropTail

$ns duplex-link $src $dst2 1Mb 10ms DropTail

$ns duplex-link $src $dst3 1Mb 10ms DropTail

Step 4.5: Setup Traffic

  • Set up traffic from the source to end node:

# Traffic to dst1

set udp1 [new Agent/UDP]

$ns attach-agent $src $udp1

set null1 [new Agent/Null]

$ns attach-agent $dst1 $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 to dst2

set udp2 [new Agent/UDP]

$ns attach-agent $src $udp2

set null2 [new Agent/Null]

$ns attach-agent $dst2 $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”

# Traffic to dst3

set udp3 [new Agent/UDP]

$ns attach-agent $src $udp3

set null3 [new Agent/Null]

$ns attach-agent $dst3 $null3

$ns connect $udp3 $null3

set cbr3 [new Application/Traffic/CBR]

$cbr3 attach-agent $udp3

$cbr3 set packetSize_ 512

$cbr3 set rate_ 100kb

$ns at 3.0 “$cbr3 start”

Step 4.6: Finalize the Script

Integrate the simulation end condition to finish the script:

$ns at 10.0 “finish”

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam point_to_multipoint.nam &

exit 0

}

$ns run

  1. Run the Simulation
  1. We can store the TCL script like point_to_multipoint.tcl in NS2.
  2. Execute the simulation using tcl script:

ns point_to_multipoint.tcl

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

nam point_to_multipoint.nam

  1. Analyze Results
  • Trace File Analysis:
    • Measure the performance parameters in terms of throughput and delay to leverage trace.tr.
    • Example AWK script for throughput:

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

  • Key Metrics:
    • Throughput: Estimate the rate of data transfer.
    • Latency: Compute average delay within data delivery.
    • Packet Delivery Ratio (PDR): Measure how effectively packets distributed.
  1. Expand the Simulation
  • Add Multicast Routing:
    • Make use of protocols such as Multicast Protocol for Low-bandwidth and Delay-sensitive Applications (MLD).
  • Simulate Network Failures:
    • Launch link failures and then monitor the effect:

$ns at 5.0 “$ns link-fail $src $dst2”

  • Incorporate Different Traffic Types:
    • We may integrate the TCP or FTP traffic for various kinds of traffic applications:

set ftp [new Application/FTP]

$ftp attach-agent $udp1

  1. Document the Project
  • Objective: Initially, we define the project’s goals of replicating the Point-to-Multipoint Topology.
  • Setup: Specify the nodes, links, and traffic modes for configuration.
  • Results: It has graphs and parameters for throughput, latency, and PDR.
  • Conclusions: Sum up explanations and possible enhancements.

In this project, we can learn about the simulation mechanisms that support to set up and simulate the Point to Multipoint Topology Projects in NS2 environment. If you’d like further extension of this project, we will give assistance to you.