|Initial release||June 30, 2008|
3.28 / March 22, 2018
|Written in||C++ (core) Python (bindings)|
|Operating system||Linux, FreeBSD, macOS|
ns (from network simulator) is a name for a series of discrete event network simulators, specifically ns-1, ns-2, ns-3 and ns-4. All are discrete-event computer network simulators, primarily used in research and teaching.
The first version of ns, known as ns-1, was developed at Lawrence Berkeley National Laboratory (LBNL) in the 1995-97 timeframe by Steve McCanne, Sally Floyd, Kevin Fall, and other contributors. This was known as the LBNL Network Simulator, and derived in 1989 from an earlier simulator known as REAL by S. Keshav.
Ns-2 began as a revision of ns-1. From 1997-2000, ns development was supported by DARPA through the VINT project at LBL, Xerox PARC, UCB, and USC/ISI. In 2000, ns-2 development was support through DARPA with SAMAN and through NSF with CONSER, both at USC/ISI, in collaboration with other researchers including ACIRI.
Ns-2 incorporates substantial contributions from third parties, including wireless code from the UCB Daedelus and CMU Monarch projects and Sun Microsystems.
In 2006, a team led by Tom Henderson, George Riley, Sally Floyd, and Sumit Roy, applied for and received funding from the U.S. National Science Foundation (NSF) to build a replacement for ns-2, called ns-3. This team collaborated with the Planete project of INRIA at Sophia Antipolis, with Mathieu Lacage as the software lead, and formed a new open source project.
In the process of developing ns-3, it was decided to completely abandon backward-compatibility with ns-2. The new simulator would be written from scratch, using the C++ programming language. Development of ns-3 began in July 2006.
Current status of the three versions is:
- ns-1 development stopped when ns-2 was founded. It is no longer developed nor maintained.
- ns-2 development stopped around 2010. It is no longer developed nor maintained.
- ns-3 is actively being developed and maintained.
NS-4 is the name of a P4 driven network simulator developed by Tsinghua University, China.
NS4 is divided into control plane half and data plane half, which collectively simulate a complete network system with programmable data plane (PDP). Developers simulate a controller by instantiating a ‘Controller Model‘ and simulate a P4 device by instantiating a ‘Programmable Data Plane Model. Traditional devices like router or switch are also supported in NS4 but omitted in the figure.
The procedures to simulate a P4-enabled network are
1. configure the behavior of data plane by inputting a compiled P4 program to the P4 pipeline configurator; 2. create control plane and populate table entries to P4 devices, by either implementing a controller application inside the controller model or simply running an arbitrary controller application (such as ONOS) outside NS4; 3. add ports (maybe connected to various channels) to the PDP model. 4. At this point, we have this PDP model configured and functional as a P4 device. Next steps are building network topology, installing applications at terminal nodes and triggering the simulator.
NS4 can define the behavior of your network element just by inputting a P4 file. When simulating there is no need to learn the network simulator libraries and implement device behavior using network simulator's library anymore. It thus solves all the complications of ns-2 and ns-3
ns is built using C++ and Python with scripting capability. The ns library is wrapped by Python thanks to the pybindgen library which delegates the parsing of the ns C++ headers to castxml and pygccxml to automatically generate the corresponding C++ binding glue. These automatically-generated C++ files are finally compiled into the ns Python module to allow users to interact with the C++ ns models and core through Python scripts. The ns simulator features an integrated attribute-based system to manage default and per-instance values for simulation parameters.
The general process of creating a simulation can be divided into several steps:
- Topology definition: To ease the creation of basic facilities and define their interrelationships, ns-3 has a system of containers and helpers that facilitates this process.
- Model development: Models are added to simulation (for example, UDP, IPv4, point-to-point devices and links, applications); most of the time this is done using helpers.
- Node and link configuration: models set their default values (for example, the size of packets sent by an application or MTU of a point-to-point link); most of the time this is done using the attribute system.
- Execution: Simulation facilities generate events, data requested by the user is logged.
- Performance analysis: After the simulation is finished and data is available as a time-stamped event trace. This data can then be statistically analysed with tools like R to draw conclusions.
- Graphical Visualization: Raw or processed data collected in a simulation can be graphed using tools like Gnuplot, matplotlib or XGRAPH.