How to Simulate Network Virtualization Projects Using NS3

To simulate Network Function Virtualization (NFV) projects using NS3 has needs to generate a virtualized network environment in which the existing network functions such as routing, firewalling, or load balancing are decoupled from dedicated hardware and execute as software instances on virtual machines or containers. NS3 can be expanded to mimic (VNFs) executing on nodes, and NFV by generating network topologies with virtualized network functions by replicating the orchestration and chaining of these functions.

Here’s a step-by-step guide on how to simulate NFV projects using NS3:

Step-by-Step Implementation

Step 1: Install NS3

Make sure that we have NS3 installed in the system. Follow these steps if NS3 is not installed on your system:

  1. Clone the NS3 repository:

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

cd ns-3-dev

  1. Configure and build NS3:

./waf configure

./waf

Step 2: Understand Key Components of NFV Simulation

In an NFV simulation, we will need to mimic the following components:

  1. Virtual Network Functions (VNFs): These are software-based implementations of network functions such as firewalls, routers, or deep packet inspection (DPI).
  2. NFV Infrastructure (NFVI): The physical or virtual resources (servers, storage, and networking) that host the VNFs.
  3. NFV Orchestrator (NFVO): A component that handles the lifecycle of VNFs and coordinates the chaining of VNFs to deliver network services.
  4. Service Function Chaining (SFC): The process of chaining diverse VNFs to generate a complete service.

Step 3: Set Up the NFV Infrastructure (NFVI)

In the NFV infrastructure, we need to configure the nodes in which VNFs will run. These can be simulated as standard NS3 nodes.

  1. Create NFVI Nodes: Utilize NodeContainer to generate the NFV infrastructure nodes that will host the VNFs.

NodeContainer nfviNodes, clientNodes, serverNodes;

nfviNodes.Create(3);  // 3 NFVI nodes for hosting VNFs

clientNodes.Create(1);  // 1 client node

serverNodes.Create(1);  // 1 server node

  1. Install Communication Protocol (e.g., Wi-Fi or Ethernet): Configure a communication protocol such as Wi-Fi or Ethernet to associate the NFVI nodes, client, and server.

PointToPointHelper pointToPoint;

pointToPoint.SetDeviceAttribute(“DataRate”, StringValue(“1Gbps”));

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

NetDeviceContainer devices;

devices = pointToPoint.Install(nfviNodes);

devices.Add(pointToPoint.Install(clientNodes.Get(0), nfviNodes.Get(0)));

devices.Add(pointToPoint.Install(serverNodes.Get(0), nfviNodes.Get(2)));

  1. Install IP Stack: Install the IP stack on all nodes (NFVI, client, and server).

InternetStackHelper stack;

stack.Install(nfviNodes);

stack.Install(clientNodes);

stack.Install(serverNodes);

Ipv4AddressHelper address;

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

Ipv4InterfaceContainer interfaces = address.Assign(devices);

Step 4: Implement Virtual Network Functions (VNFs)

In NS3, VNFs can be denoted by custom applications that perform network functions such as firewalling, routing, or packet inspection. We can generate custom applications to mimic the behaviour of each VNF.

  1. Create a VNF (e.g., Firewall): Execute a VNF as a custom application that processes packets. Here’s an instance of a firewall VNF:

class FirewallVNF : public Application {

public:

void StartApplication() override {

// Set up the socket for listening and packet processing

socket = Socket::CreateSocket(GetNode(), UdpSocketFactory::GetTypeId());

InetSocketAddress local = InetSocketAddress(Ipv4Address::GetAny(), 9999);  // Firewall listens on port 9999

socket->Bind(local);

socket->SetRecvCallback(MakeCallback(&FirewallVNF::HandleRead, this));

}

void HandleRead(Ptr<Socket> socket) {

Ptr<Packet> packet;

Address from;

while ((packet = socket->RecvFrom(from))) {

// Implement firewall logic (e.g., drop certain packets based on IP or port)

// For simplicity, forward all packets here

socket->SendTo(packet, 0, from);

}

}

private:

Ptr<Socket> socket;

};

  1. Create Additional VNFs (e.g., NAT, Load Balancer): Similarly, we can generate other VNFs like a NAT, a load balancer, or a DPI application.

Step 5: Install VNFs on NFVI Nodes

  1. Install the VNFs (Firewall, NAT, etc.) on NFVI Nodes: Alocate VNFs to ceratin NFVI nodes by installing the corresponding applications.

Ptr<FirewallVNF> firewall = CreateObject<FirewallVNF>();

nfviNodes.Get(0)->AddApplication(firewall);

