Installation of NS3 on Ubuntu

NS3 is a discrete event network simulator, which is widely use for the research in the network domain. The advantage of using NS3 instead of NS2  is that we can code using c++, while the prior one is based on TCL. In this post we will cover the installation of this on Ubuntu 14.04.

Step 1: Installation of supported packages and library.

  •       gcc and g++ compiler
$ sudo apt-get install gcc g++ python
  •      Python development environment
$ sudo apt-get install  python-dev
  •     qt frame work
$ sudo apt-get install qt4-dev-tools
  • Mercurial for repository management
$ sudo apt-get install mercurial
  • Bazaar revision control for python binding
$ sudo apt-get install
  • Compilation packages
$ sudo apt-get install cmake libc6-dev libc6-dev-i386 g++-multilib
  • Debugging tools, valgrind for memory debugging and leaking
$ sudo  apt-get install gdb valgrind

 

  • gsl is gnu scientific library for mathematical function in c,c++
$ sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
  • Bison is parser generator in gnu project
$ sudo apt-get install flex bison libfl-dev
  • Tcpdump is network packet capture tools, generally installed as by default.
$ sudo apt-get install tcpdump
  • sqllite for database support
$ sudo apt-get install sqlite sqlite3 libsqlite3-dev
  • XML library support
$ sudo apt-get install libxml2 libxml2-dev
  • GTK libraries which is use for creating graphical user interface.
$ sudo apt-get install libgtk2.0-0 libgtk2.0-dev
  • Linux container, operating system based virtualization. Vtun is virtual tunnel
$ sudo apt-get install vtun lxc
  • uncrustify use for source code modification
$ sudo apt-get install uncrustify
  • imagemagic for editing image and texlive for documentation
$ sudo  apt-get install doxygen graphviz imagemagick
$ sudo  apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng
$ sudo apt-get install python-sphinx dia
  • python libraries for graph
$ sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
  • c++ libraries
$ sudo apt-get install libboost-signals-dev libboost-filesystem-dev
  • Message passing interface use for high performance computing.
$ sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev

Now the next step is downloading the packages from repository.

Step 2:

  • Create a directory for downloading repository files
$ mkdir NS3repo
$ cd NS3repo
  • Clone the files to this directory
$ hg clone http://code.nsnam.org/ns-3-allinone

Step 3: You will find ns-3-allinone directory move to this directory and run the python file to download.

 $ cd ns-3-allinone
 $ ./download.py

Once download is complete you will find below contain in your directory

bake  build.py  constants.py  constants.pyc  dist.py  download.py  netanim  ns-3-dev  pybindgen  README  util.py  util.pyc

Step 4: This is time to compile and build the package. run build python file

 
./build.py

Step 5: Configure it using waf. So change the directory to ns-3-dev

cd ns-3-dev
CXXFLAGS="-O3" ./waf configure 
./waf -d optimized configure; ./waf 
./waf --enable-examples configure 
./waf --enable-tests configure

Step 6: Now check your installation by running python test file

 ./test.py

if you find below message it means your installation is successful. You can start programing

211 of 214 tests passed (211 passed, 3 skipped, 0 failed, 0 crashed, 0 valgrind errors)

Comments are closed.