LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 06-13-2013, 03:48 PM   #1
sereneriver21
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Rep: Reputation: Disabled
Having problem implementing blackhole and grayhole in ns2 on Ubuntu linux 11.04


Dear Sir,

I am new to ns2 and trying to implement blackhole and grayhole attacks in ns2 installed on Ubuntu 11.04 32-bit machine.

First of all i am getting the following error in running "ns blackholeaodv.tcl" OR "ns grayholeaodv.tcl"

Code:
invalid command name "Agent/rtproto/blackholeAODV"
while executing
"Agent/rtproto/blackholeAODV" instproc init args {
$self next $args
}
(file "blackholeaodv.tcl" line 19)
http://www.btechnos.com/2012/05/tcl-...blackhole.html

If i use the tcl file for blackhole available at above mentioned link and generating scenario file using "./setdest" and cbr file using "ns cbrgen.tcl" then it gives following error

Code:
num_nodes is set 20
Creating nodes...
INITIALIZE THE LIST xListHead

    (_o433 cmd line 1)
    invoked from within
"_o433 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 "_o433" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o433 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 $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_(..."
    (file "blackholesim.tcl" line 58)
Please guide me to resolve this problem.

Regards,

Last edited by sereneriver21; 06-19-2013 at 01:36 AM.
 
Old 06-15-2013, 04:34 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
invalid command name "Agent/rtproto/blackholeAODV"
The most versions of "blackholeaodv patch for ns2" do not implement a new "rtproto/...".

I.e. examples.tcl with "rtproto/.." : Either edit , or don't use the example.


blackholeaodv-btechnos.tcl http://www.btechnos.com/2012/05/tcl-...blackhole.html :
Works OK here.

Did you read this http://www.linuxquestions.org/questi...blackholeaodv/
> http://www.linuxquestions.org/questi...-4175460864/#5
> Five examples "blackholeAODV*.tcl that works ...
> https://docs.google.com/file/d/0B7S2...it?usp=sharing

-

Last edited by knudfl; 06-15-2013 at 02:56 PM.
 
1 members found this post helpful.
Old 06-16-2013, 10:40 PM   #3
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
Quote:
Originally Posted by sereneriver21 View Post
Dear Sir,

I am new to ns2 and trying to implement blackhole and grayhole attacks in ns2 installed on Ubuntu 11.04 32-bit machine.
Ubuntu 11.04 is no longer supported by Canonical. If you want to learn something new then you are much better of learning on a system that is supported.
 
Old 06-18-2013, 12:55 PM   #4
sereneriver21
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
@Knudfl

Thanks for your blackholeaodv examples.

But i want to ask where to put the file "blackholeaodv.tcl" which was made available with "blackhole.tar.gz" and has following contents:
Code:
# ======================================================================
# Default Script Options
# ======================================================================

set opt(ragent)		Agent/rtProto/blackholeAODV
set opt(pos)		NONE

if { $opt(pos) != "NONE" } {
	puts "*** WARNING: blackholeAODV using $opt(pos) position configuration..."
}

# ======================================================================
Agent instproc init args {
        $self next $args
}       
Agent/rtProto instproc init args {
        $self next $args
}       
Agent/rtProto/blackholeAODV instproc init args {
        $self next $args
}       

Agent/rtProto/blackholeAODV set sport_	0
Agent/rtProto/" set dport_	0

# ======================================================================

proc create-routing-agent { node id } {
	global ns_ ragent_ tracefd opt

	#
	#  Create the Routing Agent and attach it to port 255.
	#
	set ragent_($id) [new $opt(ragent) $id]
	set ragent $ragent_($id)
	$node attach $ragent 255

	$ragent if-queue [$node set ifq_(0)]	;# ifq between LL and MAC
	$ns_ at 0.$id "$ragent_($id) start"	;# start BEACON/HELLO Messages

	#
	# Drop Target (always on regardless of other tracing)
	#
	set drpT [cmu-trace Drop "RTR" $node]
	$ragent drop-target $drpT
	
	#
	# Log Target
	#
	set T [new Trace/Generic]
	$T target [$ns_ set nullAgent_]
	$T attach $tracefd
	$T set src_ $id
	$ragent log-target $T
}


proc create-mobile-node { id } {
	global ns_ chan prop topo tracefd opt node_
	global chan prop tracefd topo opt

	set node_($id) [new MobileNode]

	set node $node_($id)
	$node random-motion 0		;# disable random motion
	$node topography $topo

	#
	# This Trace Target is used to log changes in direction
	# and velocity for the mobile node.
	#
	set T [new Trace/Generic]
	$T target [$ns_ set nullAgent_]
	$T attach $tracefd
	$T set src_ $id
	$node log-target $T

	$node add-interface $chan $prop $opt(ll) $opt(mac)	\
		$opt(ifq) $opt(ifqlen) $opt(netif) $opt(ant)

	#
	# Create a Routing Agent for the Node
	#
	create-routing-agent $node $id

	# ============================================================

	if { $opt(pos) == "Box" } {

            set spacing 200
            set maxrow 3
            set col [expr ($id - 1) % $maxrow]
            set row [expr ($id - 1) / $maxrow]
            $node set X_ [expr $col * $spacing]
            $node set Y_ [expr $row * $spacing]
            $node set Z_ 0.0
            $node set speed_ 0.0

            $ns_ at 0.0 "$node_($id) start"

	} elseif { $opt(pos) == "Random" } {

            $node random-motion 1

            $ns_ at 0.0 "$node_($id) start"
        }
        
}
Should i make any changes within this file. And also where to put this file in ns2.34?

Last edited by sereneriver21; 06-19-2013 at 01:37 AM.
 
