Networking engineers and researchers love ns-3, once they understand how easy it is to set up any complex networking topology. NS-3 supports most of the wired and wireless networking technologies. NS-3 is offering detailed documentation and many example c++ scripts related to a variety of networking technologies. Having experience in working with Ethernet, Wi-Fi, Wi-Fi 6, and LTE technologies, I would like to introduce you to important steps to write either wired or wireless ns-3 script. You may take any complex ns-3 script, you can understand it easily by mapping it into the following steps:
- Create a number of nodes using NS-3 NodeContainer (C++ classes). In NS-3, we can set up any networking equipment (Wi-Fi, LTE, Ethernet, Computer, Server, Cell Phone, Laptop) using nodes.
- Deploy nodes using placement and mobility models. (Wi-Fi or LTE networks).
- Connect nodes using suitable communication channels with necessary configuration (e.g, Ethernet( CsmaHelper, PointToPointHelper), YansWifiChannelHelper, LteHelper, PointToPointEpcHelper).
- Install technology specific protocols using Helper classes on nodes.
- Install TCP/IP protocols on nodes (using InternetStackHelper)
- Configure IP addresses for all nodes (Ipv4AddressHelper)
- Enable global routing using Ipv4GlobalRoutingHelper::PopulateRoutingTables ()
After setting up your topology, we want to evaluate our test set up. NS-3 is offering a rich number of network applications to evaluate your test set up. (For example, it supports TCP, UDP, PING, and HTTP applications).
- Configure network application specific traffic characteristics such as packet size, number of packets, packet transmission interval etc.
- Install client and server applications carefully.
- Configure start and stop timings of your applications.
- To collect network performance metrics at the end of the simulation such as throughput, delay, jitter, and packet loss for each flow, install NS-3 FlowMonitor on nodes.
- To collect and view various flow packets at the end of the simulation, enable the packet capturing feature (using EnablePcapAll) in your script.
- It is necessary to use Stop::Simulator () to collect flow statistics at the end of the simulation.
- It is necessary to use Simulator::Run() for starting your simulation execution.
- To visualize simulation details such as nodes placement, mobility, and their packets exchange, you can generate animation XML file using NS-3 AnimationInterface. It can be viewed at the end of the simulation using NS-3 supporting NetAnim visualization tool.
- Finally, release your simulation resources using Simulator::Destroy().
That’s all. With this just explore any ns-3 script for understanding details and make necessary changes for your simulation setup.
You may refer the following link to know more details:
https://www.nsnam.org/docs/tutorial/singlehtml/