How to Simulate Exterior Gateway Protocol Projects Using NS3

To simulate an Exterior Gateway Protocol (EGP) such as BGP (Border Gateway Protocol) in NS3 has needs to follow the steps and it have potential to incorporating the real-world routing software such as Quagga or FRRouting (FRR) with NS3’s network simulation environment. Since NS3 doesn’t directly support BGP, we can replicate it using NS3’s Direct Code Execution (DCE) module that allows running actual Linux applications such as Quagga/FRR within the simulated NS3 environment.

This guide illustrated on how to simulate BGP (Exterior Gateway Protocol) using NS3 and Quagga/FRRouting.

Steps to Simulate BGP (Exterior Gateway Protocol) in NS3:

  1. Install NS3 and NS3-DCE: initially make sure that NS3 and the Direct Code Execution (DCE) module are installed. NS3-DCE permits to execute real-world network applications such as Quagga or FRRouting inside the simulation. We can download and install NS3 from NS3.

Installation for DCE:

sudo apt install ns3-dce

  1. Install Quagga or FRRouting: Quagga and FRR are popular open-source routing software fits to implement BGP, OSPF, RIP, and other protocols.

To install Quagga:

sudo apt-get install quagga

To install FRRouting (FRR):

sudo apt-get install frr frr-doc frr-snmp

  1. Configure Quagga or FRR: Generate BGP configuration files for Quagga or FRR on each router. The configuration files describe the BGP process, contain AS numbers, router IDs, and peering relationships among BGP routers.
  2. Create a Network Topology in NS3: Utilize NS3 to generate a network with multiple routers and autonomous systems (ASes) connected through point-to-point links. Each AS will have its own router, and the BGP session will be introduced among routers of different ASes.
  3. Integrate Quagga or FRR with NS3 using DCE: Utilize NS3-DCE to run Quagga or FRRouting within the NS3 simulation. Quagga/FRR will handle the BGP routing among the routers, interchanging routes and routing traffic via autonomous systems.
  4. Set Up Traffic Generating Applications: Utilize NS3’s applications such as UDP Echo or TCP to create traffic among nodes in different autonomous systems. This will mimic cross-AS traffic and demonstrate how BGP handles routing among the ASes.
  5. Run the Simulation: After setting up Quagga/FRRouting and configuring the network in NS3, process the simulation to monitor BGP route exchanges, network behavior, and data traffic among ASes.

Example Simulation of BGP Using Quagga in NS3

Below is an intance that shows you on how to simulate a BGP setup with two autonomous systems (ASes) using NS3 and Quagga.

Step 1: Network Topology Setup

The first step is to generate a simple network topology with two autonomous systems (AS1 and AS2) using point-to-point links. The routers in AS1 and AS2 will peer through BGP.

#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/dce-module.h”

using namespace ns3;

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

{

// Step 1: Create nodes for two ASes

NodeContainer as1Nodes;

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

NodeContainer as2Nodes;

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

// Step 2: Create links between AS1 and AS2

NodeContainer interAsLink = NodeContainer (as1Nodes.Get (1), as2Nodes.Get (0));

// Step 3: Install Internet stack on all nodes

InternetStackHelper internet;

internet.Install (as1Nodes);

internet.Install (as2Nodes);

// Step 4: Set up point-to-point links between routers

PointToPointHelper p2p;

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

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

NetDeviceContainer devices1 = p2p.Install (as1Nodes);

NetDeviceContainer devices2 = p2p.Install (as2Nodes);

NetDeviceContainer interAsDevices = p2p.Install (interAsLink);

// Step 5: Assign IP addresses

Ipv4AddressHelper ipv4;

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

ipv4.Assign (devices1);

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

ipv4.Assign (devices2);

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

Ipv4InterfaceContainer interAsInterfaces = ipv4.Assign (interAsDevices);

// Step 6: Install Quagga (BGP) on routers using DCE

DceManagerHelper dceManager;

dceManager.Install (as1Nodes);

dceManager.Install (as2Nodes);

QuaggaHelper quagga;

quagga.EnableBgp (as1Nodes.Get (0), “65001”); // Enable BGP on AS1 router 1

quagga.EnableBgp (as1Nodes.Get (1), “65001”);

quagga.EnableBgp (as2Nodes.Get (0), “65002”); // Enable BGP on AS2 router 1

quagga.EnableBgp (as2Nodes.Get (1), “65002”);

// Set up BGP neighbors

quagga.AddBgpNeighbor (as1Nodes.Get (1), “10.1.1.2”, “65002”); // AS1 peer with AS2

quagga.AddBgpNeighbor (as2Nodes.Get (0), “10.1.1.1”, “65001”); // AS2 peer with AS1

// Step 7: Run simulation

Simulator::Stop (Seconds (20.0));

Simulator::Run ();

Simulator::Destroy ();

return 0;

}

Explanation of the Code:

  1. Node Creation:
    • Two sets of nodes are generated to denotes the routers in two different autonomous systems (AS1 and AS2).
  2. Network Links:
    • Point-to-point links are introduced among the routers within and across the autonomous systems.
  3. Install Quagga:
    • The DCE (Direct Code Execution) module is utilized to install Quagga on the routers. Quagga delivers BGP functionality on the routers.
  4. Enable BGP:
    • BGP is permit on the routers, and neighbor relationships are setup using the quagga.AddBgpNeighbor() function to introduce a BGP peering session among AS1 and AS2.
  5. Run the Simulation:
    • The simulation execute for 20 seconds in during of which the routers interchange BGP routing information and route traffic among AS1 and AS2.

Step 2: BGP Configuration Files

We will also want BGP configuration files for each router. These files describe the BGP process for each router that has the AS number, router ID, and BGP neighbors.

Example Quagga bgpd.conf for Router in AS1:

router bgp 65001

bgp router-id 10.0.1.1

neighbor 10.1.1.2 remote-as 65002

Example Quagga bgpd.conf for Router in AS2:

router bgp 65002

bgp router-id 10.0.2.1

neighbor 10.1.1.1 remote-as 65001

These configuration files can be stored on each NS3 node processing Quagga. They describe the BGP peering relationships among AS1 and AS2 routers.

Step 3: Set Up Traffic Generation

We can install applications such as UDP Echo or TCP on the nodes in AS1 and AS2 to replicate data transfer via autonomous systems. The traffic will be transmitted based on the BGP protocol.

Performance Metrics to Analyse

  1. BGP Convergence Time:
    • Evaluate on how long it takes for BGP to converge and for all routers to have consistent routing information.
  2. Route Propagation:
    • Validate on how routes are propagated among the autonomous systems.
  3. Packet Delivery Ratio (PDR):
    • Assess the ratio of packets successfully delivered from the source to the destination.
  4. End-to-End Delay:
    • Evaluate the time taken for a packet to travel from a source in one AS to a destination in another AS.
  5. BGP Routing Tables:
    • Examine the BGP routing tables on each router to validate that routes are appropriately exchanged.

Running the Simulation:

  1. Build the NS3 Script: Execute the following commands in NS3 directory to build and execute the simulation:

./waf configure

./waf build

./waf –run <your-script-name>

  1. Check Quagga Logs: After processing the simulation, we can validate the Quagga logs in the dce directory to see the BGP route interchange and validate that the BGP peering session was introduced successfully.

Through the use of ns3, the Exterior Gateway Protocol projects were efficiently and successfully completed. Further details regarding the implementation of the Exterior Gateway Protocol in different simulations will be provided.

Provide us all the details of your research, and we’ll provide you with the best simulation outcomes.

 

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2