Old 06-18-2013, 04:50 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 4 .

All blackholeaodv examples can be located anywhere.
None of the scripts have any other dependencies than accompanied the cbr and scen files.

About the post #4 "blackholeaodv.tcl" from "blackholeaodv.zip" or similar :
Any location. Not really an issue, as the script can't be used.


P.S. : When you show error output (post #1) or code (post #4) :
Code tags must be used ..
http://www.linuxquestions.org/questi...gs-4175464257/
Please hit the 'Edit' button, and edit posts #1 and #4.

-
 
1 members found this post helpful.
Old 06-19-2013, 01:39 AM   #6
sereneriver21
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
About Mesh topology in ns2

@knudfl

Can you send me the tcl script to simulate mesh topology in ns2.
And thanks for earlier posts.
 
Old 06-19-2013, 05:51 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 6 .

"Hybrid Wireless Mesh Protocol" : HWMP.
Patch, rev. 183, #6 http://www.linuxquestions.org/questi...28-a-860439/#6

Tcl scripts, #14 http://www.linuxquestions.org/questi...8-a-860439/#14
> rev. 183, hwmp.tcl (4.5 kB) and mesh_hwmp_example.tcl (4.2 kB),
and an edited tcl/ex/wireless-mitf.tcl .

New rev.282 hwmp.tcl (8.9 kB), mesh_hwmp_example.tcl (8.5 kB), wireless-mitf.tcl
> hwmp-ns233-patched_rev282-1.tar.bz2 >
> https://docs.google.com/file/d/0B7S2...it?usp=sharing
Or ns-2.33_hwmp_rev282.patch.bz2 >
> https://docs.google.com/file/d/0B7S2...it?usp=sharing

HWMP at LQ http://www.linuxquestions.org/questions/tags/hwmp/

-

Last edited by knudfl; 06-19-2013 at 06:06 AM.
 
1 members found this post helpful.
Old 06-22-2013, 04:12 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
#6, #7.

Found another set of {hwmp.tcl, mesh_hwmp_example.tcl, wireless-mitf.tcl}
in my backup. The files are "ns-2.34" :
hwmp_rev282-ns234-patch.tar.bz2, ref. ns-2.34_hwmp_rev282.patch.bz2

The patched files https://docs.google.com/file/d/0B7S2...it?usp=sharing
The original patch https://docs.google.com/file/d/0B7S2...it?usp=sharing

( The original links for rev282 are down.)

-
 
1 members found this post helpful.
Old 06-22-2013, 05:03 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 6 .

MESH : IEEE 802.16d Wireless Mesh Networks
http://cng1.iet.unipi.it/wiki/index.php/Ns2mesh80216
http://info.iet.unipi.it/~cng/ns2mesh80216/
> http://cng1.iet.unipi.it/archive/ns2...81113.patch.gz
> ns2mesh80216-2.33-081113.patch.gz

.. providing ns-2.33/wimax/tcl/mesh.tcl , etc.
( and ns-2.33/tcl/ex/voip/voip.tcl ).

-
 
1 members found this post helpful.
Old 06-22-2013, 12:59 PM   #10
sereneriver21
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
@knudfl

Thanks a lot man..!!! You are a savior..seriously!!

keep up the good work man and keep guiding us.
 
Old 07-01-2016, 05:48 AM   #11
psr2016
LQ Newbie
 
Registered: Jul 2016
Posts: 2

Rep: Reputation: Disabled
i run this tcl script but got an following error

a@a-G31T-M:~/psr$ ns sample2.tcl
num_nodes is set 20
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

(_o3 cmd line 1)
invoked from within
"_o3 cmd node-config* -energyModel EnergyModel -initialEnergy 20 -txPower 0.744 -rxPower 0.0648 -idlePower 0.05 -sensePower 0.0175"
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 "_o3" line 2)
(SplitObject unknown line 2)
invoked from within
"$ns node-config* -energyModel EnergyModel \
-initialEnergy 20 \
-txPower 0.744 \
-rxPower 0.0648 \
-idlePower 0.05 \
-sensePower 0.0175"
(file "sample2.tcl" line 42)
 
Old 07-01-2016, 08:30 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post #11, @psr2016 : Welcome to LQ.

This thread is about "blackhole-aodv". If your question isn't about blackhole-aodv :
Please hit the 'Report' button, and ask for your post to be moved to a new thread in e.g. 'Linux - Software'.


P.S. : The official "sample2.tcl" is an nsmiracle example. See all_tcl-examples-2.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

Please upload your file.tcl : as an attachment to your new thread or to an external site like 'Google Drive' or Dropbox.


-

Last edited by knudfl; 07-01-2016 at 10:45 AM.
 
Old 07-09-2016, 04:43 AM   #13
psr2016
LQ Newbie
 
Registered: Jul 2016
Posts: 2

Rep: Reputation: Disabled
how i run genetic algorithm in ns2
 
Old 07-09-2016, 05:30 AM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #13, @psr2016 : Please read post #12 ...

This thread is about "blackhole-aodv" : You can ask about blackhole. Nothing else.

For other ns2 subject : Please start a new thread → →
http://www.linuxquestions.org/questi...ux-software-2/ >>> 'New Thread'
 
  


Reply

Tags
blackholeaodv, hwmp, mesh, ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Having problem implementing blackhole and grayhole in ns2 on Ubuntu linux 11.04 sereneriver21 Linux - Software 1 06-16-2013 09:40 PM
Help required in adding blackhole in ns2 mozahmed Linux - Software 9 03-15-2013 12:22 PM
problem in implementing etx in aodv in ns2.34 vikash1143 Linux - Wireless Networking 1 02-07-2013 02:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 11:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration