error in blackholeaodv.tcl----URGENT-----

2,178 views
Skip to first unread message

shivani goel

unread,
Mar 29, 2015, 12:05:59 PM3/29/15
to ns-u...@googlegroups.com
hello 
I am a final year B.Tech student.
I am working on a project "Dectection of Malicious Nodes" 

While executing the blackholeaodv.tcl file i got the following error:

"invalid command name "Agent/rtProto/blackholeAODV"
    while executing
"Agent/rtProto/blackholeAODV instproc init args {
        $self next $args
}       "
    (file "blackholeaodv.tcl" line 19)

"

I am working on Ubuntu 14.04- 64bit and NS2 version is ns2.34

I am attaching the blackholeaodv tcl file and patch that i have used.

i got the same error in NS2.35 also. That's why i moved to version 2.34 thinking that the error might be because of the newer version.

i also found an 'idsaodv' package from one of your posts... Please guide me what exactly i should do... and which version of ns2 I should use.

or if you have some other tcl files of blackholeaodv and idsaodv that are without rtproto...please provide them..

Please help....
blackholeaodv2013-ns234_4.patch
blackholeaodv.tcl
idsaodv.zip

shivani goel

unread,
Mar 29, 2015, 12:56:44 PM3/29/15
to ns-u...@googlegroups.com
And i already have the other blackholeaodv2005 simulation examples
But they don't show the packet drop by the blackholes

Please Help 

knudfl

unread,
Mar 29, 2015, 4:30:18 PM3/29/15
to ns-u...@googlegroups.com
Hi .

You cannot execute a file.tcl, but you can run it with an interpreter.
The ns2 interpreter is 'ns' :   $ ns blackhole-simulation.tcl
( Or  :   $ ns-blackhole  blackhole-simulation.tcl )

Tcl files are text files.
Please read "blackholeaodv.tcl" to know that it isn't  a simulation file.
"blackholeaodv.tcl" is a configuration file. But no known examples are using it.
-

About "idsAODV" :  I did a build last year, but some code may be missing :
$ ns-idsAODV idsaodv2.tcl
num_nodes is set 20
Creating nodes...
Wrong node routing agent!
-

About `blackholeaodv' examples :  Easy to add "blackhole" to a random simulation file :
Please see the example `aodv-Xgr_blackhole.tcl' in xgraph_ns2-files-tcl_03.2015.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNeC1SZDdERmRPSm8/view?usp=sharing

######### Added for blackholeAODV
set val(nn)      15
set val(nnaodv)  5
set val(brp)     blackholeAODV
##########
.
.
###################################### Added for blackholeAODV

# $ns_  node-config  -adhocRouting $val(brp)
for {set i $val(nnaodv) } {$i<$val(nn) } {incr i} {
     
set node_($i) [$ns node]
     $node_
($i) random-motion 0;
     $ns at
0.01 "$node_($i) label \"blackhole node\""
}
##################################################

-
idsaodv2.tcl

knudfl

unread,
Mar 29, 2015, 4:40:01 PM3/29/15
to ns-u...@googlegroups.com

knudfl

unread,
Mar 29, 2015, 7:37:21 PM3/29/15
to ns-u...@googlegroups.com
Hi.

Got it right now.
If you still have the ns-2.35 patched with blackholeaodv2013-ns235_1.patch :
You can add idsAODV with  "idsAODV-for-blackhole2013-patched_ns235.patch"
https://drive.google.com/file/d/0B7S255p3kFXNS2NrcVRETVVPYzg/view?usp=sharing
( Note : You can have as many ns-allinone-2.xx as you want, installed at the same time.
* But :  Do never add any *PATH text to .bashrc ).

Else :
tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing
cd ns-allinone-2.35/
patch -p0 < blackholeaodv2013-ns235_1.patch
https://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing
patch -p0 < idsAODV-for-blackhole2013-patched_ns235.patch
./install
cd ns-2.35/
cp ns ns235-blackhole+idsaodv
sudo cp ns235-blackhole+idsaodv  /usr/local/bin/

Simulation :  $ ns235-blackhole+idsaodv idsaodv2.tcl
num_nodes is set 20
Creating nodes...

INITIALIZE THE LIST xListHead
Loading random connection pattern...
cbr_
(0) has been created over udp_(0)
udp_
(0) and null_(0) agents has been connected each other
cbr_
(1) has been created over udp_(1)
udp_
(1) and null_(1) agents has been connected each other
cbr_
(2) has been created over udp_(2)
udp_
(2) and null_(2) agents has been connected each other
cbr_
(3) has been created over udp_(3)
udp_
(3) and null_(3) agents has been connected each other
cbr_
(4) has been created over udp_(4)
udp_
(4) and null_(4) agents has been connected each other
cbr_
(5) has been created over udp_(5)
udp_
(5) and null_(5) agents has been connected each other
cbr_
(6) has been created over udp_(6)
udp_
(6) and null_(6) agents has been connected each other
cbr_
(7) has been created over udp_(7)
udp_
(7) and null_(7) agents has been connected each other
cbr_
(8) has been created over udp_(8)
udp_
(8) and null_(8) agents has been connected each other
Starting Simulation...
channel
.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_
= 1.5,  distCST_ = 550.0
SORTING LISTS
...DONE!

... The files  Ids.tr 22.3MB and Ids.nam 15.8MB are created.

-

On Sunday, March 29, 2015 at 10:30:18 PM UTC+2, knudfl wrote:

shivani goel

unread,
Mar 30, 2015, 3:14:00 AM3/30/15
to ns-u...@googlegroups.com
If i dont add any PATH text to .bashrc , wont it create any problem during execution??

like "no such file or directory found " or something like that

shivani goel

unread,
Mar 30, 2015, 7:43:26 AM3/30/15
to ns-u...@googlegroups.com
Please tell me the steps to install ns2.35 when there is already another version of ns2 (ns2.34) installed in the system.

I'm confused..
Please help.

knudfl

unread,
Mar 30, 2015, 9:24:08 AM3/30/15
to ns-u...@googlegroups.com
Hi .

Handling multiple builds of ns-allinone-2.xx :
1) Delete any ns2 *PATH entries in ~/.bashrc
....  Or simply replace the .bashrc text with the original text : See attachment.

Adding a *PATH text to .bashrc :
Is a  ~16 year old text meant for a University Computer.
I.e. you had no write permissions to /usr/, and could not do # make install.

2) ns234 :  a)  $ cd ns-allinone-2.34/ns-2.34/ && sudo make install
........ ( 'make install'  will copy the executable 'ns' to /usr/local/bin/.)
b)  $ cp ns ns234-orig ( This is your backup, any name can be used )
c)  $ sudo cp ns234-orig  /usr/local/bin/

3) ns235 :  x)   $ cd ns-allinone-2.35/ns-2.35/
x1)  $ cp ns ns235-blackhole+idsaodv
x2)  $ sudo cp ns235-blackhole+idsaodv  /usr/local/bin/
....... ( See my above post about  idsAODV ).
.......... All simulations will work with  $ ns-<name>  file.tcl  !
x3)  $ cd ../nam-1.15/ && sudo make install


