Source codes for Blackhole attack in wireless Adhoc Networks (Manets)
Part 1
Instructions for Installing Ns2.34 in Ubuntu versions
Instructions for
Installing Ns2.34 in Ubuntu 10.04
This manual will work for NS2 allinone-2.34 with Ubuntu 10.04.
As Ubuntu is a new version 10.04 need following packages before any further
installation, otherwise it will not work with it.
Please follow the following steps:
1. Install
necessary tools for building:
2. It turns out
that otcl does not like the version of gcc installed by default in Lucid. So go
ahead and change ns-allinone-2.34/otcl-1.13/Makefile.in
Find the Line That says
CC = @CC@
CC = @CC@
and change it to:
CC = gcc-4.3
3.
Now follow the following steps for installation of nsallinone
2.34 and it will work with your machine. (Copy ns-allinone-2.34.tar.gz)
Suppose that there is
"ns-allinone-2.33.tar.gz" in current directory (e.g. "~/" for
me is "/home/ram").
All steps are done in
Terminal, so open a terminal in Accessories/Terminal.
To extract the file:
tar xvfz
./ns-allinone-2.33.tar.gz
4. Change your directory
within terminal as following way
$ cd /home/ram
$ cd
/home/ram/ns-allinone-2.34
4.
Download & install some packages from
repository if needed
$ sudo apt-get install build-essential
autoconf automake libxmu-dev
5.
Install the ns2
$ cd ns-allinone-2.34
$ ./install
6. Edit some
paths
$ gedit ~/.bashrc
Put these lines on that
file in the last. Off course, you might change
/home/ram for it depends
on where you extract ns-allinone-2.34.tar.
# LD_LIBRARY_PATH
OTCL_LIB=/home/ram/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/ram/ns-allinone-2.34/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
OTCL_LIB=/home/ram/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/ram/ns-allinone-2.34/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=/home/ram/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/ram/ns-allinone-2.34/bin:/home/ram/ns-allinone-
2.34/tcl8.4.18/unix:/home/ram/ns-allinone-2.34/tk8.4.18/unix:/home/ram/ns-
allinone-2.34/xgraph-12.1/
NS=/home/ram/ns-allinone-2.34/ns-2.34/
NAM=/home/ram/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
XGRAPH=/home/ram/ns-allinone-2.34/bin:/home/ram/ns-allinone-
2.34/tcl8.4.18/unix:/home/ram/ns-allinone-2.34/tk8.4.18/unix:/home/ram/ns-
allinone-2.34/xgraph-12.1/
NS=/home/ram/ns-allinone-2.34/ns-2.34/
NAM=/home/ram/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
7. Validate
it (take very long time compare to install process)
$ cd ns-2.33
$ ./validate
If you have any doubts please comment.. i will try to solve it my level best. Thank you.
Testing ns2 InstallationUse the following ns batch command
set ns [new Simulator]
$ns at 1 “puts \“Hello World!\””
$ns at 1.5 “exit”
$ns run
Then,
1. Copy the commands above and paste in the text editor
2. Save the file as simple.tcl
3. Type command in command prompt
$ ns simple.tcl
4. It will show Hello World in the line below
TroubleShooting
1. Problem : The system cannot find Tcl or it tells that Tcl does not install correctly
Solution 1 : Check your ns tcl nam ... version, check folder name. If it is not correct, edit the .bashrcSolution 2 : run ./install again
2. Problem : nam does not work
Solution 1 : In fact, you need to change that particular file in your Linux manually.
Here is what you should do.
Apply the following patch :
--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200
+++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200
@@ -586,6 +586,9 @@
/* ColormapNotify */ COLORMAP,
/* ClientMessage */ 0,
/* MappingNotify */ 0,
+#ifdef GenericEvent
+ /* GenericEvent */ 0,
+#endif
/* VirtualEvent */ VIRTUAL,
/* Activate */ ACTIVATE,
/* Deactivate */ ACTIVATE,
Create a file with the above lines and name it : abc.patch. To apply the patch navigate to ns directory and execute the following command in terminal:
patch -b < abc.patchThen run $ ./install to compile and install ns2 again. Hope this helps, drop in your comment for HELP ! :)
No comments:
Post a Comment