Getting Started with ns-3

This short guide is aimed at people new to ns-3, to understand what ns-3 does and how to use it.

ns-3 is a discrete-event network simulator written in C++ and with an optional Python scripting API. If you are new to discrete-event network simulation, you may want to first review this Wikipedia page.

Getting ns-3

There are several ways to get the ns-3 source code:

Supported operating systems

Much of the ns-3 development is performed on GNU/Linux. The ns-3 project supports the following operating systems:

ns-3 consists of a core system with multiple options; some options are not supported on all systems, or must be configured into the system. For a complete guide to installing and building ns-3, consult this wiki page.

Compiling ns-3 from source

Building the ns-3 core has only a few dependencies: a modern Python installation (python 2.4 or greater) and the GNU C compiler package. ns-3 is written in C++ and is known to compile on gcc 4.x. Here are some quick instructions for those who want to build it right away. First, download ns-3.11 using the link above. Then open a console to the directory where you saved the file and do the following:

  bunzip2 ns-allinone-3.11.tar.bz2
  tar xvf ns-allinone-3.11.tar
  cd ns-allinone-3.11
  ./build.py --enable-examples --enable-tests
For a complete guide to installing and building ns-3, consult this wiki page.

The Waf build system is used to build ns-3. Waf is a Python-based build system. Further instructions are in the doc/build.txt file in the distribution.

These links are likely to be of some additional help getting started:

Validating an ns-3 compilation

You can run ns-3 unit tests by changing into the ns-3.10 directory and typing "./test.py" after the build step from above finishes. It should produce output such as:

PASS: TestSuite histogram
PASS: TestSuite sample
PASS: TestSuite devices-mesh-flame
...
PASS: Example wireless/wifi-wired-bridging
PASS: Example wireless/wifi-simple-adhoc-grid
PASS: Example wireless/wifi-ap --verbose=0
93 of 93 tests passed (93 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)

The ns-commits mailing list posts nightly build results from the ns-3-dev repository.

Running ns-3

See this wiki page

Troubleshooting

Please consult this wiki page.