AMAZON

Showing posts with label ns2 install. Show all posts
Showing posts with label ns2 install. Show all posts

Wednesday, September 19, 2012

Ns2 installation for different linux OS: fedora 17, ubuntu 12.04, Redhat


Installing Network Simulator 2 version

NS2.35 in Ubuntu 11.10,

Download NS-2.35 (http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download)

Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one

sudo apt-get update
sudo apt-get build-essential autoconf automake libxmu-dev
tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install

Once installed the PATH information will be provided to you. 
Copy the PATH and LD_LIBRARY_PATH Variable to .bashrc (see a dot in the beginning)
Input the path information in .bashrc file like this  
export PATH=$PATH:<Place your paths here>
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: <place the LD_LIBRARY_PATHS> here.
Once done, save the file and close

execute the command
source .bashrc

try ns or nam to see whether your installation succeeded.

NS-2.35 in Ubuntu 12.04 LTS -Long Term Support

To install ns2 in Ubuntu 12.04, same step as done in Ubuntu 11.10

Download NS-23.5 from http://www.isi.edu/nsnam/ns/

Go to terminal and install the necessary updates using the command “sudo  apt-get update”  (without Quotes)
Then install the ns2 required libraries using the command “sudo apt-get install build-essential autoconf automake libxmu-dev” (without quotes)
Untar the downloaded ns-allinone-xxx.tar.gz file using the command “tar zxvf ns-allinone-2.35.tar.gz”
execute the commands one by one as given below
cd ns-allinone-2.35
./install
(You get the PATH information if the installation was successful, upon succeeding set the PATH in the relevant file .bashrc)

Type ns and see a  % symbol indicates that the installation of ns2 is successful and also try the command  nam so that a network animator will be opened.

For any doubts, please raise a comment in the following column. I am there to help you.
If you try to install ns2 which comes along with the synaptic package manager, you cannot write new modules and recompile it.
In that case, you need to use the above method of installation

NS2.35 in Fedora 16
Steps:'
Install Fedora using a DVD ISO (if you go for a CD iso, then you need to download lot of packages)
Download NS-2.35 from this website.
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download
Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one
tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install
Once installed the PATH information will be shown in the screen.
Copy the PATH and LD_LIBRARY_PATH Variable to .bash_profile (see a dot in the beginning)
Input the path information in .bash_profile like this
There will be a PATH Variable already available in the .bash_profile file, just copy the PATH information from the NS2 installation and append it over the existing PATH variable (but put a separator : between each path)
export PATH=$HOME/bin:<Put a colon and Place your paths here>
export LD_LIBRARY_PATH=<place the LD_LIBRARY_PATHS> here.
Once done, save the file and close
execute the command
source .bash_profile
try ns (if you see a % indicates ns is installed successfully) or nam (a animation window will be opened).
 NS 2.35 In Fedora 15
Download ns-allinone-2.35 from the NS2 website. The recent version was RC8
select the folder /home/username, untar the file using the command "tar zxvf ns-allinone-xxx.tar.gz" (without quotes).
Go to the folder /home/username/ns-allinone-2.35/ using the command cd  /home/username/ns-allinone-2.35 /  and execute the command ./install (dot /install)
You may encounter an error in the file mac_80211Ext.h and correct the error given in the following line
Open the file /home/username/ns-allinone-2.35/ns-2.35/mac/mac_80211Ext.h and include the following line in the header file area
#include <cstddef>
Go to step3 and type ./install 
Once installation completed, set the path information in .bash_profile (dot bash_profile). you need to set two path variables PATH and LD_LIBRARY_PATH
  
Edit this similar fashion with corresponding version of fedora 15 which u have installed "packages version - octl, tcl, nam, tk,
Now go to /etc folder and type

gedit ~/.bashrc

