How to Begin Implementing a Named Data Networking in ns3
To create an execution of Named Data Networking (NDN) project using ns-3 includes the replicate of NDN design that emphasizes content-based transmission rather than host-based communication. Here’s a step-by-step guide to start your NDN project in ns-3:
Steps to Begin Implementing a Named Data Networking projects using ns3
Step 1: Understand NDN Concepts
- NDN Basics:
- Data is assigned the names for instead of IP addresses.
- Transmission is request-driven through Interest and Data packets.
- Key Components:
- Producer: Node which provides data for producer.
- Consumer: Consumer has requesting the node for data.
- Forwarding Strategy: Defines on how the Interest packets are routed.
- Content Store (CS): Caches data for intermediate nodes.
- Forwarding Information Base (FIB): it places the names for next-hop interfaces.
Step 2: Install NDN Support in ns-3
- Download ndnSIM:
- ndnSIM is a module for ns-3 ttol replicate the NDN. Clone the repository:
git clone https://github.com/named-data-ndnSIM/ndnSIM.git
- Set Up ns-3 with ndnSIM:
- Track the installation procedures from ndnSIM GitHub.
- Create the replication environment:
./waf configure
./waf build
- Verify Installation:
- It process for the sample in assure the ndnSIM is perfectly setting:
./waf –run=ndn-simple
Step 3: Define the Project Scope
- Scenarios:
- It is a basic producer-consumer transmission.
- This scenario is multi-hop NDN by caching method.
- Complex networks by custom sending the approaches.
- Metrics:
- It performs the interest satisfaction of metrices such as ratio, delay, and cache hit rate.
Step 4: Set Up the Simulation Environment
- Create Nodes:
- Express the nodes for consumers, producers, and intermediate routers:
NodeContainer nodes;
nodes.Create(3); // Consumer, Router, Producer
- Install NDN Stack:
- Install the NDN protocol stack for all nodes:
ndn::StackHelper ndnHelper;
ndnHelper.InstallAll();
- Configure Forwarding Strategy:
- Configure the default forwarding approach for instance BestRoute or Flooding:
ndn::StrategyChoiceHelper::InstallAll(“/prefix”, “/localhost/nfd/strategy/best-route”);
Step 5: Set Up Consumer and Producer Applications
- Consumer Application:
- Set-up the consumer for forwarding the Interest packets:
ndn::AppHelper consumerHelper(“ns3::ndn::ConsumerCbr”);
consumerHelper.SetPrefix(“/prefix”);
consumerHelper.SetAttribute(“Frequency”, StringValue(“10”)); // 10 Interests per second
consumerHelper.Install(nodes.Get(0)); // Consumer
- Producer Application:
- It setting the application for a producer in respond the Interest packets:
ndn::AppHelper producerHelper(“ns3::ndn::Producer”);
producerHelper.SetPrefix(“/prefix”);
producerHelper.SetAttribute(“PayloadSize”, StringValue(“1024”)); // 1KB payload
producerHelper.Install(nodes.Get(2)); // Producer
Step 6: Configure Caching and Forwarding
- Content Store Settings:
- Express the size of Content Store (CS) for caching the setting:
ndn::CsHelper::SetDefaultCsSize(100); // Cache up to 100 Data packets
- Custom Forwarding Strategy:
- Estimate the transmit approach through encompassing the ndnSIM’s forwarding classes.
Step 7: Creae and Connect Network Topology
- Define Links:
- Make use the Point-to-Point connection for simplicity:
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“1Mbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“10ms”));
p2p.Install(nodes.Get(0), nodes.Get(1)); // Consumer to Router
p2p.Install(nodes.Get(1), nodes.Get(2)); // Router to Producer
- Assign Names:
- It use the allocate like ndn::FibHelper for sending the forwarding:
ndn::FibHelper::AddRoute(nodes.Get(1), “/prefix”, nodes.Get(2), 0);
Step 8: Run the Simulation
- Go to the replication for processing:
Simulator::Stop(Seconds(20.0)); // Run for 20 seconds
Simulator::Run();
Simulator::Destroy();
Step 9: Collect and Analyze Results
- Enable Tracing:
- Ensure the tracing for gather the statistics:
ndn::L3RateTracer::InstallAll(“rate-trace.txt”, Seconds(1.0));
ndn::CsTracer::InstallAll(“cs-trace.txt”, Seconds(1.0));
ndn::AppDelayTracer::InstallAll(“app-delay-trace.txt”);
- Analyze Output:
- It outcomes use the Gnuplot or another envision tool for examine the trace files.
Example: Simple NDN Simulation
Here’s a simple sample for producer-consumer replication of ndnSIM:
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/point-to-point-module.h”
#include “ns3/ndnSIM-module.h”
using namespace ns3;
int main(int argc, char* argv[]) {
// Create nodes
NodeContainer nodes;
nodes.Create(3); // Consumer, Router, Producer
// Create links
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“1Mbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“10ms”));
p2p.Install(nodes.Get(0), nodes.Get(1)); // Consumer to Router
p2p.Install(nodes.Get(1), nodes.Get(2)); // Router to Producer
// Install NDN stack
ndn::StackHelper ndnHelper;
ndnHelper.InstallAll();
// Set default strategy
ndn::StrategyChoiceHelper::InstallAll(“/prefix”, “/localhost/nfd/strategy/best-route”);
// Configure consumer
ndn::AppHelper consumerHelper(“ns3::ndn::ConsumerCbr”);
consumerHelper.SetPrefix(“/prefix”);
consumerHelper.SetAttribute(“Frequency”, StringValue(“10”)); // 10 Interests per second
consumerHelper.Install(nodes.Get(0)); // Consumer
// Configure producer
ndn::AppHelper producerHelper(“ns3::ndn::Producer”);
producerHelper.SetPrefix(“/prefix”);
producerHelper.SetAttribute(“PayloadSize”, StringValue(“1024”)); // 1KB payload
producerHelper.Install(nodes.Get(2)); // Producer
// Add routes
ndn::FibHelper::AddRoute(nodes.Get(1), “/prefix”, nodes.Get(2), 0);
// Run simulation
Simulator::Stop(Seconds(10.0));
Simulator::Run();
Simulator::Destroy();
return 0;
}
Step 10: Extend the Simulation
- Advanced Features:
- Execute the custom caching approaches.
- It replicates the multi-producer and multi-consumer environment.
- It can use the mobility design for replicate the dynamic topologies.
- Performance Metrics:
- The outcomes for performance metrices such as measure Interest/Data latency; cache hit ratio, and network throughput.
Finally, we explore the simple implementation procedures how to simulate the Named Data Networking in ns3 tool and we also provide related information about Named Data Networking.