Unquestionably, we can run the ns3 program by our own and this process includes some steps to acquire the finest ns3 program. Through this article our technical experts have highlighted all the essential steps to run ns3 program.
Phase: I
First of all, we have to configure the ns-3.28 packages that have been installed through the implementation of the below mentioned commands.
cd /home/research/ns-allinone-3.28/ns-3.28
sudo ./waf configure
Phase: II
As the next process, we have to utilize the file extension .cc for the creation of simulation program and that is stored in the scratch folder.
Phase: III
Accordingly, we have highlighted some sample code for the reference of ns3 simulation.
- Packet transmission application process
NS_LOG_INFO (“Create Applications.”);
uint32_t packetSize = 1024;
Time interPacketInterval = Seconds (1.0);
V4PingHelper ping (“10.0.6.2”);
ping.SetAttribute (“Interval”, TimeValue (interPacketInterval));
ping.SetAttribute (“Size”, UintegerValue (packetSize));
if (showPings)
{
ping.SetAttribute (“Verbose”, BooleanValue (true));
}
ApplicationContainer apps = ping.Install (src);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (110.0));
- RIP routing protocol configuration
ripRouting.ExcludeInterface (a, 1);
ripRouting.ExcludeInterface (d, 3);
ripRouting.SetInterfaceMetric (c, 3, 10);
ripRouting.SetInterfaceMetric (d, 1, 10);
RipHelper routingHelper;
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (&std::cout);
routingHelper.PrintRoutingTableAt (Seconds (30.0), a, routingStream);
routingHelper.PrintRoutingTableAt (Seconds (30.0), b, routingStream);
routingHelper.PrintRoutingTableAt (Seconds (30.0), c, routingStream);
routingHelper.PrintRoutingTableAt (Seconds (30.0), d, routingStream);
Phase: IV
Consequently, the simulation program have to be run along with the file extension .cc and it is functioning through the implementation of the below mentioned commands. Additionally, the assimilated result is highlighted in the following.
cd /home/research/ns-allinone-3.28/ns-3.28
sudo ./waf –run NS3Program –vis
In fact, we are always there to help you out! So, make use of it!!!