How to Begin Implement a EGP Protocol in NS3

To create an Exterior Gateway Protocol (EGP) in ns3 framework has contains the replicate a protocols such as BGP (Border Gateway Protocol), the most generally used EGP for inter-domain routing. Although ns3 tool does not have built-in helps for BGP or EGP, incorporate by external tools such as Quagga or FRRouting can support the replicate of EGP protocols in a realistic method.

Here’s how to begin implementing an EGP protocol like BGP in ns-3:

Steps to Begin Implement an EGP Protocol in NS3

  1. Understand EGP Protocols
  • Key Characteristics:
    • Utilized for routing among autonomous systems (ASes).
    • It handles the inter-domain routing information.
    • According to their function policies, path attributes, and route advertisements.
  • Example Protocols:
    • BGP: Path-vector protocol designed for inter-domain routing.
    • Older protocols such as EGP (now obsolete) or custom routing systems.
  1. Set up ns-3 Environment
  1. Install ns-3:

git clone https://gitlab.com/nsnam/ns-3-dev.git

cd ns-3-dev

./build.py

  1. Verify the installation:

./ns3 run hello-simulator

  1. Install Quagga (or FRRouting) for BGP support:

sudo apt install quagga

  1. Plan the Network Topology
  • Components:
    • Numerous autonomous systems (ASes) are linked through routers.
    • The BGP routers are communicate for inter-AS.
  • Topology:
    • Describe the ASes by routers and subnets.
    • Linked by ASes with border routers.
  1. Configure and Integrate BGP
  2. Set up ns-3 Topology
  1. Include Necessary Headers

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

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

  1. Create Nodes

ns3::NodeContainer as1Routers, as2Routers, borderRouters;

as1Routers.Create(2);  // Two routers in AS1

as2Routers.Create(2);  // Two routers in AS2

borderRouters.Create(2);  // Two border routers connecting AS1 and AS2

  1. Set Up Links

ns3::PointToPointHelper p2p;

p2p.SetDeviceAttribute(“DataRate”, ns3::StringValue(“1Gbps”));

p2p.SetChannelAttribute(“Delay”, ns3::StringValue(“2ms”));

// Links within AS1

ns3::NetDeviceContainer as1Devices = p2p.Install(as1Routers.Get(0), as1Routers.Get(1));

// Links within AS2

ns3::NetDeviceContainer as2Devices = p2p.Install(as2Routers.Get(0), as2Routers.Get(1));

// Links between border routers

ns3::NetDeviceContainer borderDevices = p2p.Install(borderRouters.Get(0), borderRouters.Get(1));

  1. Assign IP Addresses

ns3::Ipv4AddressHelper address;

// Subnet for AS1

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

address.Assign(as1Devices);

// Subnet for AS2

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

address.Assign(as2Devices);

// Subnet for border routers

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

address.Assign(borderDevices);

  1. Configure BGP in Quagga
  1. Install and Configure Quagga
    • Generate a setting files for every border router:
      • zebra.conf: The simple IP address for interface set-up.
      • bgpd.conf: BGP-specific configuration.

Example zebra.conf:

hostname Router

password zebra

enable password zebra

Example bgpd.conf for Border Router 1:

router bgp 100

neighbor 10.0.3.2 remote-as 200

network 10.0.1.0/24

Example bgpd.conf for Border Router 2:

router bgp 200

neighbor 10.0.3.1 remote-as 100

network 10.0.2.0/24

  1. Start Quagga Services:

sudo service zebra start

sudo service bgpd start

  1. Integrate Quagga with ns-3
  1. Enable TapBridge:

ns3::TapBridgeHelper tapBridge;

tapBridge.SetAttribute(“Mode”, ns3::StringValue(“UseLocal”));

tapBridge.Install(borderRouters.Get(0), borderDevices.Get(0));

tapBridge.Install(borderRouters.Get(1), borderDevices.Get(1));

  1. Run ns-3 Simulation:
    • Enable Quagga is process for properly setting.
    • Start the replication for tool ns3.
  1. Generate Traffic

UDP Traffic

ns3::UdpEchoServerHelper echoServer(9);

ns3::ApplicationContainer serverApp = echoServer.Install(as2Routers.Get(1));

serverApp.Start(ns3::Seconds(1.0));

serverApp.Stop(ns3::Seconds(20.0));

ns3::UdpEchoClientHelper echoClient(ns3::Ipv4Address(“10.0.2.1”), 9);

echoClient.SetAttribute(“MaxPackets”, ns3::UintegerValue(10));

echoClient.SetAttribute(“Interval”, ns3::TimeValue(ns3::Seconds(1.0)));

echoClient.SetAttribute(“PacketSize”, ns3::UintegerValue(512));

ns3::ApplicationContainer clientApp = echoClient.Install(as1Routers.Get(0));

clientApp.Start(ns3::Seconds(2.0));

clientApp.Stop(ns3::Seconds(20.0));

  1. Run the Simulation

ns3::Simulator::Run();

ns3::Simulator::Destroy();

  1. Analyze Results

Metrics:

  • Route Convergence Time:
    • It takes duration for table routing become stable after the modification.
  • Routing Overhead:
    • Replaced in a number of control packets.
  • Packet Delivery Ratio (PDR):
    • The ratio of packets has successfully delivered.

Tracing and Visualization:

  • Enable the tracing files.pcap:

ns3::AsciiTraceHelper ascii;

p2p.EnableAsciiAll(ascii.CreateFileStream(“bgp-simulation.tr”));

p2p.EnablePcapAll(“bgp-simulation”);

  • Use Wireshark for examine the BGP control packets.
  • Envision the network using NetAnim:

./waf –run “bgp-simulation –vis”

  1. Iterate and Enhance
  • Advanced Scenarios:
    • It replicates the connection failures or load balancing.
    • Improve the additional ASes and validate the scalability.
  • Custom Protocols:
    • Encompass or alter the BGP execution in Quagga for custom structures.
  • Comparison:
    • Associate the BGP by other routing protocols below same environments.

General we had implemented the EGP protocol and analyse the performance using ns3 tool and also we provide the related information about EGP protocol. Please refer to the supplementary manual for any project-related inquiries.