Ns-3 Configuration Using the Terminal

Navigation: Main -> ns-3 real-time -> ns-3 Configuration Using the Terminal

Download the NS3 source code
1) Install prerequisite packages. Paste this into the terminal:


 * sudo apt-get install -y build-essential vim python-dev mercurial bzr valgrind gsl-bin libgsl0-dev libgsl0ldbl flex bison tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev vtun lxc uncrustify doxygen graphviz imagemagick texlive texlive-latex-extra texlive-generic-extra texlive-generic-recommended texlive-extra-utils texi2html texinfo python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev openmpi-bin mpi-default-dev eclipse

2) Download ns-3 sources using Mercurial. Run the following in the terminal:






 * You are now ready to build the ns-3 distribution.

Building ns-3 with Waf

 * Go ahead and change into directory.By default it is configured to build the debug version.Here we may try to make a change here: configuring the waf to make a optimized build ( Please note that the second command to clean out the previous build may not work, but it can help you remove the previously built libraries and object files if you have built the project before ):


 * After that trial, now go ahead and switch back to the debug build:


 * After the proper configuration, you can build the ns-3 project by simply typing( Note that there may be several modules not built):


 * Another tip about Waf configuration.We may note that in the previous configurations, some NS-3 features are "not enabled".If you wish to use these features( for example,emulation features ), you could reconfigure the build using the following command:

Testing ns-3

 * You can run the unit tests of the ns-3 distribution by running the ”./test.py -c core” script( most of the tests should be passed and there may be several be skipped ):

Running a Script

 * We typically run scripts under the control of Waf.To run a program, simply use the --run option in Waf.Here we would try a simple "hello world" program by typing:


 * The program will produce the following output if everything's right.Congratulations.You are an ns-3 user now.

Reference
1. Getting Started -- ns-3 ns-3-dev documentation