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.
Download:First you need to download ns-2 Simulator
link: NS-2 Simulator Download
Pre-Installation: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.
Note: 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();"
Installation: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
4. At the end of installation you can see few lines like:
Libraries have been installed in: /opt/ns-allinone-2.34/lib 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/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) 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.
IMPORTANT NOTICES: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:
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)