How to Start Named Data Networking Projects Using NS3
To start Named Data Networking (NDN) projects using NS3, depends on the NDN architecture we will replicate the networks that is diverse from traditional IP networks since it concentrates on data names rather than IP addresses. NS3 contains a dedicated NDN module and ndnSIM, enhanced particularly to replicate the NDN situations, to create it simpler to apply NDN protocols, caching, and routing. Contact us to receive customized assistance regarding configuration and simulation for your projects. Therefore, please visit phdprojects.org for innovative outcomes.
Here’s is a simple guide to getting started the Named Data Networking projects using NS3.
Steps to Start Named Data Networking (NDN) Projects in NS3
- Install NS3 and ndnSIM
In NS3, replicate the NDN we will want to install ndnSIM, the NDN module made onNS3.
- Install NS3: Initially, we install the NS3 if it’s not already installed.
sudo apt-get update
sudo apt-get install git
git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
cd ns-3
git checkout ndnSIM-2.8
- Download and Install ndnSIM:
git clone https://github.com/named-data-ndnSIM/ndnSIM ns-3/src/ndnSIM
- Build NS-3 with ndnSIM:
./waf configure –enable-examples –enable-tests
./waf
- Verify Installation: Execute an example verifying that ndnSIM is functioning.
./waf –run=ndn-simple
- Understand the Components of Named Data Networking (NDN)
NDN utilizes numerous core modules:
- Data Naming: According to the names instead of IP addresses, content is requested and routed.
- Interest Packets: Consumers transmit Interest packets to request information using name.
- Data Packets: Producers reply to Interest packets including Data packets that comprise the requested content.
- Content Store (CS): Every single node caches obtained Data packets enhancing the effectiveness by way of providing future requests.
- Forwarding Information Base (FIB): A table utilized through routers to send Interest packets depends on the name prefixes.
- Pending Interest Table (PIT): Monitors Interests, which have been sent however not still satisfied using Data packet.
- Create a Basic NDN Topology
Initially, make a simple NDN network which contains consumers, producers, and intermediate routers. Consumers ask for content, and producers offer content, whereas routers send Interest and Data packets according to the name prefixes in ndnSIM.
Example: Simple Consumer-Producer NDN Network
- Define the Nodes: Make nodes to signify consumers, routers, and producers.
- Set Up NDN Stack: Install the NDN stack at nodes utilizing ndnSIM’s helper classes.
- Define Consumer and Producer Applications: Install consumer and producer applications requesting and replying to content.
Here’s a basic example in ndnSIM:
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/ndnSIM-module.h”
namespace ns3 {
int main(int argc, char *argv[]) {
// Set up command-line parameters
CommandLine cmd;
cmd.Parse(argc, argv);
// Create nodes: 1 consumer, 1 producer, 1 router
Ptr<Node> consumer = CreateObject<Node>();
Ptr<Node> producer = CreateObject<Node>();
Ptr<Node> router = CreateObject<Node>();
// Create a simple topology
NodeContainer nodes;
nodes.Add(consumer);
nodes.Add(router);
nodes.Add(producer);
// Connect nodes with point-to-point links
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“10Mbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“2ms”));
p2p.Install(consumer, router);
p2p.Install(router, producer);
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
ndnHelper.InstallAll();
// Set up forwarding strategy
ndn::StrategyChoiceHelper::InstallAll(“/”, “/localhost/nfd/strategy/multicast”);
// Install NDN applications (consumer and producer)
ndn::AppHelper consumerHelper(“ns3::ndn::ConsumerCbr”);
consumerHelper.SetAttribute(“Frequency”, StringValue(“10”)); // 10 interests per second
consumerHelper.SetPrefix(“/data”);
consumerHelper.Install(consumer);
ndn::AppHelper producerHelper(“ns3::ndn::Producer”);
producerHelper.SetPrefix(“/data”);
producerHelper.SetAttribute(“PayloadSize”, StringValue(“1024”));
producerHelper.Install(producer);
// Add /data prefix to FIB on the router
ndn::FibHelper::AddRoute(router, “/data”, producer, 0);
// Run the simulator
Simulator::Stop(Seconds(20.0));
Simulator::Run();
Simulator::Destroy();
return 0;
}
} // namespace ns3
- Configure Content Store (Caching) and Forwarding Strategies
NDN heavily depends on caching to enhance the effectiveness:
- Content Store (CS): Every single node stores content working for future requests locally. Configure cache size utilizing the ContentStore attribute.
- Forwarding Strategies: Utilize diverse forwarding strategies such as multicast, best-route, or custom strategies. In the above instance, multicast strategy is employed.
To configure a custom Content Store size:
ndnHelper.SetContentStore(“ns3::ndn::cs::Lru”, “MaxSize”, “100”); // 100 entries
- Experiment with Different Traffic Patterns
Replicate several network conditions to alter:
- Consumer Frequency: Modify the percentage at which consumers make Interest packets.
- Data Payload Size: Alter the data payload signifying diverse content sizes.
- Mobility: Append mobility models to nodes replicating dynamic NDN environments such as for Vehicular NDN situations.
- Analyze and Collect Performance Metrics
In ndnSIM, we can accumulate the performance parameters like:
- Interest Satisfaction Rate: Rate of Interests well satisfied with the help of Data packets.
- Cache Hit Ratio: From cache instead of the original producer, we estimate how frequently data is functioned.
- Latency and Hop Count: Monitor the delay and volume of hops that are needed for data recovery.
For example:
ndn::L3RateTracer::InstallAll(“ndn-rate-trace.txt”, Seconds(1.0)); // Log rate of Interest and Data packets
ndn::CsTracer::InstallAll(“ndn-cs-trace.txt”, Seconds(1.0)); // Log cache events
ndn::AppDelayTracer::InstallAll(“ndn-app-delay-trace.txt”);
- Implement and Test Custom Forwarding Strategies
In NDN, one of the primary research areas is sending strategies. We can be executed the custom strategies to test with diverse routing behaviors within ndnSIM using subclassing ns3::ndn::ForwardingStrategy.
- Visualize and Analyze Results
We can examine the simulation outcomes:
- Trace Analysis: Utilize the trace files made by L3RateTracer, CsTracer, and AppDelayTracer.
- NS-3 Visualization Tools: Examine the node communications and packet flows utilizing NetAnim within real-time.
Also, from trace files we can plot data examining parameters like Interest satisfaction rates, cache hit ratios, and network delay.
By following above steps, we had conducted the Named Data networking projects that were executed and analysed using NS3 environment. We will also be delivered any more information on these projects as required.