Saturday, May 28, 2011

Install ns-2 Simulator in fedora 13

What is ns-2 Simulator??

Ns is a discrete event simulator targeted at networking research. Ns provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks.


First you need to download ns-2 Simulator
link: NS-2 Simulator Download


Before your ns-2 installation few packages must be already installed. Required packages (for fedora only) are:
1. yum install gcc.
2. yum install tcl-devel.
3. yum install libX11-devel.
4. yum install libXt-devel.
This is an important for f14 users. Fedora 14 users have to do some changes in the code of ns-2.34 (inside some .cc files) before install.
For eg:. lets take an example code "Test::Test(para1, para2).value();" it has to be changed into "Test(para1,para2).value();"


1. Unarchive the downloaded file "ns-allinone-2.34.tar.gz" into /opt
$ tar -xvf ns-allinone-2.34.tar.gz
2. open terminal type
$ cd /opt/ns-allinone-2.34/
3. Start the installation process
$ ./install
4. At the end of installation you can see few lines like:
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.
..................(few lines)
Please put /opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.


1. You MUST put /opt/ns-allinone-2.34/otcl-1.13, /opt/ns-allinone-2.34/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 If you are using sh, you can set it like: export LD_LIBRARY_PATH= 2. You MUST put /opt/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.

Setting the environment variables:

Add all these lines into your ~/.bashrc file:
export PATH=$PATH:"/opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/opt/ns-allinone-2.34/otcl-1.13:/opt/ns-allinone-2.34/lib"
export TCL_LIBRARY=$TCL_LIBRARY:"/opt/ns-allinone-2.34/tcl8.4.18/library"

Validate successful installation:

After these steps, you can run the ns validation suite with
$cd ns-2.34; ./validate

1. Now its time to check if your installation is really successful. You can do so by:
$ cd /opt/ns-allinone-2.34/ns-2.34
$ ./validate (this will take some time)


  1. installation gives error

    gcc 4.3 not found exiting
    when i checked the software version it was gcc-4.5 how to make it compatible or how to install gcc 4.3 on f14

    appreciation in anticipation

    mail me at

  2. try (yum install gcc) in terminal