Thursday, April 10, 2014

NS2 stands for network simulator and it is not in fedora repository but it's allinone package is available on isi.edu recently ns-2.35 is latest with updated tcl and tk library and support for gcc-4.x series.

Install Dependences :
vinayak]$su -
enter admin password

yum install autoconf
yum install automake
yum install gcc-c++
yum install libX11-devel
yum install xorg-x11-proto-devel
yum install libXt-devel
yum install libXmu-devel

Build ns-allinone-2.35
Go to you download directory and extract package (tar -xvf tarball), go to extracted directory and run
#./install

you will face below issue when execute this-
installation fails with the following messagelinkstate / ls.h: 137:58: Note : declarations in dependent base 'std :: map, std :: allocator >>' are not found by unqualified lookuplinkstate / ls.h: 137:58: note : use 'this-> erase' insteadmake: *** [linkstate / ls.o] Error 1Ns make failed!See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:- 
Modify ns-2.35/linkstate/ls.h line 137void eraseAll () {erase (baseMap :: begin (), baseMap :: end ());} 
Should bevoid eraseAll () {this-> erase (baseMap :: begin (), baseMap :: end ());} 
Then . / Install

Validate ns-2.35
Go to ns-2.35 directory and run
#./validate (take almost 1 hour so keep patience)


Add PATH in .bashrc
vim ~/.bashrc
Add the following lines to the end of it. Remember replace “/opt/” by your installation path like “/home/username”. And accordingly also change the version numbers. This is for ns 2.35.

# LD_LIBRARY_PATH
OTCL_LIB=/opt/ns-allinone-2.35/otcl-1.14
NS2_LIB=/opt/ns-allinone-2.35/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/opt/ns-allinone-2.35/tcl8.5.8/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/opt/ns-allinone-2.35/bin:/opt/ns-allinone-2.35/tcl8.5.8/unix:/opt/ns-allinone-2.35/tk8.5.8/unix
NS=/opt/ns-allinone-2.35/ns-2.35/
NAM=/opt/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM



Logout/reboot your system and its done ... enjoy ... :)