How to Develop SD WAN Protocol Projects Using NS3

To develop the SD-WAN Protocol used in NS3 environment. The Software-Defined Wide Area Network (SD-WAN) is improved the networking method which improve the network flexibility, performance, and security through centralizing the network control. In NS3, SD-WAN network replication contains the virtualizing network functions, executing the SDN controllers, and using QoS-aware routing protocols.

Steps to Develop SD-WAN Protocol Projects in NS3

  1. Install NS3

We assure the NS3 is installed. If not, install it using:

sudo apt update

sudo apt install -y git build-essential python3 cmake

git clone

cd ns-3

./ns3 configure –enable-examples –enable-tests

./ns3 build

The NS3 components for necessary in SD-WAN

  • Internet Module → Designed for IP-based routing.
  • Point-to-Point Module → Replicate the WAN connections.
  • Traffic Control Module → Intended for QoS-based on SD-WAN.
  • Flow Monitor Module → We examine the performance metrics.
  1. Create the SD-WAN Network Topology

It is a simple SD-WAN network topology consists of:

  1. SDN Controller (Software-Defined Network Controller)
  2. Various Branch Routers in WAN Edges
  3. Datacenter and Cloud Services
  4. Several WAN connections such as MPLS, LTE, Broadband

Example: Creating an SD-WAN Network Topology

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/point-to-point-module.h”

#include “ns3/applications-module.h”

#include “ns3/traffic-control-module.h”

using namespace ns3;

int main(int argc, char *argv[]) {

NodeContainer sdwanController, branches, cloud;

sdwanController.Create(1); // SDN Controller

branches.Create(2);        // Branches

cloud.Create(1);           // Cloud Data Center

// Create WAN links (MPLS, Broadband, LTE)

PointToPointHelper p2p;

p2p.SetDeviceAttribute(“DataRate”, StringValue(“100Mbps”));

p2p.SetChannelAttribute(“Delay”, StringValue(“10ms”));

NetDeviceContainer devices1 = p2p.Install(sdwanController.Get(0), branches.Get(0));

NetDeviceContainer devices2 = p2p.Install(sdwanController.Get(0), branches.Get(1));

NetDeviceContainer devices3 = p2p.Install(branches.Get(1), cloud.Get(0));

InternetStackHelper internet;

internet.Install(sdwanController);

internet.Install(branches);

internet.Install(cloud);

Ipv4AddressHelper address;

address.SetBase(“10.1.1.0”, “255.255.255.0”);

address.Assign(devices1);

address.SetBase(“10.1.2.0”, “255.255.255.0”);

address.Assign(devices2);

address.SetBase(“10.1.3.0”, “255.255.255.0”);

address.Assign(devices3);

Simulator::Stop(Seconds(10));

Simulator::Run();

Simulator::Destroy();

return 0;

}

We setting the code for SD-WAN in ns3:

  • A controller node (SDN-based control plane).
  • Branch routers are communicating over WAN connections (MPLS, broadband).
  • Cloud datacenter connection.
  1. Implement SDN Controller for SD-WAN

The SDN controller:

  • For handle the congestion routes dynamically.
  • Improve the selection for WAN connection (MPLS, LTE, broadband).
  • We manage the network strategies (QoS, security).

Example: Execute a SDN Controller

#include “ns3/ipv4-global-routing-helper.h”

Ipv4GlobalRoutingHelper globalRouting;

globalRouting.PopulateRoutingTables();

✅ We populates the dynamic routes in SDN-based on network.

Designed for custom SDN routing, generate a QoS-aware decision model:

if (packet->GetSize() > 1024) {

route->SetOutputDevice(mplsDevice); // Route large packets via MPLS

} else {

route->SetOutputDevice(lteDevice); // Route small packets via LTE

}

  1. Simulating Traffic over SD-WAN

The TCP or UDP applications used to create the network congestion.

Example: Sending Data Traffic Over SD-WAN

#include “ns3/udp-client-server-helper.h”

uint16_t port = 8080;

UdpServerHelper server(port);

ApplicationContainer serverApp = server.Install(branches.Get(1));

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpClientHelper client(Ipv4Address(“10.1.3.1”), port);

client.SetAttribute(“MaxPackets”, UintegerValue(50));

client.SetAttribute(“Interval”, TimeValue(Seconds(0.1)));

client.SetAttribute(“PacketSize”, UintegerValue(1024));

ApplicationContainer clientApp = client.Install(branches.Get(0));

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(10.0));

This code simulates:

  • UDP communication among their two SD-WAN branch routers.
  • Client at Branch 1 distribute a packets to Cloud Data Center.
  1. Implementing QoS-Aware SD-WAN Routing

We give precedence to complex congestion, use Traffic Control Helper:

Example: QoS-based Routing for SD-WAN

#include “ns3/traffic-control-helper.h”

TrafficControlHelper tc;

tc.SetRootQueueDisc(“ns3::FqCoDelQueueDisc”); // Fair Queueing for SD-WAN

tc.Install(devices1);

tc.Install(devices2);

tc.Install(devices3);

Benefits of FQ-CoDel (Fair Queue Control Delay):

  • The network is minimum congestion.
  • Decrease the low latency for difficult applications.
  1. Performance Analysis (Throughput, Delay, Packet Loss)

The Flow Monitor Module used to calculate the SD-WAN performance.

Example: Monitoring Network Performance

#include “ns3/flow-monitor-helper.h”

Ptr<FlowMonitor> monitor;

FlowMonitorHelper flowHelper;

monitor = flowHelper.InstallAll();

Simulator::Run();

monitor->SerializeToXmlFile(“sdwan-flow.xml”, true, true);

Simulator::Destroy();

Outputs → sdwan-flow.xml for analysis.

Improved the SD-WAN Features for Research

  1. Multi-WAN Link Selection → Dynamic path selection among their MPLS, LTE, Broadband.
  2. AI-Based SD-WAN Routing → We used the machine learning for network optimization.
  3. Security in SD-WANIntrusion detection and encode for WAN congestion.
  4. QoS Enhancement → Execute a bandwidth-aware routing for SD-WAN.
  5. Edge Computing with SD-WAN → We improve the Edge Nodes for real-time processing.

In this manual, we had offered the valuable insights regarding the SD-WAN environment simulation process using ns3 tool with sample snippets. If you want to know more details regarding this process we will provide.