Installing Network Simulator 2 (NS2.34) in Ubuntu 11.04

Already this blog posts various titles on installing NS2 in Linux distros. Here is the step for installing in Ubuntu 11.04.

1. Version taken is NS2.34

2. Since ubuntu 11.04 uses GCC-4.5.2, there should be some minor tweeks.

3. Two files should be edited ~ns-2.34/tools/ and ~ns-2.34/mobile/  as given in the following post

4. Install the following things in Ubuntu

sudo apt-get install build-essential autoconf automake libxmu-dev

sudo apt-get install gcc-4.4

5. open the file ~ns-2.34/otcl-1.13/configure and change the line number 6304 to SHLIB_LD="gcc -shared" instead of SHLIB_LD="ld -shared"

6. open the file ~ns-2.34/otcl-1.13/ and change the line CC    @CC@ to CC    gcc-4.4

7. Set the path in /home/<name>/ .bashrc as in

8. After setting the path, sometimes overflow error may come when running ns and nam, so open the file ~ns-2.34/tcl8.X.x/unix/ and in line number 270 change @CC@ to @CC@ –V 4.4

Thats it!!! NS2 Installed.

(Thanks to:



  1. Hey thanks alot yaar. It worked!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  2. I have a problem. I have installed ns2 through Ubuntu Software Center because I couldn't install with Terminal. It was impossible for me
    Now I have to install a patch for RSVP and I don't know how. In all the tutorials I have saw, they go to the folder of ns2 and continue with the installation.

    The problem is that I don't have a ns2 folder, all the files are spread in several folders.
    I don't know what I have to do to install a patch in this case.

    Can somebody help me please?

    Send an email

  3. Sir i have installed ns2, in the above manner, but during validating all the tests failed, does that affect my working on Ns2 in any manner. plz help me sir.

  4. No even if validation fails, ns2 will run

  5. Hello Sir,
    I am using Ubuntu 11.04 Natty Nehwal version and tried installing ns2 version 2.34 following above instructions. After I was done with the complete procedure of setting the path in the .bashrc file I was NOT able to start ns2 or nam using the ns or nam command. It said that ns2 is not installed on this system and that use sudo apt-get install ns2 command to install it. It was the same case with nam.
    The lines added to the .bashrc file are:


    After all this was done I used the sudo apt-get install for ns2 and nam both. Luckily enough both of them got installed and when I type ns or nam in the terminal it works but strangely the ./validate still fails and prints memory traces having Aborted labels because your above reply states that ns2 will run.
    Does it apply to my system as well or is there still a problem with the ns2 installation?
    Kindly Reply.
    Thank You.

  6. hey omkar
    please check the PATH variable,
    there should be a space in between
    export PATH=
    export LD_LIBRARY_PATH=

    So if, you make a space between export and PATH and export and LD_LIBRARY_PATH, your problme will be rectified

    BTW, ubuntu11.04 comes with the predefined ns2 tool and you cannot recompile it that much easy, but still you can run tcl files and see the nam demo.

    better go with your own installation and succeed.

  7. Sir,
    I've changed the ~ns-2.34/tcl8.4.18/unix/, line 270 to

    @CC@ –V 4.4 instead of @CC@

    but still overflow..

  8. ok fixed :D

    needed to install again..

  9. [...] [...]


Post a Comment

Popular Posts