LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Having problem implementing blackhole and grayhole in ns2 on Ubuntu linux 11.04 (https://www.linuxquestions.org/questions/linux-wireless-networking-41/having-problem-implementing-blackhole-and-grayhole-in-ns2-on-ubuntu-linux-11-04-a-4175465910/)

sereneriver21 06-13-2013 03:48 PM

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,

knudfl 06-15-2013 04:34 AM

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

-

k3lt01 06-16-2013 10:40 PM

Quote:

Originally Posted by sereneriver21 (Post 4971263)
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.

sereneriver21 06-18-2013 12:55 PM

@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?

knudfl 06-18-2013 04:50 PM

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

-

sereneriver21 06-19-2013 01:39 AM

About Mesh topology in ns2
 
@knudfl

Can you send me the tcl script to simulate mesh topology in ns2.
And thanks for earlier posts.

knudfl 06-19-2013 05:51 AM

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

-

knudfl 06-22-2013 04:12 AM

#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.)

-

knudfl 06-22-2013 05:03 AM

# 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 ).

-

sereneriver21 06-22-2013 12:59 PM

@knudfl

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

keep up the good work man and keep guiding us.

psr2016 07-01-2016 05:48 AM

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)

knudfl 07-01-2016 08:30 AM

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.


-

psr2016 07-09-2016 04:43 AM

how i run genetic algorithm in ns2

knudfl 07-09-2016 05:30 AM

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'


All times are GMT -5. The time now is 09:26 AM.