YYY) 
The executable 'ns' and the copies 'ns-any-name' are hard coded to know the location of it´s libraries :
ns-allinone-2.xx/{ lib*', bin/tcsh8* } ,  so adding a *PATH text to .bashrc makes little or no sense.
( Unless it's not your computer :  You can set a PATH like /home/name/bin/. Nothing else.)

-
bashrc-Ubuntu1404.txt

shivani goel

unread,
Mar 30, 2015, 2:43:20 PM3/30/15
to ns-u...@googlegroups.com
I successfully installed ns2.35  and then followed the steps given by you

blackholeaodv2013-ns235_1.patch was successfully done.

but after this step : patch -p0 < idsAODV-for-blackhole2013-patched_ns235.patch , I got this:

"patching file ns-2.35/common/packet.h
patching file ns-2.35/idsaodv/idsaodv-1.tcl
patching file ns-2.35/idsaodv/idsaodv.cc
patching file ns-2.35/idsaodv/idsaodv.h
patching file ns-2.35/idsaodv/idsaodv_logs.cc
patching file ns-2.35/idsaodv/idsaodv_rqueue.cc
patching file ns-2.35/idsaodv/idsaodv_rqueue.h
patching file ns-2.35/idsaodv/idsaodv_rtable.cc
patching file ns-2.35/idsaodv/idsaodv_rtable.h
patching file ns-2.35/idsaodv/idsaodv_semih.cc
patching file ns-2.35/idsaodv/idsaodv.tcl
patching file ns-2.35/idsaodv/TextFile
patch: **** malformed patch at line 4564: diff -Naur ns-2.35-blackhole/Makefile.in ns-2.35/Makefile.in"

What to do now??

knudfl

unread,
Mar 30, 2015, 5:29:01 PM3/30/15
to ns-u...@googlegroups.com
Sorry, an OK  idsAODV-2-for-blackhole2013-patched_ns235.patch is here
https://drive.google.com/file/d/0B7S255p3kFXNT0FjUTBTR21sMzg/view?usp=sharing

-

shivani goel

unread,
Mar 31, 2015, 4:09:48 AM3/31/15
to ns-u...@googlegroups.com
Thank you !!

idsAODV-2-for-blackhole2013-patched_ns235.patch was successfully made.

but when i tried to execute the idsaodv2.tcl file by this command :

ns235-blackhole+idsaodv idsaodv2.tcl  OR  ns idsaodv2.tcl , i got this:

num_nodes is set 20
Creating nodes...

    (_o15 cmd line 1)
    invoked from within
"_o15 cmd addr"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o15" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o15 addr"
    ("eval" body line 1)
    invoked from within
"eval $node addr $args"
    ("default" arm line 2)
    invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
"_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
"eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
"$ns_ node"
    ("for" body line 2)
    invoked from within
"for {set i 0} {$i < $val(nnaodv)} {incr i} {
      set node_($i) [$ns_ node]
      $node_($i) random-motion 0    ;#disable random motion
      }"
    (file "idsaodv2.tcl" line 54)


I got the same error when i tried to execute some other blackhole files and some files in 'xgraph_ns2-files-tcl_03.2015.tar.gz'

please help..

Devkinandan gauttam

unread,
Mar 31, 2015, 7:02:34 AM3/31/15
to ns-u...@googlegroups.com
Hello Kunudef, Thanx for your support . please you make a video example for how we add patch and how add balckhole node so it more easy to understand to every one. You start a you tube channel a person get easy help.

thanx





knudfl

unread,
Mar 31, 2015, 9:40:35 AM3/31/15
to ns-u...@googlegroups.com
Ubuntu 14.04 - 64bits :  No issues here.

I guess you will have to start from scratch with a new unpacked ns-allinone-2.35_gcc482.tar.gz :
And repeat that as many times as it takes to get it right :
/home/name/a/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv2
/home/name/b/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv3
/home/name/c/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv4
/home/name/d/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv5
.... etc. etc.

Ubuntu 14.04 - 64bits :
knudfl@88:~/8tmp/idsAODV$ ns235-blackh+idsaodv idsaodv2.tcl num_nodes is set 20
Creating nodes...                                          
INITIALIZE THE LIST xListHead                              
Loading random connection pattern...                        
cbr_
(0) has been created over udp_(0)
udp_
(0) and null_(0) agents has been connected each other
cbr_
(1) has been created over udp_(1)
udp_
(1) and null_(1) agents has been connected each other
cbr_
(2) has been created over udp_(2)
udp_
(2) and null_(2) agents has been connected each other
cbr_
(3) has been created over udp_(3)
udp_
(3) and null_(3) agents has been connected each other
cbr_
(4) has been created over udp_(4)
udp_
(4) and null_(4) agents has been connected each other
cbr_
(5) has been created over udp_(5)
udp_
(5) and null_(5) agents has been connected each other
cbr_
(6) has been created over udp_(6)
udp_
(6) and null_(6) agents has been connected each other
cbr_
(7) has been created over udp_(7)
udp_
(7) and null_(7) agents has been connected each other
cbr_
(8) has been created over udp_(8)
udp_
(8) and null_(8) agents has been connected each other
Starting Simulation...
channel
.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_
= 1.5,  distCST_ = 550.0
SORTING LISTS
...DONE!

Created are :   Ids.nam  15.8MB,  Ids.tr 22.3MB.

Testing other :
$ ns235-blackh+idsaodv atk3.tcl
$ ns235-blackh+idsaodv sim1forBlackHole_5.tcl
$ ns235-blackh+idsaodv test1-nadiui.tcl
....  No issues.

-

Michael Manyanga

unread,
Mar 31, 2015, 10:31:25 AM3/31/15
to ns-u...@googlegroups.com

i need help in implementing idsaodv for detecting and preventing blackhole attack




knudfl

unread,
Mar 31, 2015, 2:51:13 PM3/31/15
to ns-u...@googlegroups.com
@Michael Manyanga ,   Hi.

Well, then read the above posts.  Can hardly be more comprehensive.

Other packages which may of help to you all :
1)  "ns-allinone-2.35_gcc482" patched with :
blackholeaodv2013-ns235_1.patch and idsAODV-2-for-blackhole2013-patched_ns235.patch
→ →  ns-allinone-2.35-idsAODV.tar.gz   ( 20.5 MB ) →
https://drive.google.com/file/d/0B7S255p3kFXNRkYwYlRuUHhNd3M/view?usp=sharing

2)  blackhole+idsaodv-ns_2.35-ubuntu14_amd64.deb  ( 3.2 MB ) →
https://drive.google.com/file/d/0B7S255p3kFXNblNjZTJILThiMXM/view?usp=sharing
.... Download the package,  and the click the package,
and your 'Package Installer' will install it.
"blackhole+idsaodv-ns_2.35-ubuntu14" provides /usr/local/bin/ns235-blackh-idsaodv

Simulation : $ ns235-blackh-idsaodv idsaodv2.tcl → OK.

-

shivani goel

unread,
Mar 31, 2015, 4:31:15 PM3/31/15
to ns-u...@googlegroups.com
Thank you so much Kundfl

I have tried the whole thing again.. still getting the same error and still trying ..........

Thank you so much!!

You have helped me alot.. I really appreciate it.. Thank You!! 

knudfl

unread,
Mar 31, 2015, 5:42:20 PM3/31/15
to ns-u...@googlegroups.com
@shivani goel ,   Hi.

Did you read my above post about the two new packages ?

→  ns-allinone-2.35-idsAODV.tar.gz   ( 20.5 MB ) 
and blackhole+idsaodv-ns_2.35-ubuntu14_amd64.deb  ( 3.2 MB )


-

shivani goel

unread,
Apr 1, 2015, 8:54:30 AM4/1/15
to ns-u...@googlegroups.com

It worked.. :D

Thankyou so much!!

shalini sharma

unread,
Apr 1, 2015, 2:50:01 PM4/1/15
to ns-u...@googlegroups.com
@kundfl Hi

i followed all of your above posts and got the thing.
But i need to show the result of blackhole.tcl and idsaodv2.tcl through graphs in XGraph
Drop
Delay
Throughput

Can i obtain the graph through Ids.tr?
If yes , then how?

knudfl

unread,
Apr 1, 2015, 5:36:58 PM4/1/15
to ns-u...@googlegroups.com
@shalini sharma ,   Hi.

