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 a 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 three main ways to get the ns-3 source code:

  • Download the most recent release (currently ns-3.1).
  • Download a repository using mercurial and compile it from source.
    • This is recommended if you want to look at current code or you want to examine an alternate or experimental code branch.
    • If you have Mercurial already installed, you can simply try "hg clone http://code.nsnam.org/ns-3-dev"
  • Browse the source code repositories at http://code.nsnam.org

Supported operating systems

The code has been tested on Linux x86, x86_64 and OS X (intel, ppc) systems, and Windows XP Cygwin and MinGW.

Compiling ns-3 from source

Building ns-3 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.0. Here are some quick instructions for those who want to build it right away, using a build script called waf:

./waf configure
./waf
./waf check
./waf --regression
./waf --run udp-echo

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 typing "./waf check" after the compilation. It should produce output such as:

Compilation finished successfully 
PASS GlobalRouteManagerImpl
PASS EventGarbageCollector
PASS Olsr
PASS OlsrRoutingTable
PASS OlsrHeader
PASS UdpSocket
PASS Tags
PASS Packet
...

You can also run ns-3 regression tests of the examples and compare the output with known good traces. Try typing "./waf --regression".

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

Running ns-3

See this wiki page



Generated on 08/Jul/2008 at 21:00:02. Thanks to the XORP (http://www.xorp.org) project for this stylesheet.