To develop the Path Vector Routing Projects Used the NS3. The Path Vector Routing is generally used in inter-domain routing developments, like as Border Gateway Protocol (BGP). It maintains to follow the entire path of the destination in place of just distance or hop count. This create the appropriate for large-scale networks, including the Internet, SDN, and cloud networking.
Steps to Develop Path Vector Routing Projects Using NS3
- Install NS3
Assure which NS3 tool is installed:
sudo apt update
sudo apt install git g++ python3 cmake make
git clone
cd ns-3-dev
./ns3 configure –enable-examples –enable-tests
./ns3 build
- Define Network Topology for Path Vector Routing
We execute the Path Vector Routing; we generate a multi-domain network topology and replicate the BGP-like behavior.
Example: Path Vector Routing Using BGP-like Simulation
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/internet-module.h”
#include “ns3/point-to-point-module.h”
#include “ns3/ipv4-global-routing-helper.h”
using namespace ns3;
NS_LOG_COMPONENT_DEFINE(“PathVectorRoutingExample”);
int main(int argc, char *argv[])
{
uint32_t numNodes = 5;
double simulationTime = 10.0;
NodeContainer nodes;
nodes.Create(numNodes);
// Create point-to-point links (representing inter-AS connections)
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“5Mbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“2ms”));
NetDeviceContainer devices;
devices = p2p.Install(nodes.Get(0), nodes.Get(1));
devices = p2p.Install(nodes.Get(1), nodes.Get(2));
devices = p2p.Install(nodes.Get(2), nodes.Get(3));
devices = p2p.Install(nodes.Get(3), nodes.Get(4));
// Install Internet stack
InternetStackHelper internet;
internet.Install(nodes);
// Assign IP Addresses
Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
address.Assign(devices);
// Enable Path Vector Routing (Simulating BGP)
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
Simulator::Stop(Seconds(simulationTime));
Simulator::Run();
Simulator::Destroy();
return 0;
}
- Explanation of the Code
- Network Setup
- The 5 nodes are demonstrated in various ASes (Autonomous Systems).
- Point-to-Point connections to replicate for inter-AS connections.
- Path Vector Routing (Simulating BGP)
- In every AS (node) modify the routing tables containing the entire path to the destination.
- Ipv4GlobalRoutingHelper is exhausted to replicate the path-based routing.
- It process for execute the replication
Compile and execute:
./ns3 run path-vector-routing
- Performance Analysis
We investigate the performance of parameter metrices such as Throughput, Packet Delivery Ratio (PDR), and Delay, use FlowMonitor.
Enable FlowMonitor for Traffic Analysis
#include “ns3/flow-monitor-module.h”
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
Simulator::Stop(Seconds(10.0));
Simulator::Run();
monitor->SerializeToXmlFile(“path_vector_results.xml”, true, true);
Simulator::Destroy();
- Implementing Path Vector Routing Using BGP
Path Vector Routing is terms on BGP-like routing, in which every router handle the list of paths.
Execute the Path Vector Procedure
#include <iostream>
#include <vector>
#include <map>
class PathVectorRouting
{
public:
void addRoute(int source, int dest, std::vector<int> path)
{
routingTable[dest] = path;
}
void displayRoutes()
{
for (auto &route : routingTable)
{
std::cout << “Destination: ” << route.first << ” via “;
for (int node : route.second)
{
std::cout << node << ” “;
}
std::cout << std::endl;
}
}
private:
std::map<int, std::vector<int>> routingTable;
};
int main()
{
PathVectorRouting router;
router.addRoute(0, 3, {0, 1, 2, 3});
router.addRoute(0, 4, {0, 2, 4});
router.displayRoutes();
return 0;
}
- Extensions & Future Work
Execute a QoS-Aware on Path Vector Routing
Incorporate a BGP Decision Process for instance Shortest AS Path, Local Preference
we replicate the Multi-Path BGP for Internet Routing
In this setup we learn and understand how the path vector routing will prevent the loops and make the best path in the network. Further guidance on this project will be included in a additional manual.