You will have to add some sections to your file.tcl to generate files(.tr) for Xgraph.
Basics :   http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html
→   "Creating Output Files for Xgraph"

And please test (and read) all examples from :   xgraph_ns2-files-tcl_04.2015.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNaTBuaE52b2xackE/view?usp=sharing
......   A blackholeaodv example is included too.
And please read the small output files.tr meant for Xgraph.
You can also read xgraph-12.*/examples/<files.xgr> , to know the formatting for Xgraph files.

-

shalini sharma

unread,
Apr 2, 2015, 7:37:59 AM4/2/15
to ns-u...@googlegroups.com
@kundlf Hi

Please tell me What does a1 a2 a3 represent in aodv-Xgr_blackhole.tcl graph..
i am not getting it.

knudfl

unread,
Apr 2, 2015, 8:10:26 AM4/2/15
to ns-u...@googlegroups.com
@shalini sharma.

a1 a2 a3 in aodv-X.tcl  ( aodv-Xgr_blackhole.tcl ) :
I guess you will have to run all the ~12 examples, and read the output files.
And :   Please read all the ~12 examples.tcl .
 
I.e. : I don't know ,  so you will have to figure it out yourself.

-

Michael Manyanga

unread,
Apr 7, 2015, 11:19:47 AM4/7/15
to ns-u...@googlegroups.com
@knudfl
 i want to ask is this an error after the  after running  blackholeaodv.tcl script, please reply at mmany...@gmail.com

num_nodes is set 20
Creating nodes...

knudfl

unread,
Apr 7, 2015, 12:31:20 PM4/7/15
to ns-u...@googlegroups.com
@Michael Manyanga ,   Hi.

