How to Simulate SD-WAN Protocol Projects Using NS2

To simulate Software-Defined Wide Area Network (SD-WAN) protocols in NS2 has needs to generate a wide area network (WAN) and implements the software-defined networking (SDN) principles to handle routing, traffic policies, and optimization. Basically the SD-WAN main goal is to enhance the network performance, security, and effectiveness by handling multiple network paths like MPLS, broadband, LTE dynamically.

While NS2 doesn’t directly support SD-WAN protocols, we can replicate SD-WAN-like behaviour using SDN approaches, in which traffic is routed and handled dynamically according to network policies.

Steps to Simulate SD-WAN Protocol Projects in NS2

  1. Install NS2

Make sure that NS2 is installed on the system.

  1. Simulate an SD-WAN Topology

In SD-WAN, traffic is transmitted enthusiastically among sites (branches) and data centers using multiple WAN links. We can replicate this by configuring multiple paths among routers and dynamically implementing routing rules according to network conditions.

Example TCL Script for SD-WAN-Like Topology

# Create a new simulator instance

set ns [new Simulator]

# Define trace and nam files for logging and visualization

set tracefile [open sdwan_simulation.tr w]

$ns trace-all $tracefile

set namfile [open sdwan_simulation.nam w]

$ns namtrace-all $namfile

# Create nodes for Branch, Data Center, and WAN Gateways

set branch1 [$ns node]

set branch2 [$ns node]

set wan1 [$ns node]    ;# WAN Gateway 1 (MPLS)

set wan2 [$ns node]    ;# WAN Gateway 2 (Broadband)

set datacenter [$ns node]

# Create duplex links for WAN connections (MPLS, Broadband)

$ns duplex-link $branch1 $wan1 10Mb 20ms DropTail

$ns duplex-link $branch1 $wan2 5Mb 50ms DropTail

$ns duplex-link $wan1 $datacenter 10Mb 10ms DropTail

$ns duplex-link $wan2 $datacenter 5Mb 30ms DropTail

$ns duplex-link $branch2 $wan1 10Mb 20ms DropTail

$ns duplex-link $branch2 $wan2 5Mb 50ms DropTail

# Set node positions (optional for visualization)

$branch1 set X_ 100; $branch1 set Y_ 100

$branch2 set X_ 100; $branch2 set Y_ 200

$wan1 set X_ 200; $wan1 set Y_ 100

$wan2 set X_ 200; $wan2 set Y_ 200

$datacenter set X_ 300; $datacenter set Y_ 150

In this setup:

  • Branch 1 and Branch 2 characterize the branch offices.
  • WAN1 and WAN2 signify different WAN paths (e.g., MPLS and broadband).
  • Datacenter is the central location where data from branches is transmitted.
  1. Implement SD-WAN Dynamic Routing Policies

SD-WAN enhance traffic by enthusiastically select the optimal path according to parameters like delay, bandwidth, and packet loss. We need to replicate this behaviour by implementing conditional routing according to network conditions.

Example for Dynamic Routing Based on Delay:

# Function to dynamically change the route based on network delay

proc dynamic_route {src dst threshold} {

global ns

set link [new Link]

# Check latency between src and dst over both WAN links

set delay_mpls [$link delay $src $dst “MPLS”]

set delay_broadband [$link delay $src $dst “Broadband”]

# Choose path based on the delay threshold

if {$delay_mpls < $threshold} {

$ns at 1.0 “$src route $dst via MPLS”

} else {

$ns at 1.0 “$src route $dst via Broadband”

}

}

# Apply dynamic routing policy for traffic from Branch 1 to Data Center

dynamic_route $branch1 $datacenter 30   ;# Switch to Broadband if MPLS delay > 30ms

This function tracks the latency on both paths (MPLS and Broadband) and dynamically switches the route if the latency on MPLS surpasses the threshold.

  1. Simulate Traffic in the SD-WAN Network

Once the SD-WAN topology and routing policies are set, we can replicate traffic among the branches and the data centre.

Example for TCP Traffic:

# Set up TCP traffic from Branch 1 to Data Center

set tcp0 [new Agent/TCP]

set sink0 [new Agent/TCPSink]

$ns attach-agent $branch1 $tcp0

$ns attach-agent $datacenter $sink0

$ns connect $tcp0 $sink0

# Create FTP traffic over TCP

set ftp0 [new Application/FTP]

$ftp0 attach-agent $tcp0

$ns at 2.0 “$ftp0 start”

$ns at 10.0 “$ftp0 stop”

  1. Run the Simulation

Once TCL script (e.g., sdwan_simulation.tcl) is ready, executed it using NS2:

ns sdwan_simulation.tcl

This will create a trace file (.tr) and a NAM file (.nam) that we can measure and envisioned using Network Animator (NAM).

  1. Analyse the Simulation Results

Measure the performance of the SD-WAN network based on:

  • Packet Delivery Ratio (PDR)
  • Latency (Delay)
  • Bandwidth Utilization
  • Path Switching Events (how usual routes are changed according to conditions)

Example AWK Script for Packet Delivery Ratio:

BEGIN { sent = 0; received = 0; }

{

if ($1 == “s” && $4 == “AGT”) { sent++; }

if ($1 == “r” && $4 == “AGT”) { received++; }

}

END { print “Packet Delivery Ratio = “, received/sent*100, “%”; }

This script will help you estimate the Packet Delivery Ratio (PDR) according to the number of packets transmits and received.

  1. Example Project Ideas for SD-WAN Simulation
  1. Performance Comparison of MPLS and Broadband in SD-WAN:
    • Replicate traffic over multiple WAN links (MPLS and Broadband) and relate the performance based on throughput, latency, and packet loss.
  2. SD-WAN Path Optimization Based on Network Congestion:
    • Execute dynamic routing policies which switch paths according to congestion levels and measure on how it enhances performance.
  3. QoS Implementation in SD-WAN:
    • Replicate QoS policies in an SD-WAN environment to select critical traffic such as VoIP over regular data traffic.
  4. Fault Tolerance in SD-WAN:
    • Replicate link failures in the SD-WAN environment and measure on how rapidly the network recovers by switching paths.

We explored the numerous concepts regarding the simulation process, installation procedures and their configuration setup for Software-Defined Wide Area Network project that will executed using the tool of ns2 analysis tool. More information will be shared regarding the Software-Defined Wide Area Network in further manual.

phdprime.com offers good guidance for your SD-WAN Protocol Projects using NS2 tool simulation. Just email us with your research requirements, and we promise to deliver unique results.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2