Add the following lines to the end of it. Remember replace "/your/path" by something like "/home/vina". And accordingly also change the version numbers. This is for ns 2.35.

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.35/otcl-1.13
NS2_LIB=/your/path/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_LI B:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY 
TCL_LIB=/your/path/ns-allinone-2.35/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH 
XGRAPH=/your/path/ns-allinone-2.35/bin:/your/path/ns-allinone-2.35/tcl8.4.14/unix:/your/path/ns-allinone-2.35/tk8.4.14/unix
NS=/your/path/ns-allinone-2.35/ns-2.35/
NAM=/your/path/ns-allinone-2.35/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM

 NS 2.27 in Red hat

there are following steps: 
tar -xzf *
./install
change .bash_profile and add some environment variables. put /home/vinay/ns-allinone-2.27/bin:/home/vinay/ns-allinone-2.27/tcl8.4.5/unix:/home/vinay/ns-allinone-2.27/tk8.4.5/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/vinay/ns-allinone-2.27/otcl-1.8, /home/vinay/ns-allinone-2.27/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 /home/vinay/ns-allinone-2.27/tcl8.4.5/library into your TCL_LIBRARY 
environmental variable. Otherwise ns/nam will complain during startup.
(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
 and tk8.4.5. They are now installed under /home/vinay/ns-allinone-2.27/{bin,include,lib}
so , finally the bash_profile is like this:

PATH=$PATH:$HOME/bin:/home/vinay/ns2/ns-allinone-2.27/bin:/home/vinay/ns2/
ns-allinone-2.27/tcl8.4.5/unix:/home/vinay/ns2/ns-allinone-2.27/tk8.4.5/unix

export LD_LIBRARY_PATH=/home/vinay/ns2/ns-allinone-2.27/otcl-1.8:home/
vinay/ns2/ns-allinone-2.27/lib

export TCL_LIBRARY=/home/vinay/ns2/ns-allinone-2.27/tcl8.4.5/library

cd ns-2.27; ./validate
Note: The ns installation needs x-develop package. Otherwise, it will fail to build TCL TK.
Installation: A possible problem with CPP_NAMESPACE 
 ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile,
 ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile, and
 ns-2.27/indep-utils/webtrace-conv/dec/Makefile,
 needed to be modified in order to fix a bug in ISI's distribution. The bug
 caused a compile-time error that looked like this:
 g++ -c -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -o setdest.o setdest.cc
 In file included from ../../../config.h:54,
 from setdest.h:5,
 from setdest.cc:57:
 ../../../autoconf.h:85: Error: namespace `CPP_NAMESPACE' undeclared
 setdest.cc:71:1: warning: "INFINITY" redefined
 In file included from /usr/include/math.h:40,
 from setdest.cc:43:
 /usr/include/bits/mathdef.h:35:1: warning: this is the location of the previous definition
 make[1]: *** [setdest.o] Error 1
 make[1]: Leaving directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest'
 make[1]: Entering directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec'
 To fix the bug, edit ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile and 
 change this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@
 to this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=std
 In the other two makefiles, append -DCPP_NAMESPACE=std to CFLAGS.
 I discovered that fix by searching the NS news database[2] for
 "CPP_NAMESPACE".

ns2.34 in Fedora 8

Steps to Install ns2.34 in Fedora 8

Step 1:
Download ns-allinone-2.34.tar.gz from the following link
http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=684492

Step 2:
Execute the following commands to install ns2.34 from the terminal. You must login as root.

$cp ns-allinone-2.34.tar /opt/
$cd /opt/
$tar -xzf ns-allinone-2.34.tar.gz 
$cd ns-allinone-2.34
$./install

Step 3:
After a long wait and a whole lot of text, you should see the installation finish up with text like the following:

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 <paths>
    If you are using sh, you can set it like:
                export LD_LIBRARY_PATH=<paths>

(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.

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

For trouble shooting, please first read ns problems page 
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive for related posts.
Step 4:
To change PATH environment & others execute following commands in terminal.

$cd /etc
$gedit ~/.bashrc &

Step 5:
Add following lines at the end of bashrc file.

# LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ns-allinone-2.34/otcl-1.13:/opt/ns-allinone-2.34/lib

# TCL_LIBRARY
export TCL_LIBRARY=$TCL_LIBRARY:/opt/ns-allinone-2.34/tcl8.4.18/library

# PATH
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

Step 6:
To make the change in the path & others permanent, type the following command in terminal.
$ source ~/.bashrc 

You can check what is written in your path by writing
$echo $PATH 
$echo $LD_LIBRARY_PATH 
$echo $TCL_LIBRARY

Step 7:
Now, the installation has been completed. If you try:
$ns 

Then a "%" will appear on the screen. Type "exit" to quit the mode.
Step 8:
You can test/validate the installation by doing the following: [It is not necessary]
$cd /opt/ns-allinone-2.34/ns-2.34/
$./validate
Note that this validation takes a really long time. If it starts out ok, you probably have a good installation.

Step 9:
Simple ns2 Simulation program

$cd /opt/ns-allinone-2.34/ns-2.34/tcl/ex
$ns wireless-demo-csci694.tcl
$nam 694demo.nam

If output comes, then everything is ok :)

Testing:
Way 1:

$ns
%set ns [new Simulator]
%$ns at 1 "puts \"Hello World!\""
%$ns at 1.5 "exit"
%$ns run


Way 2:

Step 1: Create a file named sample.tcl & add the following lines in the file.
set ns [new Simulator]
$ns at 1 "puts \"Hello World!\""
$ns at 1.5 "exit"
$ns run

Step 2: Run the file by executing following command
$ns sample.tcl

Step 3: Output will be: Hello World!

Step 3: Output will be: Hello World!
Installation References

1. http://nsnam.isi.edu/nsnam/index.php/Downloading_and_installing_ns-2
2. http://ns2-experience.blogspot.com/2008/01/d-day-installing-ns2.html
3. http://mobicomclass.wordpress.com/2008/06/17/installing-ns-2-on-fedora-8/
Tutorial References

1. http://www.isi.edu/nsnam/ns/tutorial/

Installing DCCP patch in ns2.34

Step 1:
Copy dccp-ns2.34.patch in /opt/ns-allinone-2.34/ns-2.34 folder.

Step 2:
Open the terminal and go to /opt/ns-allinone-2.34/ns-2.34 folder and execute all the commands.
$cd /opt/ns-allinone-2.34/ns-2.34
$patch -p1 <dccp-ns2.34.patch
$./configure
$make clean
$make
DCCP Patch References

1. http://eugen.dedu.free.fr/ns2/
2. http://sourceforge.net/projects/dccp-ns/files/
3. http://mohittahiliani.blogspot.com/2010/05/dccp-patches-for-ns-2.html

Install ns2.33 in fedora 12

cd ns-allinone-2.33
./install 

sudo gedit ~/.bashrc 
#environment values for NS2/NAM
# LD_LIBRARY_PATH
OTCL_LIB=/your directory/ns-allinone-2.33/otcl-1.13
NS2_LIB=/your directory/ns-allinone-2.33/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/your directory/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your directory/ns-allinone-2.33/bin:/your directory/ns-allinone-2.33/tcl8.4.18/unix:/your directory/ns-allinone-2.33/tk8.4.18/unix
NS=/your directory/ns-allinone-2.33/ns-2.33/
NAM=/your directory/ns-allinone-2.33/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM 

source ~/.bashrc
cd ns-2.33
./validate

ERROR
now i cleared ns in installation.when i type ns whereever in commandpropt i can get %. but i m struggling with nam.when i type nam i got instruction like following.
[code omitted because of length]
: no event type or button # or keysym
while executing
“bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}”
invoked from within
“if {[tk windowingsystem] eq “classic” || [tk windowingsystem] eq “aqua”} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li…”

what steps should be follow to rectify this inconvinent "ERROR"
Requirements : # yum install \
libX11-devel libXext-devel libXau-devel libXmu-devel xorg-x11-proto-devel \ 
gcc-c++ compat-gcc-34-c++ make automake autoconf libtool

There may be something more to install, depending on version.
ns-allinone-2.3x also requires tk-8.4-lastevent.patch :

http://bugs.gentoo.org/attachment.cgi?id=161242
cd ns-allinone-2.34/tk-8.4.18/

patch -p0 < tk-8.4-lastevent.patch

Assume ns-allinone-2.34.tar.gz presence in /home/<user-name>/
tar xvf ns-allinone-2.34.tar.gz && cd ns-allinone-2.34/
&& ./install

ns-allinone-2.35-RC6 can also be recommended :
http://www.isi.edu/nsnam/dist/releas....35-RC6.tar.gz
http://www.isi.edu/nsnam/dist/release/ns-allinone-2.35-RC6.tar.gz
QUOTE : 
ns-allinone-2.3x also requires the tk-8.4-lastevent.patch :
http://bugs.gentoo.org/attachment.cgi?id=161242
..

cd ns-allinone-2.33/tk-8.4.18/
patch -p0 < tk-8.4-lastevent.patch

And run ./install again : Only tk4.8.18 and nam-1.xx will change,
and you should now get a 'nam' that works_

tk-8.4-lastevent.patch.txt
http://www.linuxquestions.org/questions/attachment.php?attachmentid=4166&d=1279693038

Monday, July 16, 2012

How to install Ns-2 doc linux/windows


-->

NS2 Installation Procedure (For Root User)

  • Check for the complete LINUX installation (with all the options enabled during installation) in the system.
  • During installation of NS2 its better to get into the ROOT login.
  • Copy the given ns-allinone-2.34.tar.gz file in the root directory.
  • Extract the files in the same folder using extract option or the command in the terminal as

root>tar -zxvf ns-allinone-2.34.tar.gz

  • The files will be extracted in the newly created folder as ns-allinone-2.34.
  • Now go to the terminal and get into the folder ns-allinone-2.34 and do the following
Root> cd ns-allinone-2.34
Root/ns-allinone-2.34 >./install

  • This command will run for 10-15 minutes. If it is a successful installation you will be getting IMPORTANT NOTICE notes (detailing about the paths to set)
  • Copy the ns-21 file given into the following folder

Computer/file system/etc/profile.d

  • Now close all the terminal and open a new terminal and get into the folder root/ns-allinone-2.34 and give ns command and you will be getting as below when you each time press ENTER key which indicates that the installation is complete .
      • Root/ns-allinone-2.34>./validate
Root/ns-allinone-2.34>ns
%
%
%exit
  • Now you can run the programs in a new terminal.

What ns-21 consists of??
It consist of path
PATH=$PATH:$HOME/bin:/root/ns-allinone-2.34/bin:/root/ns-allinone-2.34/tcl8.4.18/unix:/root/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=/root/ns-allinone-2.34/otcl-1.13:/root/ns-allinone-2.34/lib
export TCL_LIBRARY=/root/ns-allinone-2.34/tcl8.4.18/library



NS2 Installation Procedure (For other User)
Open terminal window

Type $ su & give root password & follow the above mention procedure
For copying ns21.sh file use following command
cp<space><source path><space> <destination path(/etc/profile.d)>
How to create(Enable) a Root User
  • Step1
$ su (give password)
Now it becomes Root
cd <space>/etc/pam.d
Vim gdm
Remove # symbol from 3rd line
Vim gdm- password
Remove! Symbol from 3rd line end

How to install Ns-2 in Windows





 



Thursday, July 12, 2012

how to patch nam, tk, gt-itm, libgb.a, eval.c in ns2 (install steps ns2.28)

1) Decompress ns-allinone 2.28
tar xvzf  ns-allinone-2.28.tar.gz

2) Patch nam: you need the patch file (I attach it)
cp nam-1.11.patch ns-allinone-2.28/nam-1.11/
cd ns-allinone-2.28/nam-1.11/
patch -p0 < ./nam-1.11.patch

3) Patch tk: you need the pacth file (I attach it)
cp tk-8.4-lastevent.patch ns-allinone-2.28/tk8.4.5/
cd ns-allinone-2.28/tk8.4.5/patch -p0 < ./tk-8.4-lastevent.patch 

4) Modify gt-itm files:
4.1) Create the following directories:
mkdir ns-allinone-2.28/gt-itm/bin
mkdir ns-allinone-2.28/gt-itm/lib
4.2) Copy the libgb.a file (I attach it) into the lib folder
cp libgb.a ns-allinone-2.28/gt-itm/lib
4.3) Copy the eval.c file (I attach it) into the src folder
cp eval.c ns-allinone-2.28/gt-itm/src

5) Install ns
cd ns-allinone-2.28/
./install

How to intall ns2 in windows using cywin (Windows + Cygwin + NS2)


--> This document will show you how to install my NS2 (ns-2.28 + all my modules) on Windows platform (windows 2000 or windows XP). 

If you follow each step in this webpage, you can successfully run all the simulation scripts provided me without installing each module. 

(It includes TKN 802.11e EDCF module, NOAH routing, MFlood, CSFQ, Poisson traffic, wireless random uniform and GE error model, and tcldebug.)2006/10/27 add “Evalvid-RA” and wimax “IEEE 802.16 module for ns2 (from NIST)”.

[Cygwin]
1.      Download the cygwin.rar.

2.      Decompress the cygwin.rar

1.      Click the setup.exe to install cygwin.

2.      Because the language of operating system is Traditional Chinese. The text of button is shown in Chinese. But you don’t need to worry about this. I think it is shown in English in your computer. Just click “Next”.

3.      Then choose “Install from Local Directory”

4.      Click “Next”.

(Just keep the settings as they are.) 
 
5.      Click “Next”

6. Click “Browse” to choose where the software is. (Please choose “ftp%3a%2f%2fftp.nctu.edu.tw%2fWindows%2fcygwin”)

7.      Click “OK”.

8.      Click “Next” and you will see the figure shown as follows. In this window, the cygwin setup program let you choose what software you want to install.

9.      Click “View” first to make the word “Category “change to “Full”.

10.  XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, XFree86-etc, make, patch, perl, gcc, gcc-g++, gawk, gnuplot, tar and gzip must be chosen. For example, if I want to install XFree-86 base (upper figure), click the “Skip” of “New” column. The “Skip” will be changed to “4.3.0-1” (lower figure).

11.  Click “Next”.

(Please be patient. It may take a long time to finish the installation.)

12.  When setup is done, it will be shown as following figure. Click “Finish”.

13.  Click “OK” to finish the cygwin setup program.
[myNS2 setup]

1.      Click the icon on the desktop.

2.      For the first time execution, it will generate some environment parameter setting files. In this example, smallko is my login name to windows system. Therefore, the cygwin will create a folder named “smallko” under home directory. (The actual path for smallko folder is: c:\cygwin\home\smallko) It should be noticed that the login name can not have any space in your name. For example, “A B” may cause errors when you install NS2.

3.      Download myNS2.

4.      Decompress the ns-allinone-2.28.rar.

5.      Move this folder under c:\cygwin\home\smallko. (change smallko (login name) with yours)

6.      Open a cygwin window

7.      Change the path to ns-allinone-2.28/ns-2.28

8.      Run the command “./configure; make clean; make

9.      Please be patient. It will take some time to finish the compilation.

10.  When it is done, it should look like as follows.

11.  To make sure that you have successfully installed myNS2, you need to check whether you can find ns.exe under ns-allinone-2.28/ns-2.28

12.  Copy the .bashrc to c:/cygwin/home/smallko 
 
13.  Run the example script to test whether you have setup the path or not.

14.  If you see the error message like “ns command not found”, no worry about this. Sometimes even you have setup the path, but it does not work. You can copy the ns.exe (nam.exe) to the same place as the simulation script. Run the simulation with “./ns.exe” and it will be ok.