blackholeaodv.tcl :  If you mean ns-2.3x/blackholeaodv/blackholeaodv.tcl :
Not a simulation file.    `blackholeaodv.tcl' is a configuration file.
"files.tcl" are text files.  Please read the file.
A simulation file starts and ends e.g. like this "Template0.tcl" :

# start with these lines :

set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace
-all $nf

proc finish
{} {
       
global ns nf
        $ns flush
-trace
        close $nf
       
exec nam out.nam &
       
exit 0
}

#######################
#
#    Write all other commands here.
#
#######################

# end with :

$ns at
5.0 "finish"
$ns run

-

Michael Manyanga

unread,
Apr 9, 2015, 8:19:34 AM4/9/15
to ns-u...@googlegroups.com
@ knudfl

i have managed to patch my ns2.35 with those patches above, it was successful, i dont know whats wrong with my blackholeaodv.tcl file and my idsaodv2.tcl
 
its giving me some errors, u may modifie that  my tcl files and send them back or  send me yr tcl file which works for those patches.

the other thing am familiar with tcl file generated by NSG2.1, U can also mody tht tcl file written  malicious.tcl to make it work for blackhole aodv and also for idsaodv

thanks you so much for yr help last tym


blackholeaodv2013-ns235_1.patch
idsAODV-2-for-blackhole2013-patched_ns235.patch
blackholeaodv.tcl
malicious.tcl
idsaodv2.tcl

knudfl

unread,
Apr 9, 2015, 11:40:42 AM4/9/15
to ns-u...@googlegroups.com
@Michael Manyanga.

»» i dont know whats wrong with my blackholeaodv.tcl «« :  Read the above posts.
"blackholeaodv.tcl" is not a file that can be used for anything ! !


"idsaodv2.tcl" :
Requires ns2 with both blackholeaodv2013 , and idsAODV compiled into the executable "ns235-blackhole+idsaodv".
Please read all the above posts.

-

Michael Manyanga

unread,
Apr 13, 2015, 10:42:43 AM4/13/15
to ns-u...@googlegroups.com

@ knudfl  i have tried to install "ns-allinone-2.35_gcc482" with ids and blackhole from yr link, its saying bash./install: permission denied can u help

second Question i managed to implement blackhole attack using the patch created by Mohit P Tahiliani, If u have an idea can u tell me whr to get the patch for ids to prevent this black hole attack, i wl aprreciate  if u can send the patch of ids

knudfl

unread,
Apr 13, 2015, 11:55:50 AM4/13/15
to ns-u...@googlegroups.com
@Michael Manyanga ,   Hi.

» Permission denied « :   Happens when ...
1)  You uncompress ns-allinone-2.xx with a Windows© tool.
2)  By using $  sudo tar xvf ns-allinone-2.xx .  ( Do not use sudo or root )
3)  The ns-allinone-2.xx/  was unpacked to a directory with no user permissions.

Right is :   In  /home/<name>/new-folder/    ( ! The Desktop/ cannot be used ! ) ...
... unpack with  $ tar xvf ns-allinone-2.35_gcc482.tar.gz

-

knudfl

unread,
Apr 13, 2015, 1:34:15 PM4/13/15
to ns-u...@googlegroups.com
@Michael Manyanga ,  Hi again.

The  { Mohit Tahiliani  blackholeaodv  patched ns-2.35/ } :
$  cd ns-allinone-2.35/
$  patch -p0 < idsAODV-for-M-blackholeaodv_ns235.patch
https://drive.google.com/file/d/0B7S255p3kFXNOTQ3V2IwQlRjbFU/view?usp=sharing
$  ./install
$  cd ns-2.35/
$  cp ns ns-idsAODV+M
$  sudo cp ns-idsAODV+M  /usr/local/bin/


-

On Monday, April 13, 2015 at 4:42:43 PM UTC+2, Michael Manyanga wrote:

Michael Manyanga

unread,
Apr 17, 2015, 7:35:26 AM4/17/15
to ns-u...@googlegroups.com
ali

@knudfl
i have implement blackhole attack by the patch created by mohit P Tahilian, its working fine. the u send me the idsaodv patch to prevent the blackhole attack, which is there above, my problem is how to modify the tcl script for idsaodv, send me the tcl idsaodv  which runs for that patch that u provided

thanks  for response
Blackhole.patch
blackhole.tcl

knudfl

unread,
Apr 17, 2015, 8:49:07 AM4/17/15
to ns-u...@googlegroups.com

sandeep kumar

unread,
Apr 20, 2015, 4:24:40 AM4/20/15
to ns-u...@googlegroups.com
hello mam , i have tried these packages but got stuck. please help me to get rid of there error 

attaching snapshot of the errors
Screenshot from 2015-04-20 01^%21^%26.png

knudfl

unread,
Apr 20, 2015, 7:01:51 AM4/20/15
to ns-u...@googlegroups.com
@sandeep kumar ,   Hi.

Looks like a wrecked  ns-allinone-2.35 .
*   Maybe get a new download of  ns-allinone-2.35_gcc482.tar.gz ?
Please start from scratch in a new directory in /home/<name>/ , like /home/linux/ns2/. 
 !  The Desktop/  cannot be used :  No ns2  in  /home/linux/Desktop/  !

And be sure that you unpack ns2 with : $ tar xvf ns-allinone-2.35_gcc482.tar.gz
**   Another tool / a Windows© tool may corrupt the files.

-

sandeep kumar

unread,
Apr 20, 2015, 7:21:17 AM4/20/15
to ns-u...@googlegroups.com
thanku very much got it. 
 Done.

can you help me running idsaodv based examples or idsaodv for black hole attack.

and 
blackhole+idsaodv-ns_2.35-ubuntu14_amd64.deb  ( 3.2 MB )  

is not running as i think it is for amd processor so how should i use idsaodv file ??

--
You received this message because you are subscribed to a topic in the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-users/oznEEorxqJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-users+u...@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.

knudfl

unread,
Apr 20, 2015, 8:56:50 AM4/20/15
to ns-u...@googlegroups.com
@sandeep kumar.

"idsAODV" :  Intrusion Detection system AODV.
Using :  Read all the above posts in this thread.

The idsAODV / blackhole example, idsaodv2.tcl, is run with e.g. $ ns-blackhole+idsaodv
.. if you have built ns-2.35 with blackholeAODV and  idsAODV,
.. and if your executable is  /usr/local/bin/ns-blackhole+idsaodv

The package  blackhole+idsaodv-ns_2.35-ubuntu14_amd64.deb (3.2MB) is a usual binary package(.deb).
Can be installed into your OS, if it is the 64bits Ubuntu 14.04 (or 14.10 .. (15.04)).    ( Click the
package).
.. Provides  /usr/local/bin/ns235-blackh-idsaodv
( and  /usr/local/lib/idsAODV/ns-allinone-2.35/{ bin/tcsh8*,  lib/** }.
.. The main reason for this package is : 
You can run a
blackholeaodv+idsaodv simulation without building an ns-allinone-2.35 with blackholeaodv+idsaodv.

P.S. :  About "hello mam" :  There are no mam´s, mom´s, granny´s here. The are some Mr., Mrs., Miss.
And :  If any doubts, you can't fail with "Hello sir"   :)

-

Michael Manyanga

unread,
Apr 20, 2015, 10:00:50 AM4/20/15
to ns-u...@googlegroups.com
@knudfl

where should i put ns_ at 0.0 "[$n5 set ragent_] hacker"  in idsaodv2.tcl, am facing challenges, you can send me the modified code for idsaodv that suits idsAODV-for-M-blackholeaodv_ns235.patch

second @ can u check this blackhole.tcl to see where have i gone wrong. i have  change  the aodv protocol to idsAODV line 25 and line 131 to ns_ at 0.0 "[$n6 set ragent_] hacker". i want node 6 to act as idsaodv , its not working, bt its not working

blackhole.tcl
idsaodv2.tcl

knudfl

unread,
Apr 20, 2015, 11:46:19 AM4/20/15
to ns-u...@googlegroups.com
@Michael Manyanga.

What do you mean with :

""send me the modified code for idsaodv that suits idsAODV-for-M-blackholeaodv_ns235.patch""

I.e. ``idsAODV-for-M-blackholeaodv_ns235.patch´´ is the "modified" idsAODV code.
A patch is a text file :  Please read the file.

-

Michael Manyanga

unread,
Apr 21, 2015, 3:51:34 AM4/21/15
to ns-u...@googlegroups.com
@knudfl

i was trying to say, to modify the idsaodv2.tcl script to suit the idsAODV-for-M-blackholeaodv_
ns235.patch, because am getting an error whn i run the idsaodv2.tcl

Michael Manyanga

unread,
Apr 21, 2015, 3:58:48 AM4/21/15
to ns-u...@googlegroups.com
@knudfl

i have seen the post that u have send from the link let me try to implement it

vivek tank

unread,
Apr 23, 2015, 2:15:11 AM4/23/15
to ns-u...@googlegroups.com
i want awk file for "packet loss" in AODV... plz help me

On Sunday, March 29, 2015 at 9:35:59 PM UTC+5:30, shivani goel wrote:
hello 
I am a final year B.Tech student.
I am working on a project "Dectection of Malicious Nodes" 

While executing the blackholeaodv.tcl file i got the following error:

"invalid command name "Agent/rtProto/blackholeAODV"
    while executing
"Agent/rtProto/blackholeAODV instproc init args {
        $self next $args
}       "
    (file "blackholeaodv.tcl" line 19)

"

I am working on Ubuntu 14.04- 64bit and NS2 version is ns2.34

I am attaching the blackholeaodv tcl file and patch that i have used.

i got the same error in NS2.35 also. That's why i moved to version 2.34 thinking that the error might be because of the newer version.

i also found an 'idsaodv' package from one of your posts... Please guide me what exactly i should do... and which version of ns2 I should use.

or if you have some other tcl files of blackholeaodv and idsaodv that are without rtproto...please provide them..

Please help....

Michael Manyanga

unread,
Apr 24, 2015, 8:03:15 AM4/24/15
to ns-u...@googlegroups.com
@knudfl
i installed ns-allinone-2.35_gcc482" with ids and blackhole from yr link, no packets are being dropped by the blackhole nodes, or no packets dropped in the perlscript

Michael Manyanga

unread,
Apr 25, 2015, 7:23:10 AM4/25/15
to ns-u...@googlegroups.com
any with a solution for blackhole  attack which is not an idsaodv, which is easy to implement,preferable by modifying ns2

Akourmis Akourmis

unread,
Jul 30, 2015, 9:48:10 AM7/30/15
to Network Simulator 2 (NS2), knu...@ofir.dk

Hello Knudfl;

First of all thanks u very much for your Blog ,its really kind from you Sir.

i just want to ask u plz because when i run idsaodv2.tcl i got the same error like Shivani goel:

ns idsaodv2.tcl
num_nodes is set 40
num_nodes is set 40

    (_o14 cmd line 1)
    invoked from within
"_o14 cmd addr"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o14 addr"
    ("eval" body line 1)
    invoked from within
"eval $node addr $args"
    ("default" arm line 2)
    invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
"_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
"eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
"$ns node"
    ("for" body line 2)
    invoked from within
"for {set i 0} {$i < $val(nn) } { incr i } {
    set node_($i) [$ns node]
    $node_($i) set X_ [expr { rand()*800} ]
    $node_($i) set Y_ [expr { ran..."
    (file "idsaodv2.tcl" line 70)


Le mardi 31 mars 2015 14:40:35 UTC+1, knudfl a écrit :
Ubuntu 14.04 - 64bits :  No issues here.

I guess you will have to start from scratch with a new unpacked ns-allinone-2.35_gcc482.tar.gz :
And repeat that as many times as it takes to get it right :
/home/name/a/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv2
/home/name/b/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv3
/home/name/c/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv4
/home/name/d/ns-allinone-2.35/  >>>  ns235-blackh+idsaodv5
.... etc. etc.

Ubuntu 14.04 - 64bits :
knudfl@88:~/8tmp/idsAODV$ ns235-blackh+idsaodv idsaodv2.tcl num_nodes is set 20

Created are :   Ids.nam  15.8MB,  Ids.tr 22.3MB.

Testing other :
$ ns235-blackh+idsaodv atk3.tcl
$ ns235-blackh+idsaodv sim1forBlackHole_5.tcl
$ ns235-blackh+idsaodv test1-nadiui.tcl
....  No issues.

-

On Tuesday, March 31, 2015 at 1:02:34 PM UTC+2, Devkinandan gauttam wrote:
Hello Kunudef, Thanx for your support . please you make a video example for how we add patch and how add balckhole node so it more easy to understand to every one. You start a you tube channel a person get easy help.

thanx





knudfl

unread,
Jul 30, 2015, 4:38:17 PM7/30/15
to Network Simulator 2 (NS2), sako...@gmail.com
@Akourmis Akourmis,  Hi.

Your errors :   The usual ...  you are using an executable 'ns' with no "idsAODV".
( Starts with "Got it right now." ).
I.e. you will get similar errors with any "none - modified 'ns' ".

HOWTO idsAODV :  Please read my above first post from the day 'Mar 30  2015'
...  The right simulation command is like $ ns235-blackhole+idsaodv  idsaodv2.tcl

-

Bilal Erman Bilgin

unread,
Aug 2, 2015, 12:53:54 PM8/2/15
to Network Simulator 2 (NS2)
@knudfl
to create a blackhole node is this script enough? Or is there another way?

$ns_ node-config -adhocRouting blackholeAODV
for {set i $val(nnaodv)} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;#disable random motion
$ns_ at 0.01 "$node_($i) label \"blackhole node\""
}

$ns_ node-config -adhocRouting blackholeAODV  means created nodes after this will have blackholeAODV routing protocol?
Am i correct?

knudfl

unread,
Aug 2, 2015, 4:30:29 PM8/2/15
to Network Simulator 2 (NS2)
@Bilal Erman Bilgin.

»» to create a blackhole node is this script «« :   Which script ? ? ?

The usual entries will look like ......

################# Added for blackholeAODV
set val(nn)      15
set val(nnaodv)  5
set val(brp)     blackholeAODV
#####################################
.
.
##########################################

for {set i $val(nnaodv) } {$i<$val(nn) } {incr i} {

     
set node_($i) [$ns node]
     $node_
($i) random-motion 0;
     $ns at
0.01 "$node_($i) label \"blackhole node\""
}
###########################################
.... Which you of course will know, when you have read the examples ...
blackholeaodv2005-examples-2.tar.gz  ( 2005 refers to the original code only )
https://drive.google.com/file/d/0B7S255p3kFXNdnJIbV9UT1R4Qm8/view?usp=sharing

-

Bilal Erman Bilgin

unread,
Aug 3, 2015, 2:44:34 AM8/3/15
to Network Simulator 2 (NS2)
@knudfl thank you so much. Is that mean I will have 5 normal node and 10 blackhole node? (According to script that you give me?)

And I want to ask another question.
For example I have 4 nodes and 1 of them is a blackole node. Node 1 transmits data to node 3 and node 2 is normal node. Even if I use blackholeAodv, are all packets transmitted successfully to node 3 from node 1. Assume that node 4(blackhole) is not in communication range.

Akourmis Akourmis

unread,
Aug 7, 2015, 8:03:31 PM8/7/15
to Network Simulator 2 (NS2), sako...@gmail.com
Really Thanks u very much knudfl.

moh awad

unread,
Aug 29, 2015, 7:51:40 AM8/29/15
to Network Simulator 2 (NS2)

i run the blackholeaodv put i wont to edit the tcl to prevent the blackhole which command shod i write 
or rdit my tcl 
pleeeees help!!!
vanet-blackhole-aodv.tcl

knudfl

unread,
Aug 29, 2015, 11:12:46 AM8/29/15
to Network Simulator 2 (NS2)
@moh awad.

»»prevent the blackhole«« ,  in  'vanet-blackhole-aodv.tcl' :
The routing protocol says AODV :   set val(rp)   AODV ;
Please try with  idsAODV, like in idsaodv2.tcl : 
set val(rp)   idsAODV

-

moh awad

unread,
Aug 29, 2015, 12:42:47 PM8/29/15
to Network Simulator 2 (NS2)
i change the name of the protocol but nothing done 
"reely i wont the same my "vanet-blackholeaodv.tcl
IDSAODV put  whith other raoting protocol
means just replace the blackhole node whith other  "idsaodv" 
and the paket go throw it to distnation node

Jothimani A

unread,
Sep 8, 2015, 1:42:21 AM9/8/15
to Network Simulator 2 (NS2)

i am trying to include malicious node
when change the aodv.cc and aodv.h files then run the tcl script it shows error

ns: _o44hacker: invalid command name "_o44hacker"

knudfl

unread,
Sep 8, 2015, 2:47:22 AM9/8/15
to Network Simulator 2 (NS2)
@Jothimani A ,   Hi.

Please read my above first post from  '30 Mar 2015' :
tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing
cd ns
-allinone-2.35/
patch
-p0 < blackholeaodv2013-ns235_2.patch
https
://drive.google.com/file/d/0B7S255p3kFXNMk1uX2N5VmtXeTA/view?usp=sharing
./install

**** Lots of possibilities to run into trouble by "manual editing" :
Typo´s can occur.
And the simulation script(s) can be for another blackhole version, or simply unusable.
The changes : You can read the patch to know the aodv.cc changes.

Usable simulation examples when the patch is blackholeaodv2013-ns235_1.patch :
blackholeaodv2005-examples-2.tar.gz → →
https://drive.google.com/file/d/0B7S255p3kFXNdnJIbV9UT1R4Qm8/view?usp=sharing

-

knudfl

unread,
Sep 8, 2015, 3:44:59 AM9/8/15
to Network Simulator 2 (NS2)
Correction :

The ns-2.35 patch for blackholeaodv2013 is blackholeaodv2013-ns235_1.patch
And the link is ...
https://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing

-

Akourmis Akourmis

unread,
Sep 8, 2015, 7:10:18 PM9/8/15
to ns-u...@googlegroups.com
Hi Knudfl ,
i just have this question plz   when i use IDS with blackhole node ,when the numbers of nodes increase the throughput increase its normal?

--

Akourmis Akourmis

unread,
Sep 8, 2015, 7:16:58 PM9/8/15
to ns-u...@googlegroups.com
Hi Knudfl ,
i just have this question plz ;  when i use IDS with blackhole node ,when the numbers of nodes increase the throughput decrease its normal?

--

MayiHelpU sureiwillhelpu

unread,
Dec 3, 2015, 3:46:10 AM12/3/15
to Network Simulator 2 (NS2)
Hello Shivani,
Have u resolved your problem.if no please send a request on skype : amit.sinha123123 i will try to resolve your issue.....


On Sunday, March 29, 2015 at 9:35:59 PM UTC+5:30, shivani goel wrote:

MayiHelpU sureiwillhelpu

unread,
Dec 3, 2015, 3:48:16 AM12/3/15
to Network Simulator 2 (NS2)
Hello Michael Manyanga, Have u resolved your issue. if no please send skype request on amit.sinha123123

ssbb...@gmail.com

unread,
Apr 12, 2016, 3:16:26 AM4/12/16
to Network Simulator 2 (NS2)
Hello 
 
we are working on 32-bit Ubuntu and this package is for 64-bit Ubuntu. 
blackhole+idsaodv-ns_2.35-ubuntu14_amd64.deb  ( 3.2 MB ) 
So please if u could post the appropriate link for 32-bit system.


Thank you 

Neda Esd

unread,
Jul 4, 2016, 9:58:54 AM7/4/16
to Network Simulator 2 (NS2)
hello. plzzzz help me

i have problem in "make install"

for d in /usr/local/man/man1; do \
if [ ! -d $d ]; then \
mkdir -p $d ;\
fi;\
done
mkdir: cannot create directory `/usr/local/man/man1': Permission denied
make: *** [dirs] Error 1


