Installation & Configuration of Network Simulator NS2

Please follow and like us:


I am using Fedora 17 to install NS2. Follow these steps to install & configure NS2.

Step 1:

  • Downlaod ns2 application from the following site and save it to /home
  • Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one.
  • tar zxvf ns-allinone-2.35.tar.gz

Step 2:

  • From terminal login as root and do the following (internet must also be connected in order to install the package dependencies).
  • yum install autoconf
  • yum install automake
  • yum install gcc-c++
  • yum install libX11-devel
  • yum install xorg-x11-proto-devel
  • yum install libXt-devel

And for nam installation (optional):

  • yum install libXmu-devel
  • cd ns-allinone-2.35
  • ./install

Step 3:

    • Ns-allinone package has been installed successfully.
    • Here are the installation places:
    • tcl8.5.10: /home/arvind/ns-allinone-2.35/{bin,include,lib}
    • tk8.5.10: /home/arvind/ns-allinone-2.35/{bin,include,lib}
    • otcl: /home/arvind/ns-allinone-2.35/otcl-1.14
    • tclcl: /home/arvind/ns-allinone-2.35/tclcl-1.20
    • ns: /home/arvind/ns-allinone-2.35/ns-2.35/ns
    • nam: /home/arvind/ns-allinone-2.35/nam-1.15/nam
    • xgraph: /home/arvind/ns-allinone-2.35/xgraph-12.2
    • gt-itm: /home/arvind/ns-allinone-2.35/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns
  • After successful installation a message will appear on terminal like this.
  •     and  ./install
  • Then give install command as follows.
    Go to cd/home/ns-allinone-2.35
  • /home/ns-allinone-2.35/ns-2.35/linkstate/ls.h
  • open with root and type vi editor and open ls.h and change above given code.
  • to this line  
    void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
  • change the following line to
     void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
  • you may get an error called ~ns-2.35/linkstate/ls.h error in line number 137.
  • Please put /home/arvind/ns-allinone-2.35/bin:/home/arvind/ns-allinone-2.35/tcl8.5.10/unix:/home/arvind/ns-allinone-2.35/tk8.5.10/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

        (1) You MUST put /home/arvind/ns-allinone-2.35/otcl-1.14, /home/arvind/ns-allinone-2.35/lib, into your    

             LD_LIBRARY_PATH environment variable.

  • If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH.

    If you are using csh, you can set it like: setenv LD_LIBRARY_PATH <paths>

    If you are using sh, you can set it like:
    export LD_LIBRARY_PATH=<paths>

    (2) You MUST put /home/arvind/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.

    After these steps, you can now run the ns validation suite with following command:

    cd ns-2.35; ./validate

    open terminal and type

    gedit ~/.bash_profile

    command.....then paste accordingly.

    /home/arvind/ns-allinone-2.35/bin:/home/arvind/ns-allinone-2.35/tcl8.5.10/unix:/home/arvind/ns-allinone-2.35/tk8.5.10/unix  into PATH variable like this and set LD_LIBRARY_PATH & TCL_LIBRARY as given below:


    export LD_LIBRARY_PATH= /home/arvind/ns-allinone-2.35/otcl-1.14, /home/arvind/ns-allinone-2.35/lib

    Export TCL_LIBRARY=/home/arvind/ns-allinone-2.35/tcl8.5.10/library

    Save this file.
    Open terminal and go:
    cd /home/ns-allinone-2.35/ns-2.35
    Type ./validate

    command to validate all the path of ns 2



Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy Website? Please spread the word :)

Follow by Email