I was contacted by a friend asking me if I can write an article explaining how to get network simulator allinone v 2.35 running on Ubuntu 10.04. It is true that NS3 is out, but the later version is not backward compatible with many of the existing model. So here are the steps.

Well, first of all, download Network Simulator from HERE.

Then, you have to make sure that the following packages are installed on your ubuntu. So open up a terminal shell and run this command:

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

Extract the downloaded NS package either using the right click context menu (GUI Ubuntu) or using the following command from a terminal shell.

tar -xvzf ns-allinone-2.35.tar.gz

Go to the directory of where you have extracted the package and install NS2 using the following command:
cd ns-allinone-2.35 then    ./install

Now that NS2 is installed, there are some environment variables that need to be added to your profile. This can be done by editing the .bashrc file. Be sure to change “/path/to” to the path of where you have extracted NS2.
Open the file using: gedit ~/.bashrc and the following at the end of the file:

# LD_LIBRARY_PATH
OTCLLIB=/path/to/ns-allinone-2.35/otcl-1.14
NS2=/path/to/ns-allinone-2.35/lib
USR_LocalLIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCLLIB:$NS2:$USR_LocalLIB
# TCL_LIBRARY
TCLIB=/path/to/ns-allinone-2.35/tcl8.5.10/library
USRLIB=/usr/lib
export TCL_LIBRARY=$TCLIB:$USRLIB
# PATH
XGRAPH=/path/to/ns-allinone-2.35/xgraph-12.2/:/path/to/ns-allinone-2.35/bin:/path/to/ns-allinone-2.35/tcl8.5.10/unix:/path/to/ns-allinone-2.35/tk8.5.10/unix
NS=/path/to/ns-allinone-2.35/ns-2.35/
NAM=/path/to/ns-allinone-2.35/nam-1.15/
export PATH=$PATH:$XGRAPH:$NS:$NAM

You need to validate NS2 to check if everything is ok but beware that it will take lots of time:
cd ns-2.35 then ./validate

Now if you want to start NS2 directly without going into the directory every time, it is useful to create a symbolic link from a terminal:
ln -s /path/to/ns-allinpne-2.35/ns-2.35/ns /usr/bin/ns

And That is it ! You can now run ns from a terminal window by executing :ns if you received the “%” sign, it means that NS is running.