How to Simulate Overlay Topology Projects Using NS2

To simulate the Overlay Topology in ns2 has needs to follow numerous steps and it is basically defined as a virtual topology in which the nodes in the overlay network are associated by logical links that can extent multiple physical links. This topology is usually utilized in peer-to-peer (P2P) networks, virtual private networks (VPNs), content distribution networks (CDNs), and application-layer multicast. The overlay topology is built on first of a prevailing physical network that permits the nodes to interact via logical connections autonomous of the fundamental physical infrastructure.

To simulate an Overlay Topology in NS2, we can describe logical links among nodes since the actual communication can happen via multiple physical network paths.

Here’s how you can simulate an Overlay Topology project using NS2:

Steps to Simulate Overlay Topology Projects in NS2

  1. Set up NS2 Environment:

Make sure that NS2 is installed and configured properly. We will compose a TCL script to replicate both the physical topology and the overlay topology, with logical links on uppermost of the physical network.

  1. Understanding Overlay Topology:
  • The physical topology denoted the actual network, with nodes and routers associated by physical links.
  • The overlay topology is generated on eminent of the physical topology using logical links, in which the each logical link can span multiple physical hops.
  • Overlay nodes can interact by using these logical links since the original data flows via the fundamental of physical network.
  1. Create a TCL Script for Overlay Topology:

Below is an instance of TCL script in which it replicates an Overlay Topology with 4 overlay nodes on eminent of a physical network of 6 nodes:

# Create a new simulator instance

set ns [new Simulator]

# Open a NAM trace file for visualization

set nf [open out.nam w]

$ns namtrace-all $nf

# ======= Physical Network Topology =======

# Create 6 physical nodes representing the physical network

set p0 [$ns node]

set p1 [$ns node]

set p2 [$ns node]

set p3 [$ns node]

set p4 [$ns node]

set p5 [$ns node]

# Create physical links between the physical nodes

$ns duplex-link $p0 $p1 10Mb 10ms DropTail

$ns duplex-link $p1 $p2 10Mb 10ms DropTail

$ns duplex-link $p2 $p3 10Mb 10ms DropTail

$ns duplex-link $p3 $p4 10Mb 10ms DropTail

$ns duplex-link $p4 $p5 10Mb 10ms DropTail

$ns duplex-link $p5 $p0 10Mb 10ms DropTail

# ======= Overlay Topology =======

# Define overlay nodes mapped to physical nodes

set overlay0 $p0   ;# Overlay node 0 mapped to physical node p0

set overlay1 $p2   ;# Overlay node 1 mapped to physical node p2

set overlay2 $p4   ;# Overlay node 2 mapped to physical node p4

set overlay3 $p1   ;# Overlay node 3 mapped to physical node p1

# Create logical links between overlay nodes to form the overlay network

# Note: These logical links traverse multiple physical links in the physical network

$ns simplex-link $overlay0 $overlay1 10Mb 50ms DropTail  ;# Logical link from overlay0 to overlay1

$ns simplex-link $overlay1 $overlay2 10Mb 50ms DropTail  ;# Logical link from overlay1 to overlay2

$ns simplex-link $overlay2 $overlay3 10Mb 50ms DropTail  ;# Logical link from overlay2 to overlay3

$ns simplex-link $overlay3 $overlay0 10Mb 50ms DropTail  ;# Logical link from overlay3 to overlay0

# ======= Traffic Generation in Overlay Network =======

# Attach UDP agents to the overlay nodes

set udp0 [new Agent/UDP]

$ns attach-agent $overlay0 $udp0

set udp1 [new Agent/UDP]

$ns attach-agent $overlay2 $udp1

# Attach Null agents (traffic sinks) to overlay nodes

set null0 [new Agent/Null]

$ns attach-agent $overlay1 $null0

set null1 [new Agent/Null]

$ns attach-agent $overlay3 $null1

# Connect the UDP agents to Null agents (logical communication in the overlay network)

