ns (simulator) Admin


This build procedure describes how to build a personal ns installation on a RHEL Linux system whose software is managed by the Yum package management system. We welcome suggestions to improve this procedure.

You need to build your own installation of ns-3 in your home directory. We can't build a shared ns-3 into /util because output files that you will generate are built at the top level of the build directory; you can't specify the file output location. If we built ns-3 in /util, you wouldn't be able to use it because you can't create files in the read-only filesystem.

Before you build, make sure you have enough space in your home directory for it. This build will consume about 1.45 GB of space.


Prepare Compiler

  1. The build process requires very recent gcc and g++ builds. In our yum-managed Linux environment, this means you must use gcc44 and g++44. The build scripts don't honor environment variables, so don't try specifying CC=/usr/bin/gcc44 or similar. So, in your home directory, create a local binary directory called ~/bin. Hack the system gcc and g++ by temporarily remapping them with symlinks.
    % cd
    % mkdir bin
    % cd ~/bin
    % ln -s /usr/bin/gcc++44 gcc
    % ln -s /usr/bin/g++44 g++
  2. Set your shell's search path environment variable to use your local binary directory first. This will coerce the build process to use the symlinks you just created above. In tcsh, the command is:
    % setenv PATH ~/bin:${PATH}
  3. Verify that your local binary directory is first in your search path:
    % printenv PATH


  1. Download the latest ns-3 tarball, linked in the References section, below. Save it in your home directory. Unzip and untar it.
    % ls -al ns-allinone-3.13.tar.bz2 
    -rw------- 1 cwmiller csestaff 19236016 Apr 20 12:05 ns-allinone-3.13.tar.bz2
    % bunzip2 ns-allinone-3.13.tar.bz2
    % tar -xvf ns-allinone-3.13.tar
  2. Build it:
    % cd ns-allinone-3.13
    % ~/ns-allinone-3.13% ./build.py


  1. Change directory into the ns subdirectory:
    % ~/ns-allinone-3.13% cd ns-3.13
  2. Configure it, enable examples:
    ns-3.13% ./waf configure --enable-examples
    ns-3.13% ./waf


  1. Run the 'Simple Global Routing' example:
    ns-3.13% ./waf --run simple-global-routing
  2. List output (*.pcap) files:
    ns-3.13% ls simple-global-routing*
    simple-global-routing-0-1.pcap  simple-global-routing-2-1.pcap  simple-global-routing-2-3.pcap  simple-global-routing.tr
    simple-global-routing-1-1.pcap  simple-global-routing-2-2.pcap  simple-global-routing-3-1.pcap
  3. Use tcpdump to view *.pcap files:
    ns-3.13% tcpdump -tt -r simple-global-routing-0-1.pcap


  1. http://www.nsnam.org/