How to Implement Overlay Topology in NS2

To implement the Overlay Topology is a virtual network erected on top of an existing network like the Internet or another physical network in which the nodes are form logical connections which may not directly reflect the underlying physical network. In this topology, some nodes performs as intermediaries to send traffic then forming a logical structure that is independent of the physical topology. This networks are generally used in content delivery networks (CDNs), distributed networks, peer-to-peer (P2P) systems, and other applications in which a virtual setup is made across a physical network. We provide simplified protocol to execute the Overlay topology in the simulation NS2:

Steps to Implement Overlay Topology in NS2:

  1. Set Up the Underlying Physical Network:
    • Describe the physical network by making a nodes and physical links among them.
    • Those links are denote the underlying physical network such as the Internet or an intranet.
  2. Create Overlay Nodes:
    • Describe overlay nodes that will built the logical connections across the physical network.
    • To make a logical connections or overlay links among the overlay nodes that are formed on top of the physical network.
  3. Simulate Traffic Flow:
    • Create traffic among the overlay nodes including packets forwarded via physical nodes and links as essential.

Example of Overlay Topology Implementation in NS2:

Given below is an instance script that establishes how to configure a basic overlay topology on top of a physical network with 5 physical nodes and 3 overlay nodes:

# Create a new simulator

set ns [new Simulator]

# Open trace file for output

set tracefile [open out.tr w]

$ns trace-all $tracefile

# ======= UNDERLYING PHYSICAL NETWORK =======

# Define physical nodes (underlying network)

set p0 [$ns node]  ;# Physical node 0

set p1 [$ns node]  ;# Physical node 1

set p2 [$ns node]  ;# Physical node 2

set p3 [$ns node]  ;# Physical node 3

set p4 [$ns node]  ;# Physical node 4

# Create duplex links for the physical network

$ns duplex-link $p0 $p1 1Mb 10ms DropTail  ;# Link between physical node 0 and 1

$ns duplex-link $p1 $p2 1Mb 10ms DropTail  ;# Link between physical node 1 and 2

$ns duplex-link $p2 $p3 1Mb 10ms DropTail  ;# Link between physical node 2 and 3

$ns duplex-link $p3 $p4 1Mb 10ms DropTail  ;# Link between physical node 3 and 4

# ======= OVERLAY NODES =======

# Define overlay nodes (logical network)

# Overlay nodes will map to the physical nodes, forming logical links on top of them

set o0 [$ns node]  ;# Overlay node 0

set o1 [$ns node]  ;# Overlay node 1

set o2 [$ns node]  ;# Overlay node 2

# ======= MAP OVERLAY NODES TO PHYSICAL NODES =======

# Overlay node 0 corresponds to physical node 0

$o0 set X_ [$p0 set X_]

$o0 set Y_ [$p0 set Y_]

# Overlay node 1 corresponds to physical node 2

$o1 set X_ [$p2 set X_]

$o1 set Y_ [$p2 set Y_]

# Overlay node 2 corresponds to physical node 4

$o2 set X_ [$p4 set X_]

$o2 set Y_ [$p4 set Y_]

# ======= CREATE LOGICAL LINKS (OVERLAY LINKS) =======

# These links represent the logical connections between overlay nodes, built on the physical network

$ns duplex-link $o0 $o1 1Mb 10ms DropTail  ;# Logical link between overlay node 0 and 1

$ns duplex-link $o1 $o2 1Mb 10ms DropTail  ;# Logical link between overlay node 1 and 2

# ======= TRAFFIC SIMULATION =======

# Define TCP agents for communication between overlay nodes

# Traffic from overlay node 0 to overlay node 2 (across the overlay network)

set tcp0 [new Agent/TCP]

set sink0 [new Agent/TCPSink]

$ns attach-agent $o0 $tcp0

$ns attach-agent $o2 $sink0

$ns connect $tcp0 $sink0

# Simulate FTP traffic from overlay node 0 to overlay node 2

set ftp0 [new Application/FTP]

$ftp0 attach-agent $tcp0

$ns at 1.0 “$ftp0 start”   ;# Start traffic at 1 second

# End the simulation after 10 seconds

$ns at 10.0 “finish”

proc finish {} {

global ns tracefile

$ns flush-trace

close $tracefile

exit 0

}

# Run the simulation

$ns run

Explanation of the Script:

  1. Underlying Physical Network:
    • The nodes p0, p1, p2, p3, and p4 are denote the physical nodes within the underlying network such as routers or switches in the Internet.
    • Duplex links signify the physical connections among those nodes that forming the physical topology.
  2. Overlay Nodes:
    • The nodes o0, o1, and o2 are signify the overlay nodes which built the logical network. This overlay nodes communicate via logical links that are built on top of the physical network.
    • These nodes are mapped to physical nodes. For specimen, o0 is mapped to p0, o1 is mapped to p2, and o2 is mapped to p4.
  3. Overlay Links:
    • Duplex links are made among the overlay nodes that demonstrating logical connections within the overlay network. For example, there is a logical link among o0 and o1, and other between the nodes o1 and o2.
  4. Traffic Simulation:
    • TCP agents replicate communication among the overlay nodes.
    • FTP (File Transfer Protocol) produces traffic which mimicking file transfers among the overlay nodes.
    • Traffic flows from o0 to o2 across the logical overlay network, however manually it may navigate the underlying physical nodes such as p0, p1, p2, p3, and p4.
  5. Simulation Duration:
    • For 10 seconds, the simulation runs while which traffic flows via the overlay network.

Post-Simulation Analysis:

  1. Trace File Analysis:
    • Here, open the trace file (out.tr) to monitor how packets are sent among the overlay nodes via the underlying physical network. Then examine the parameters such as packet delivery, latency, and throughput.
  2. NAM Visualization:
    • We can use the NAM (Network Animator) to envision both the physical and overlay topologies. We will observe how the overlay nodes are mapped onto the physical nodes and also how traffic flows among overlay nodes via the physical infrastructure.
  3. Performance Metrics:
    • Compute the network performance metrics like delay, throughput, and packet loss to estimate how successfully the overlay network behaves across the physical setup.

Enhancing the Simulation:

  1. Adding More Overlay Nodes:
    • Append more overlay nodes then map them to extra physical nodes to replicate a larger overlay network.
  2. Simulating Different Traffic Patterns:
    • Configure more traffic among various overlay nodes to mimic complex traffic patterns in the overlay network.
  3. Changing Traffic Type:
    • Sway TCP with UDP or use CBR (Constant Bit Rate) rather than FTP to mimic various kinds of traffic.
  4. Simulating Link Failures:
    • To replicate the failures in the physical or overlay links to monitor how the overlay network adjusts and reroutes traffic.
  5. Varying Link Parameters:
    • Test with various link parameters like bandwidth, delay, and queue type such as DropTail or RED that to learn how the network performance alters under various conditions.

This procedure will walk you through the entire implementation and customization process of Overlay Topology with their examples using ns2 tool. We will also offer the extra information on this topic, if you needed for the future enhancements.

For successful implementation of Overlay Topology in NS2, feel free to reach out to us for optimal outcomes. You can also explore project ideas at ns2project.com, where we provide guidance to help you complete your research effectively with comparison analysis support