$ns connect $udp0 $null0

$ns connect $udp1 $null1

# Create CBR traffic generators and attach them to UDP agents in the overlay network

set cbr0 [new Application/Traffic/CBR]

$cbr0 attach-agent $udp0

$cbr0 set packetSize_ 512

$cbr0 set rate_ 100Kb

set cbr1 [new Application/Traffic/CBR]

$cbr1 attach-agent $udp1

$cbr1 set packetSize_ 512

$cbr1 set rate_ 100Kb

# Schedule the traffic in the overlay network

$ns at 1.0 “$cbr0 start”

$ns at 1.5 “$cbr1 start”

$ns at 5.0 “$cbr0 stop”

$ns at 5.5 “$cbr1 stop”

# End the simulation at 6 seconds

$ns at 6.0 “finish”

proc finish {} {

global ns nf

$ns flush-trace

close $nf

exec nam out.nam &

exit 0

}

# Run the simulation

$ns run

  1. Explanation of the Code:
  • Physical Network: Six physical nodes (p0, p1,…., p5) are generated, and physical links are configures among them to custom a simple looped network.
  • Overlay Nodes: Four overlay nodes are generated by mapping them to physical nodes (overlay0 mapped to p0, overlay1 mapped to p2, overlay2 mapped to p4, overlay3 mapped to p1).
  • Logical Links: Logical links are generated among the overlay nodes. These logical links denote communication paths in the overlay topology, although the actual communication happens over the physical network.
  • UDP Traffic: UDP agents are attached to overlay nodes to replicate the traffic flow over the logical links. Useless agents are attached because of traffic sinks.
  • CBR Traffic: Constant Bit Rate (CBR) traffic is created among overlay nodes replicates overlay network communication over logical links.
  • Traffic Scheduling: The CBR traffic initiates at 1.0 and 1.5 seconds and terminates at 5.0 and 5.5 seconds.
  • Simulation End: The simulation terminates at 6 seconds, and the outcomes are saved in a .nam file for visualization.
  1. Run the Simulation:
  1. Save the script as overlay_topology.tcl.
  2. Open a terminal and navigate to the folder in which the script is saved.
  3. Execute the simulation using:

ns overlay_topology.tcl

  1. The simulation will creates out.nam file that can be opened using Network Animator (NAM) for visualization.
  1. Visualization in NAM:
  • Open the out.nam file in NAM to envision the physical network. We will see physical links associating physical nodes, and overlay traffic flowing among overlay nodes via logical links.
  1. Customization and Enhancements:
  • Increase the Number of Overlay Nodes: we can incorporate more overlay nodes by mapping added physical nodes to logical nodes and generating logical links among them.
  • TCP Traffic: We can replace the UDP agents with TCP agents to replicate reliable communication over the overlay network:

set tcp0 [new Agent/TCP]

$ns attach-agent $overlay0 $tcp0

set sink0 [new Agent/TCPSink]

$ns attach-agent $overlay1 $sink0

$ns connect $tcp0 $sink0

  • Different Traffic Patterns: We can generate multiple traffic flows and discover different communication patterns in the overlay network.
  • Performance Metrics: Incorporate trace files to evaluate the parameters like packet loss, delay, and throughput:

set tracefile [open trace.tr w]

$ns trace-all $tracefile

  1. Performance Analysis:

To measure the performance of the overlay topology, we can:

  • Evaluate throughput to monitor how much data is successfully routed over the logical links in the overlay network.
  • Evaluate latency to understand the latency experienced by overlay traffic, especially when it traverses multiple physical hops.
  • Evaluate packet loss to measure the reliability of the overlay network.

In this setup we had clearly gather information on how to setup the simulation and how to replicate the Overlay Topology using ns2 tool. We will offer insights into the implementation of the Overlay Topology in diverse simulation scenarios. phdprime.com will provide top simulation results and excellent topic ideas in this field.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2