Ns3 Projects for B.E/B.Tech M.E/M.Tech PhD Scholars.  Phone-Number:9688312542   E-mail:ns3simulation@gmail.com

NS3 projects

Delay tolerant network, multihop cellular network and CSMA are detailed explained in ns3 projects.

Delay tolerant network:Delay tolerant networks are designed to provide reliable transmission and interoperable communications between wide ranges of networks.

Routings in DTN:

  • Static tree-based routing.
  • Dynamic tree-based routing.
  • Unicast-based routing.
  • Context aware routing.
  • Broadcast-based routing.
  • Tree-based routing.
  • Context aware multicast routing.
  • Group-based routing.

Goals of delay-tolerant networking:

  • Decent performance for low loss/delay/errors.
  • Support interoperability across ‘radically heterogeneous’ networks.
  • Acceptable performance in high loss/delay/error/disconnected environments.

Sample code for delay tolerant network:

PointToPointHelper bottleNeckLink;
bottleNeckLink.SetDeviceAttribute  ("DataRate", StringValue (bottleNeckLinkBw));
bottleNeckLink.SetChannelAttribute ("Delay", StringValue (bottleNeckLinkDelay));
if (queueType == "RED")
bottleNeckLink.SetQueue ("ns3::RedQueue",
"MinTh", DoubleValue (minTh),
"MaxTh", DoubleValue (maxTh),
"LinkBandwidth", StringValue (bottleNeckLinkBw),
"LinkDelay", StringValue (bottleNeckLinkDelay));
PointToPointHelper pointToPointLeaf;
pointToPointLeaf.SetDeviceAttribute    ("DataRate", StringValue ("10Mbps"));
pointToPointLeaf.SetChannelAttribute   ("Delay", StringValue ("1ms"));
PointToPointDumbbellHelper d (nLeaf, pointToPointLeaf,
nLeaf, pointToPointLeaf,
InternetStackHelper stack;
d.InstallStack (stack);
// Assign IP Addresses
d.AssignIpv4Addresses (Ipv4AddressHelper ("", ""),
Ipv4AddressHelper ("", ""),
Ipv4AddressHelper ("", ""));
// Install on/off app on all right side nodes
OnOffHelper clientHelper ("ns3::TcpSocketFactory", Address ());
clientHelper.SetAttribute ("OnTime", StringValue ("ns3::UniformRandomVariable[Min=0.,Max=1.]"));
clientHelper.SetAttribute ("OffTime", StringValue ("ns3::UniformRandomVariable[Min=0.,Max=1.]"));
Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
ApplicationContainer sinkApps;
for (uint32_t i = 0; i < d.LeftCount (); ++i)
sinkApps.Add (packetSinkHelper.Install (d.GetLeft (i)));
sinkApps.Start (Seconds (0.0));
sinkApps.Stop (Seconds (30.0));


Multihop cellular network:

  • MCNs (Multihop Cellular Networks) combine the benefits of having a fixed infrastructure of base stations and the flexibility of ad-hoc networks.
  • They are capable of achieving much higher throughput than current cellular systems, which can be classified as Singlehop Cellular Networks (SCNs).

Features of MCN:

  • Potentially enhance coverage.
  • Data rates.
  • QoS performance in terms of call blocking probability.
  • Bit error rate.
  • Network scalability.
  • Capacity enhancement etc.

Research areas of MCN:

  • Interference management.
  • Scheduling.
  • ARQ.
  • Handoff.
  • Adaptive modulation.
  • Multipath routing.
  • Effective channel assignment scheme.

Sample code for multihop cellular network:


nodes_netLR[z].Create (2);
stack.Install (nodes_netLR[z]);
NetDeviceContainer ndcLR;
ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]);
NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b;
net0_4.Add (nodes_netLR[z].Get (0));
net0_4.Add (nodes_net0[z][0].Get (0));
net0_5.Add (nodes_netLR[z].Get  (1));
net0_5.Add (nodes_net0[z][1].Get (0));
net2_4a.Add (nodes_netLR[z].Get (0));
net2_4a.Add (nodes_net2[z][0].Get (0));
net2_4b.Add (nodes_netLR[z].Get (1));
net2_4b.Add (nodes_net2[z][1].Get (0));
net3_5a.Add (nodes_netLR[z].Get (1));
net3_5a.Add (nodes_net3[z][0].Get (0));
net3_5b.Add (nodes_netLR[z].Get (1));
net3_5b.Add (nodes_net3[z][1].Get (0));
NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b;
ndc0_4 = p2p_1gb5ms.Install (net0_4);
oss.str ("");
oss << 10 + z << ".1.253.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc0_4);
ndc0_5 = p2p_1gb5ms.Install (net0_5);
oss.str ("");
oss << 10 + z << ".1.254.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc0_5);
ndc2_4a = p2p_1gb5ms.Install (net2_4a);
oss.str ("");
oss << 10 + z << ".4.253.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc2_4a);
ndc2_4b = p2p_1gb5ms.Install (net2_4b);
oss.str ("");
oss << 10 + z << ".4.254.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc2_4b);
ndc3_5a = p2p_1gb5ms.Install (net3_5a);
oss.str ("");
oss << 10 + z << ".5.253.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc3_5a);
ndc3_5b = p2p_1gb5ms.Install (net3_5b);
oss.str ("");
oss << 10 + z << ".5.254.0";
address.SetBase (oss.str ().c_str (), "");
ifs = address.Assign (ndc3_5b);


  • CSMA is a set of rules in which the devices attached to a network first determines whether the channel or carrier is in use or free and then act accordingly.
  • In MAC protocol, the network devices or nodes before transmission senses the channel, therefore this protocol is known as carrier sense multiple access protocol. 

Functionalities of CSMA:

  • When a node has a message to transmit, it first senses the broadcast channel (or carrier) to determine if it is idle (not used by some other node)
  • If the carrier is busy, the node will wait and retry at a later time
  • If the carrier is idle, the node will attempt to transmit 


Research scope of CSMA:

  • Handling energy related issues.
  • Manage medium access.
  • Hidden terminal problems.
  • Define deterministic collision resolution.
  • Channel sharing resources management etc.

Sample code for CSMA:

Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", StringValue ("Dix"));
CommandLine cmd;
cmd.Parse (argc, argv);
NS_LOG_INFO ("Create nodes.");
NodeContainer c;
c.Create (5);
NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1), c.Get (2));
NodeContainer c1 = NodeContainer (c.Get (2), c.Get (3), c.Get (4));
NS_LOG_INFO ("Build Topology.");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer nd0 = csma.Install (c0);  // First LAN
NetDeviceContainer nd1 = csma.Install (c1);  // Second LAN
NS_LOG_INFO ("Add IP Stack.");
InternetStackHelper internet;
internet.Install (c);
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4Addr;
ipv4Addr.SetBase ("", "");
ipv4Addr.Assign (nd0);
ipv4Addr.SetBase ("", "");
ipv4Addr.Assign (nd1);
Ptr<Node> multicastRouter = c.Get (2);  // The node in question
Ptr<NetDevice> inputIf = nd0.Get (2);  // The input NetDevice
NetDeviceContainer outputDevices;  // A container of output NetDevices
outputDevices.Add (nd1.Get (0));  // (we only need one NetDevice here)
multicast.AddMulticastRoute (multicastRouter, multicastSource,
multicastGroup, inputIf, outputDevices);
// 2) Set up a default multicast route on the sender n0
Ptr<Node> sender = c.Get (0);
Ptr<NetDevice> senderIf = nd0.Get (0);
multicast.SetDefaultMulticastRoute (sender, senderIf);