how can solve it?

MayiHelpU sureiwillhelpu

unread,
Jul 4, 2016, 10:42:24 AM7/4/16
to Network Simulator 2 (NS2)
Hi,
i think you will have to switch on root mode.
if  do you have a problem you can sent request on my skype id:  amit.sinha123123
i  will try to resolve.

Thanks
Amit S.

Michael Manyanga

unread,
Feb 23, 2017, 9:17:43 AM2/23/17
to Network Simulator 2 (NS2)



Hi,
I am having a problem in the running of the command sudo cp ns235-blackhole+idsaodv
 









Thanks
 Michael
.


hello. plzzzz help me
Auto Generated Inline Image 1

MayiHelpU sureiwillhelpu

unread,
Mar 5, 2017, 9:53:02 AM3/5/17
to ns-u...@googlegroups.com
Hello Mr. Michael,

please send skype request on amit.sinha123123

Thanks
Amit Sinha
+91-9958-602-502

--
You received this message because you are subscribed to a topic in the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-users/oznEEorxqJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-users+unsubscribe@googlegroups.com.

To post to this group, send email to ns-u...@googlegroups.com.

huggins manjiche

unread,
Mar 20, 2017, 1:26:55 PM3/20/17
to Network Simulator 2 (NS2)
Dear Amit sinha can i have your email address