firewall->SetStartTime(Seconds(1.0));

firewall->SetStopTime(Seconds(10.0));

// Repeat this process for other VNFs (e.g., NAT, DPI) on other NFVI nodes

Step 6: Set Up Service Function Chaining (SFC)

Service Function Chaining (SFC) is the process of routing packets across a sequence of VNFs to generate a complete service. We can replicate this by directing traffic across multiple NFVI nodes in a chain.

  1. Configure the Chain of VNFs: configure routes that direct traffic via the sequence of VNFs. For example, packets from the client should first pass across the firewall, then the NAT, and lastly the DPI before reaching the server.

Ipv4StaticRoutingHelper routingHelper;

Ptr<Ipv4StaticRouting> clientRouting = routingHelper.GetStaticRouting(clientNodes.Get(0)->GetObject<Ipv4>());

clientRouting->AddNetworkRouteTo(Ipv4Address(“10.1.2.0”), Ipv4Mask(“255.255.255.0”), Ipv4Address(“10.1.1.2”), 1);

Ptr<Ipv4StaticRouting> nfviRouting = routingHelper.GetStaticRouting(nfviNodes.Get(0)->GetObject<Ipv4>());

nfviRouting->AddNetworkRouteTo(Ipv4Address(“10.1.3.0”), Ipv4Mask(“255.255.255.0”), Ipv4Address(“10.1.1.3”), 2);

  1. Orchestrate VNF Chaining: In a real NFV setup, the NFV Orchestrator (NFVO) manages the deployment and chaining of VNFs dynamically. In NS3, we can physically describe the routing rules that mimic this chaining process.

Step 7: Set Up Applications on Client and Server

  1. Install Client and Server Applications: Utilize UDP Echo or TCP applications to create traffic that passes across the chain of VNFs.

// Server on the final node (e.g., after all VNFs)

UdpEchoServerHelper echoServer(9);  // Listening on port 9

ApplicationContainer serverApps = echoServer.Install(serverNodes.Get(0));

serverApps.Start(Seconds(2.0));

serverApps.Stop(Seconds(10.0));

// Client on the client node

UdpEchoClientHelper echoClient(serverNodes.Get(0)->GetObject<Ipv4>()->GetAddress(1, 0), 9);

echoClient.SetAttribute(“MaxPackets”, UintegerValue(100));

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

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

ApplicationContainer clientApps = echoClient.Install(clientNodes.Get(0));

clientApps.Start(Seconds(2.5));

clientApps.Stop(Seconds(10.0));

Step 8: Enable Tracing and Run the Simulation

  1. Enable Tracing: Permit packet-level tracing to measure the flow of packets across the VNFs.

pointToPoint.EnablePcapAll(“nfv-simulation”);

  1. Run the Simulation: Execute the simulation for a certain duration.

Simulator::Stop(Seconds(10.0));

Simulator::Run();

Simulator::Destroy();

Step 9: Analyse the Results

Once the simulation is done, we can measure the following metrics:

  1. Packet Flow: Monitor the flow of packets across the sequence of VNFs and validate if they follow the correct service chain.
  2. Latency: Evaluate the delay established by the VNFs as packets pass via the chain.
  3. Throughput: measure the data transfer rate among the client and server.
  4. Resource Usage: Mimic and evaluate the resource consumption such as CPU, memory of VNFs to make sure efficient network function placement.

Step 10: Extend the Simulation

We can expand the simple NFV simulation by adding more advanced features:

  1. Dynamic VNF Placement: Execute an algorithm that dynamically places VNFs on NFVI nodes according to resource availability.
  2. Auto-Scaling VNFs: Replicate the auto-scaling of VNFs when traffic load increases, similar to cloud-based auto-scaling.
  3. Fault Tolerance: Mimic the failure of NFVI nodes and track on how traffic is rerouted to other nodes hosting the same VNFs.
  4. Energy Efficiency: Design energy consumption for VNFs and enhance the placement of VNFs according to energy efficiency criteria.
  5. Security Features: Replicate the implementation of security functions, like encryption or deep packet inspection (DPI), as part of the service chain.

In this demonstration we clearly learned and gain knowledge on how the Network Function Virtualization will perform in the network simulation environment using the tool of ns3 and also we deliver the sample snippets top complete the process. more details regarding this process will also be shared.

For simulating Network Function Virtualization Projects using NS3, visit phdprime.com. We offer a comprehensive range of tools and resources designed to deliver the best research ideas and topics customized to your requirements. Our team specializes in Virtual Network Functions (VNFs) operating on nodes and Network Function Virtualization (NFV) by creating innovative network topologies with fresh concepts and topics.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2