Sami Kzr

unread,
Mar 23, 2017, 11:09:12 AM3/23/17
to Network Simulator 2 (NS2)
Hello sir

please help me with this, when i run the idsaodv.tcl it won't show the simulation on nam only prints this (screenshot) on terminal
(i'm running ns2.35 on ubuntu 14.04 64bits)
Screenshot from 2017-03-23 16:06:12.png

knudfl

unread,
Mar 23, 2017, 12:19:50 PM3/23/17
to Network Simulator 2 (NS2)
@Sami Kzr :   Hi.

My copy of idsaodv.tcl is an updated version = idsaodv2.tcl , and shows this in line 120 :
#     exec nam sim1forBlackHole.nam &
.... Which means nam will not run the file. For good reasons, probably. I don't remember ( May 2015 ).
But you can run it manually : $ nam file.nam
.... to watch if things work.

All examples :  ex_idsAODV.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNamRyb2ZPMWFxaU0/view?usp=sharing

- ----------------

Sami Kzr

unread,
Mar 24, 2017, 12:06:25 PM3/24/17
to Network Simulator 2 (NS2)
Thank you sir.


Bilal Erman Bilgin

unread,
Mar 26, 2017, 5:17:31 AM3/26/17
to Network Simulator 2 (NS2)
Hello @knudfl,
I have downloaded files.
In ns-2.35/idsaodv folder, there are idsaodv.cc and idsaodv_semih.cc files.
Your patch compiles idsaodv.cc. What is the differences between idsaodv.cc and idsaodv_semih.cc?



30 Mart 2015 Pazartesi 02:37:21 UTC+3 tarihinde knudfl yazdı:
Hi.

Got it right now.
If you still have the ns-2.35 patched with blackholeaodv2013-ns235_1.patch :
You can add idsAODV with  "idsAODV-for-blackhole2013-patched_ns235.patch"
https://drive.google.com/file/d/0B7S255p3kFXNS2NrcVRETVVPYzg/view?usp=sharing
( Note : You can have as many ns-allinone-2.xx as you want, installed at the same time.
* But :  Do never add any *PATH text to .bashrc ).

Else :

tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing
cd ns-allinone-2.35/
patch -p0 < blackholeaodv2013-ns235_1.patch
https://drive.google.com/file/d/0B7S255p3kFXNWWVDZzd2ZC14akE/view?usp=sharing
patch -p0 < idsAODV-for-blackhole2013-patched_ns235.patch
./install
cd ns-2.35/
cp ns ns235-blackhole+idsaodv
sudo cp ns235-blackhole+idsaodv  /usr/local/bin/

Simulation :  $ ns235-blackhole+idsaodv idsaodv2.tcl
... The files  Ids.tr 22.3MB and Ids.nam 15.8MB are created.

-

On Sunday, March 29, 2015 at 10:30:18 PM UTC+2, knudfl wrote:
Hi .

You cannot execute a file.tcl, but you can run it with an interpreter.
The ns2 interpreter is 'ns' :   $ ns blackhole-simulation.tcl
( Or  :   $ ns-blackhole  blackhole-simulation.tcl )

Tcl files are text files.
Please read "blackholeaodv.tcl" to know that it isn't  a simulation file.
"blackholeaodv.tcl" is a configuration file. But no known examples are using it.
-

About "idsAODV" :  I did a build last year, but some code may be missing :
$ ns-idsAODV idsaodv2.tcl

num_nodes is set 20
Creating nodes...
Wrong node routing agent!
-

About `blackholeaodv' examples :  Easy to add "blackhole" to a random simulation file :
Please see the example `aodv-Xgr_blackhole.tcl' in xgraph_ns2-files-tcl_03.2015.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNeC1SZDdERmRPSm8/view?usp=sharing

######### Added for blackholeAODV
set val(nn)      15
set val(nnaodv)  5
set val(brp)     blackholeAODV
##########
.
.
###################################### Added for blackholeAODV

# $ns_  node-config  -adhocRouting $val(brp)
for {set i $val(nnaodv) } {$i<$val(nn) } {incr i} {
     
set node_($i) [$ns node]
     $node_
($i) random-motion 0;
     $ns at
0.01 "$node_($i) label \"blackhole node\""
}
##################################################

-

knudfl

unread,
Mar 26, 2017, 6:54:40 AM3/26/17
to Network Simulator 2 (NS2)
 @Bilal Erman Bilgin ,   Hi.

This is the Makefile.in :
Showing that {idsaodv.cc, idsaodv_logs.cc, idsaodv_rqueue.cc, idsaodv_rtable.cc} are compiled.
    idsaodv/idsaodv.o idsaodv/idsaodv_logs.o \
    idsaodv
/idsaodv_rqueue.o idsaodv/idsaodv_rtable.o \

About idsaodv_semih.cc :
Don't know. The Makefile.in was created from the original author´s paper, I think + my work.
( I don't remember (2014-2015)).
http://imraan-prrec.blogspot.dk/2013/06/adding-new-routing-protocol-in-network.html
"idsaodv_semih.cc" could be one of the author´s experiments. Or simply not work.
And : ns2 student papers with new protocols often contains surplus files. ( Or files or text missing.)

---------------------------------------------

shyamala jinju

unread,
Mar 26, 2017, 8:46:08 AM3/26/17
to Network Simulator 2 (NS2)

hi sir,I am a b.tech student doing my project in secure and trustable routing in wireless sensor networks.Please help me to modify DSDV protocol to add trust table or an algorithm for trust based routing and its implementation in ns2.please help me .thank you

knudfl

unread,
Mar 26, 2017, 10:53:59 AM3/26/17
to Network Simulator 2 (NS2)
Hi.

This thread is about blackholeAODV and idsAODV only.
For DSDV questions, please start a new thread.

---------------------------------------------------------------------
Message has been deleted

Sami Kzr

unread,
Apr 11, 2017, 12:32:44 PM4/11/17
to Network Simulator 2 (NS2)
Hello sir

I'm trying to calculate throughput and average of paquets dropped and delivered, i was hoping you could help me please.
I tried this https://www.youtube.com/watch?v=7fQWQT7sApc&t=241s but it generates empty result
sim.tcl
throughput.pl

knudfl

unread,
Apr 11, 2017, 5:01:14 PM4/11/17
to Network Simulator 2 (NS2)
@Sami Kzr ,   Hi.

sim.tcl : Generic name. Renamed to Sami.Kzr-sim-blackh-idsAODV.tcl
throughput.pl : This version of throughput.pl is known as throughput-9.pl .
... See  "awk#perl#python__scripts-1-2017.tar.gz" → ~170 ns2 awk and perl scripts
https://drive.google.com/file/d/0B7S255p3kFXNZG5BVGpKT3RvQlU/view?usp=sharing

Using your file ( throughput-9.pl ) :
$ perl throughput-9.pl ../bhatk.tr 0 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 1 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 2 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 3 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 4 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 5 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 6 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 7 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 8 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 9 2
-t 0
$ perl throughput
-9.pl ../bhatk.tr 10 2
-t 0

Using the file I know as `throughput.pl´
$ perl throughput.pl ../bhatk.tr 0 2
Average Throughput was: -7630000000
$ perl throughput
.pl ../bhatk.tr 1 2
Average Throughput was: -7630000000
$ perl throughput
.pl ../bhatk.tr 3 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 4 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 5 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 6 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 7 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 8 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 9 2
Average Throughput was: 0
$ perl throughput
.pl ../bhatk.tr 10 2
Average Throughput was: -7630000000

... Suggest : Try out all files { Thr*awk, th*awk, *th*awk, *thr*awk, thr*pl }.
Example count : There 28 awk files with thr in the name, e.g. `instant__throughput_2016.awk´.

-------------------------------------

knudfl

unread,
Apr 12, 2017, 8:07:18 AM4/12/17
to Network Simulator 2 (NS2)
@Sami Kzr ,

awk#perl#python__scripts-1-2017.tar.gz : Found an awk file with a result :
$ awk -f Avg_Tput.awk ../bhatk.tr

       startTime
:  0
        stopTime
:  19
    receivedPkts
:  763
   avgTput
[kbps]:  163.475

And :
$ awk -f Instnt_Tput.awk ../bhatk.tr
... Please see the result below : The attached SamiKzr__throughput2.txt

I guess it's about the usual problem with finding a script that fits a trace file.
Very often only one or two of the endless number of Tput/throu files will work with a specific file.tr .
SamiKzr__throughput2.txt

huggins manjiche

unread,
Apr 24, 2017, 10:17:48 AM4/24/17
to Network Simulator 2 (NS2)
Hello sir,can you please assist me in how to label the blackhole node....actually in the tcl file script i cant find it.You can see the nam below and the tcl code


#======================================================================
# Define options
#======================================================================
 set val(chan)         Channel/WirelessChannel  ;# channel type
 set val(prop)         Propagation/TwoRayGround ;# radio-propagation model
 set val(ant)          Antenna/OmniAntenna      ;# Antenna type
 set val(ll)           LL                       ;# Link layer type
 set val(ifq)          Queue/DropTail/PriQueue  ;# Interface queue type
 set val(ifqlen)       50                       ;# max packet in ifq
 set val(netif)        Phy/WirelessPhy          ;# network interface type
 set val(mac)          Mac/802_11               ;# MAC type
 set val(nn)           6                    ;# number of mobilenodes
 set val(rp)           AODV                     ;# routing protocol
set val(brp)           blackholeAODV              ;
 set val(x)            1322
 set val(y)            800
######### Added for blackholeAODV
set val(nnaodv)  1   ;

##########


set ns [new Simulator]
#ns-random 0

set f [open mlicious.tr w]
$ns trace-all $f
set namtrace [open mlicious.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)

set chan_1 [new $val(chan)]
set chan_2 [new $val(chan)]
set chan_3 [new $val(chan)]
set chan_4 [new $val(chan)]
set chan_5 [new $val(chan)]
set chan_6 [new $val(chan)]
# CONFIGURE AND CREATE NODES

$ns node-config  -adhocRouting $val(rp) \
          -llType $val(ll) \
                 -macType $val(mac) \
                 -ifqType $val(ifq) \
                 -ifqLen $val(ifqlen) \
                 -antType $val(ant) \
                 -propType $val(prop) \
                 -phyType $val(netif) \
                 #-channelType $val(chan) \
                 -topoInstance $topo \
                 -agentTrace ON \
                 -routerTrace ON \
                 -macTrace ON \
                 -movementTrace OFF \
                 -channel $chan_1

proc finish {} {
    global ns namtrace
    $ns flush-trace
        close $namtrace
        exec nam -r 5m mlicious.nam &
    exit 0
}

# define color index
$ns color 0 blue
$ns color 1 red
$ns color 2 chocolate
$ns color 3 red
$ns color 4 brown
$ns color 5 tan
$ns color 6 gold

   
set n(0) [$ns node]
$ns at 0.0 "$n(0) color blue"
$ns at 0.0 "$n(0) label Source"
$n(0) color "0"
$n(0) shape "circle"
set n(1) [$ns node]
$n(1) color "black"
$n(1) shape "circle"
set n(2) [$ns node]
$n(2) color "tan"
$n(2) shape "circle"
set n(3) [$ns node]
$n(3) color "red"
$n(3) shape "circle"
set n(4) [$ns node]
$n(4) color "tan"
$n(4) shape "circle"
set n(5) [$ns node]
$ns at 0.0 "$n(5) color blue"
$ns at 0.0 "$n(5) label Destination"
$n(5) color "red"
$n(5) shape "box"



for {set i 0} {$i < $val(nn)} {incr i} {
    $ns initial_node_pos $n($i) 30+i*100
}
#####blackhole node ################################
#$ns at 0.0 "[$n(3) set ragent_] malicious" 

#########################################
$ns node-config -adhocRouting $val(brp)
set n(1) [$ns node]
#blackhole node creation
#######################################

       
$ns at 0.0 "$n(0) setdest 100.0 100.0 3000.0"
$ns at 0.0 "$n(1) setdest 100.0 200.0 3000.0"
$ns at 0.0 "$n(2) setdest 100.0 200.0 3000.0"
$ns at 0.0 "$n(3) setdest 100.0 300.0 3000.0"
$ns at 0.0 "$n(4) setdest 100.0 300.0 3000.0"
$ns at 0.0 "$n(5) setdest 100.0 400.0 3000.0"

#        Generate movement         
#===================================
$ns at 0.1 " $n(0) setdest 500 100 20 "
$ns at 0.1 " $n(1) setdest 1000 350 20 "
$ns at 0.1 " $n(2) setdest 1000 400 80 "
$ns at 0.1 " $n(3) setdest 1050 100 30 "
$ns at 0.1 " $n(4) setdest 1000 350 60 "

# CONFIGURE AND SET UP A FLOW

set sink0 [new Agent/LossMonitor]
set sink1 [new Agent/LossMonitor]
set sink2 [new Agent/LossMonitor]
set sink3 [new Agent/LossMonitor]
set sink4 [new Agent/LossMonitor]
set sink5 [new Agent/LossMonitor]

$ns attach-agent $n(0) $sink0
$ns attach-agent $n(1) $sink1
$ns attach-agent $n(2) $sink2
$ns attach-agent $n(3) $sink3
$ns attach-agent $n(4) $sink4
$ns attach-agent $n(5) $sink5


#$ns attach-agent $sink2 $sink3
set tcp0 [new Agent/TCP]
$ns attach-agent $n(0) $tcp0
set tcp1 [new Agent/TCP]
$ns attach-agent $n(1) $tcp1
set tcp2 [new Agent/TCP]
$ns attach-agent $n(2) $tcp2
set tcp3 [new Agent/TCP]
$ns attach-agent $n(3) $tcp3
set tcp4 [new Agent/TCP]
$ns attach-agent $n(4) $tcp4
set tcp5 [new Agent/TCP]
$ns attach-agent $n(5) $tcp5



proc attach-CBR-traffic { node sink size interval } {
   #Get an instance of the simulator
   set ns [Simulator instance]
   #Create a CBR  agent and attach it to the node
   set cbr [new Agent/CBR]
   $ns attach-agent $node $cbr
   $cbr set packetSize_ $size
   $cbr set interval_ $interval

   #Attach CBR source to sink;
   $ns connect $cbr $sink
   return $cbr
  }

set cbr0 [attach-CBR-traffic $n(0) $sink5 1000 .030]
$ns at 0.5 "$cbr0 start"
$ns at 5.5 "finish"
puts "Start of simulation.."
$ns run
Auto Generated Inline Image 1

knudfl

unread,
Apr 24, 2017, 11:31:24 AM4/24/17
to Network Simulator 2 (NS2)
@huggins manjiche ,   Hi.

Please have a look at some other blackhole simulations, to see how it's done.
* atk.tcl and blackhole20-1.tcl : Images are included. With nodes labeled "blackhole".
→ → blackholeaodv2005-examples-3-Aug2015.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNUmJGd0ZyNUhvVFU/view?usp=sharing

------------------------------------

huggins manjiche

unread,
Apr 26, 2017, 10:39:36 AM4/26/17
to Network Simulator 2 (NS2)
Thank you very much.Now am seeking help in how to plot graphs using xgraph or gnuplot.i have installed gnuplot and this is my trace file
 0.00000 0 (0.00, 0.00, 0.00), (100.00, 100.00), 3000.00
M 0.00000 7 (0.00, 0.00, 0.00), (100.00, 200.00), 3000.00
M 0.00000 2 (0.00, 0.00, 0.00), (100.00, 200.00), 3000.00
M 0.00000 3 (0.00, 0.00, 0.00), (100.00, 300.00), 3000.00
M 0.00000 4 (0.00, 0.00, 0.00), (100.00, 300.00), 3000.00
M 0.00000 5 (0.00, 0.00, 0.00), (100.00, 400.00), 3000.00
M 0.10000 0 (100.00, 100.00, 0.00), (500.00, 100.00), 20.00
M 0.10000 7 (100.00, 200.00, 0.00), (1000.00, 350.00), 20.00
M 0.10000 2 (100.00, 200.00, 0.00), (1000.00, 400.00), 80.00
M 0.10000 3 (94.87, 284.60, 0.00), (1050.00, 100.00), 30.00
M 0.10000 4 (94.87, 284.60, 0.00), (1000.00, 350.00), 60.00
s 0.500000000 _0_ AGT  --- 0 cbr 1000 [0 0 0 0] ------- [0:2 5:0 32 0] [0] 0 0
r 0.500000000 _0_ RTR  --- 0 cbr 1000 [0 0 0 0] ------- [0:2 5:0 32 0] [0] 0 0
s 0.500000000 _0_ RTR  --- 0 AODV 48 [0 0 0 0] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
s 0.500235000 _0_ MAC  --- 0 AODV 106 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083338 _7_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083365 _2_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083491 _6_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083491 _1_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083608 _3_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501083622 _4_ MAC  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501108338 _7_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
s 0.501108338 _7_ RTR  --- 0 AODV 44 [0 0 0 0] ------- [7:255 0:255 30 0] [0x4 1 [5 -1] 10.000000] (REPLY)
r 0.501108365 _2_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501108491 _6_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501108491 _1_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501108608 _3_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
r 0.501108622 _4_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [0:255 -1:255 30 0] [0x2 1 1 [5 0] [0 4]] (REQUEST)
s 0.501703338 _7_ MAC  --- 0 ARP 86 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502391418 _2_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502391608 _3_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502391623 _4_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502391675 _0_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502392001 _5_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502392099 _6_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
r 0.502392099 _1_ MAC  --- 0 ARP 28 [0 ffffffff 7 806] ------- [REQUEST 7/7 0/0]
s 0.502750076 _4_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [4:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
s 0.502806675 _0_ MAC  --- 0 RTS 44 [52e 7 0 0]
r 0.503159013 _7_ MAC  --- 0 RTS 44 [52e 7 0 0]
s 0.503169013 _7_ MAC  --- 0 CTS 38 [3f4 0 0 0]
s 0.503454382 _2_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.503473351 _0_ MAC  --- 0 CTS 38 [3f4 0 0 0]
s 0.503483351 _0_ MAC  --- 0 ARP 86 [13a 7 0 806] ------- [REPLY 0/0 7/7]
r 0.504171689 _7_ MAC  --- 0 ARP 28 [13a 7 0 806] ------- [REPLY 0/0 7/7]
s 0.504181689 _7_ MAC  --- 0 ACK 38 [0 0 0 0]
s 0.504199281 _1_ RTR  --- 0 AODV 48 [0 ffffffff 0 800] ------- [1:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.504486026 _0_ MAC  --- 0 ACK 38 [0 0 0 0]
s 0.504695770 _2_ MAC  --- 0 AODV 106 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505543851 _7_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544034 _3_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544037 _4_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544135 _0_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544421 _5_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544587 _6_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505544587 _1_ MAC  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505568851 _7_ RTR  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505569034 _3_ RTR  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505569037 _4_ RTR  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505569135 _0_ RTR  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
r 0.505569421 _5_ RTR  --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [5 0] [0 4]] (REQUEST)
s 0.505569421 _5_ RTR  --- 0 AODV 44 [0 0 0 0] ------- [5:255 0:255 30 2] [0x4 1 [5 4] 10.000000] (REPLY)
r 0.505569587 _6_ RTR  --- 0 AODV 48 [0 ffffffff 2 80

knudfl

unread,
Apr 26, 2017, 11:59:47 AM4/26/17
to Network Simulator 2 (NS2)
@huggins manjiche.

A trace file cannot be used for creating a graph. Unless you write a script for every trace file.
The way to do graphs is simply to have the simulation.tcl generate the files.

Please read  "VIII. Creating Output Files for Xgraph" http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html

... And read and run these :  xgraph_ns2-files-tcl_07.2016.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNWEJCa1QxN284bUk/view?usp=sharing

One blackhole example is included : `aodv-Xgr_blackhole.tcl´ (Issued Mar 22  2015).
... I simply added blackhole to "aodv-Xgr.tcl"
     7    ######### Added for blackholeAODV
     
8    set val(nn)      15
     
9    set val(nnaodv)  5
   
10    set val(brp)     blackholeAODV
   
11    ##########
.
.
   
40    ###################################### Added for blackholeAODV
   
41    
   
42    # $ns_  node-config  -adhocRouting $val(brp)
   
43    for {set i $val(nnaodv) } {$i<$val(nn) } {incr i} {
   
44         set node_($i) [$ns node]
   
45         $node_($i) random-motion 0;
   
46         $ns at 0.01 "$node_($i) label \"blackhole node\""
   
47    }
   
48    ##################################################
The left column numbers are the line numbers.

----------------------------------------------------------

huggins manjiche

unread,
Apr 27, 2017, 9:39:01 AM4/27/17
to Network Simulator 2 (NS2)
tthank you a lot sir

MayiHelpU sureiwillhelpu

unread,
Aug 23, 2018, 1:45:18 AM8/23/18
to ns-u...@googlegroups.com, mpss.in...@gmail.com
Hello Dear,
Greetings of the day!
Received your message, so now how may I help you? Actually we are providing NS2/NS3 Training & Project.
I have an 9+ year Industry experience on NS-2. If you are a fresher you can join our training after that you will complete your own project.
Or 2nd option we can do your project after getting all requirement from your side. For Training you can take free demo class after that you can decide.
you can call me +91-9958602502
For more detail you can visit our website given below:

 Best Regards,
Amit Kumar Sinha
Sr. Consultant 
Maa Purnagiri Software Solutions Pvt. Ltd.
J-22, Office No-21, Main Road Bishanpura, Sector-58, Noida-201301, U.P. INDIA
Website: http://mpsoftwaresolutions.com/
Mob: +91-9958-602-502 || +91-78381-99586 
Skype id:  live:mpss.innovation  
Mail id: in...@mpsoftwaresolutions.com

"Happiness is when what you think , what you say and what you do are in Harmony." 

On Mon, Mar 20, 2017 at 10:56 PM huggins manjiche <huggins...@gmail.com> wrote:
Dear Amit sinha can i have your email address

--
You received this message because you are subscribed to a topic in the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-users/oznEEorxqJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-users+u...@googlegroups.com.

oussama chaouch

unread,
Aug 28, 2018, 12:06:49 PM8/28/18
to Network Simulator 2 (NS2)
hello  help me plz  i am a final year also

mitika

unread,
Aug 10, 2020, 7:38:14 AM8/10/20
to Network Simulator 2 (NS2)
Hi sir ,
i installed your idsaodv and blackholeaodv in my ns2 folder ,
but when i run idsaodv2.tcl 
Ids.nam doesn't show any  blackhole node prevention, and the malicious node still receiving packets
any help pllllz
and thank you in advance
regards
Reply all
Reply to author
Forward
0 new messages