Hello friend, here I am going to present a method to calculate the runtime packet loss. I am going to show this using ns2 2.34 and AODV.
Sometime we require packet loss to calculate trust value (in case of Trust Based protocols where it is done by no. of packets sent - no. of packets received).
I am going to show the calculation for a particular pair of nodes.
Steps involved:-
A) We will have to add a node as a malicious node which will drop the packets
intentionally. You can add a malicious node using this link.
B) Second, we'll set the AODV in promiscuous mode, where every node will
listen to its neighbors.
1) We need to modify in total 3 files to set AODV in promiscuous mode, so it's
good to take a backup of it.
Files are:
and make the changes as shown in blue color.
}
//Add the following blue code just below the above code
}
6) Now, make the NS2 by using following commands in ns-allinone-2.34/ns-2.34 directory.
#======================================================================
# 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(x) 800
set val(y) 800
set ns [new Simulator]
#ns-random 0
set f [open out.tr w]
$ns trace-all $f
set namtrace [open out.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set topo [new Topography]
$topo load_flatgrid 800 800
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 out.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
$ns color 7 black
set n(0) [$ns node]
$ns at 0.0 "$n(0) color blue"
$n(0) color "0"
$n(0) shape "circle"
set n(1) [$ns node]
$ns at 0.0 "$n(1) color red"
$n(1) color "blue"
$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"
$n(5) color "red"
$n(5) shape "circle"
for {set i 0} {$i < $val(nn)} {incr i} {
$ns initial_node_pos $n($i) 30+i*100
}
$ns at 0.0 "[$n(1) set ragent_] hacker"
$ns at 0.0 "$n(0) setdest 100.0 100.0 3000.0"
$ns at 0.0 "$n(1) setdest 200.0 200.0 3000.0"
$ns at 0.0 "$n(2) setdest 300.0 200.0 3000.0"
$ns at 0.0 "$n(3) setdest 400.0 300.0 3000.0"
$ns at 0.0 "$n(4) setdest 500.0 300.0 3000.0"
$ns at 0.0 "$n(5) setdest 600.0 400.0 3000.0"
# 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
6) In above script, node 0 is source and node 5 is destination. Node 1 is set as
malicious node.
Sometime we require packet loss to calculate trust value (in case of Trust Based protocols where it is done by no. of packets sent - no. of packets received).
I am going to show the calculation for a particular pair of nodes.
Steps involved:-
A) We will have to add a node as a malicious node which will drop the packets
intentionally. You can add a malicious node using this link.
B) Second, we'll set the AODV in promiscuous mode, where every node will
listen to its neighbors.
1) We need to modify in total 3 files to set AODV in promiscuous mode, so it's
good to take a backup of it.
Files are:
- ns-allinone-2.34/ns-2.34/aodv/aodv.cc
- ns-allinone-2.34/ns-2.34/aodv/aodv.h
- ns-allinone-2.34/ns-2.34/tcl/lib/ns-mobilenode.tcl
and make the changes as shown in blue color.
This code goes at top in header section.
#include <mac.h>
..............................................
..............................................
//This code goes at line 128.
class MalTimer : public Handler {
public:
MalTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
..............................................
public:
MalTimer(AODV* a) : agent(a) {}
void handle(Event*);
private:
AODV *agent;
Event intr;
};
..............................................
..............................................
// This code is below the text
/*
The Routing Agent
*/
The Routing Agent
*/
//Approximately at line 203
class AODV: public Tap, public Agent {
public:
void tap(const Packet *p);
void check_mal(void);
int fcount;
int rcount;
......
protected:
Mac *mac_;
......
}
..............................................
..............................................
//This code is below the text
/*
* Timers
*/
* Timers
*/
// Approximately at line 308
MalTimer maltimer;
3) Open the file ns-allinone-2.34/ns-2.34/aodv/aodv.cc and make the changes as
shown in blue color.
This blue code is approximately at line 94
if (strncasecmp(argv[1], "start", 2) == 0) {
btimer.handle((Event*) 0);
maltimer.handle((Event*) 0);
#ifndef AODV_LINK_LAYER_DETECTION
htimer.handle((Event*) 0);
ntimer.handle((Event*) 0);
#endif // LINK LAYER DETECTION
rtimer.handle((Event*) 0);
return TCL_OK;
}
btimer.handle((Event*) 0);
maltimer.handle((Event*) 0);
#ifndef AODV_LINK_LAYER_DETECTION
htimer.handle((Event*) 0);
ntimer.handle((Event*) 0);
#endif // LINK LAYER DETECTION
rtimer.handle((Event*) 0);
return TCL_OK;
}
// This blue code is approximately at line 133
int
AODV::command(int argc, const char* const * argv) {
AODV::command(int argc, const char* const * argv) {
......
else if(argc == 3) {
......
else if (strcmp(argv[1], "install-tap") == 0) {
mac_ = (Mac*)TclObject::lookup(argv[2]);
if (mac_ == 0) return TCL_ERROR;
mac_->installTap(this);
return TCL_OK;
}
mac_ = (Mac*)TclObject::lookup(argv[2]);
if (mac_ == 0) return TCL_ERROR;
mac_->installTap(this);
return TCL_OK;
}
}
return Agent::command(argc, argv);
return Agent::command(argc, argv);
}
//Add the following blue code just below the above code
void
AODV::tap(const Packet *p) {
AODV::tap(const Packet *p) {
struct hdr_cmn* hdcmn = HDR_CMN(p);
if (index == 0) {
if (hdcmn->ptype_ == PT_CBR) {
rcount++;
}
}
} if (index == 0) {
if (hdcmn->ptype_ == PT_CBR) {
rcount++;
}
}
..............................................
btimer(this), htimer(this), ntimer(this),
rtimer(this), lrtimer(this), maltimer(this), rqueue() {
index = id;
seqno = 2;
bid = 1;
malicious = false;
rcount = 0;
fcount = 0;
LIST_INIT(&nbhead);
LIST_INIT(&bihead);
logtarget = 0;
ifqueue = 0;
}
..............................................
//This blue code is approximately at line 160
AODV::AODV(nsaddr_t id) : Agent(PT_AODV),btimer(this), htimer(this), ntimer(this),
rtimer(this), lrtimer(this), maltimer(this), rqueue() {
index = id;
seqno = 2;
bid = 1;
malicious = false;
rcount = 0;
fcount = 0;
LIST_INIT(&nbhead);
LIST_INIT(&bihead);
logtarget = 0;
ifqueue = 0;
}
//This code is above the text
/*
Broadcast ID Management Functions
*/
Broadcast ID Management Functions
*/
// Approximately at line 233
void MalTimer::handle(Event*) {
agent->check_mal();
Scheduler::instance().schedule(this, &intr, 0.5);
}
agent->check_mal();
Scheduler::instance().schedule(this, &intr, 0.5);
}
void AODV::check_mal() {
if (index == 0) {
if (fcount > rcount + 1 ) {
fprintf(stderr, "No. of packets dropped are %d\n", fcount-rcount);
}
}
}
if (index == 0) {
if (fcount > rcount + 1 ) {
fprintf(stderr, "No. of packets dropped are %d\n", fcount-rcount);
}
}
}
Note:- When you are adding malicious node module, please replace author code
// if I am malicious node
if (malicious == true ) {
drop(p, DROP_RTR_ROUTE_LOOP);
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
if (malicious == true ) {
drop(p, DROP_RTR_ROUTE_LOOP);
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
to
if (malicious == true) {
if (ch->ptype_ == PT_CBR) {
drop(p, DROP_RTR_ROUTE_LOOP);
return;//Required if you get pkt flow not specified error.
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
}
if (ch->ptype_ == PT_CBR) {
drop(p, DROP_RTR_ROUTE_LOOP);
return;//Required if you get pkt flow not specified error.
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
}
//Add the following blue code just below the above code
if (index == 0) {
if (ch->ptype_ == PT_CBR) {
fcount++;
}
}
if (ch->ptype_ == PT_CBR) {
fcount++;
}
}
4) Open the file ns-allinone-2.34/ns-2.34/tcl/lib/ns-mobilenode.tcl and make the
changes as shown in blue color.
Node/MobileNode instproc add-target { agent port } {
$self instvar dmux_ imep_ toraDebug_ mac_
......
# Special processing for AODV
set aodvonly [string first "AODV" [$agent info class]]
if {$aodvonly != -1 } {
$agent if-queue [$self set ifq_(0)] ; # ifq between LL and MAC
$agent install-tap $mac_(0)
......set aodvonly [string first "AODV" [$agent info class]]
if {$aodvonly != -1 } {
$agent if-queue [$self set ifq_(0)] ; # ifq between LL and MAC
$agent install-tap $mac_(0)
}
6) Now, make the NS2 by using following commands in ns-allinone-2.34/ns-2.34 directory.
- make clean
- make depend
- make
#======================================================================
# 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(x) 800
set val(y) 800
set ns [new Simulator]
#ns-random 0
set f [open out.tr w]
$ns trace-all $f
set namtrace [open out.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set topo [new Topography]
$topo load_flatgrid 800 800
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 out.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
$ns color 7 black
set n(0) [$ns node]
$ns at 0.0 "$n(0) color blue"
$n(0) color "0"
$n(0) shape "circle"
set n(1) [$ns node]
$ns at 0.0 "$n(1) color red"
$n(1) color "blue"
$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"
$n(5) color "red"
$n(5) shape "circle"
for {set i 0} {$i < $val(nn)} {incr i} {
$ns initial_node_pos $n($i) 30+i*100
}
$ns at 0.0 "[$n(1) set ragent_] hacker"
$ns at 0.0 "$n(0) setdest 100.0 100.0 3000.0"
$ns at 0.0 "$n(1) setdest 200.0 200.0 3000.0"
$ns at 0.0 "$n(2) setdest 300.0 200.0 3000.0"
$ns at 0.0 "$n(3) setdest 400.0 300.0 3000.0"
$ns at 0.0 "$n(4) setdest 500.0 300.0 3000.0"
$ns at 0.0 "$n(5) setdest 600.0 400.0 3000.0"
# 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
6) In above script, node 0 is source and node 5 is destination. Node 1 is set as
malicious node.
i had added what you had given and do the three make steps.whenever i run a tcl file i got the error
ReplyDeletenum_nodes is set 6
INITIALIZE THE LIST xListHead
can't read "mac_(0)": no such variable
while executing
"$agent install-tap $mac_(0) #arifa"
(procedure "_o19" line 31)
(Node/MobileNode add-target line 31)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 82)
(Simulator create-wireless-node line 82)
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"
invoked from within
"set n(0) [$ns node]"
(file "mactest.tcl" line 74)
can you please tell me why this happened
$self instvar dmux_ imep_ toraDebug_ mac_
DeleteIn this statement leave a space between toraDebug_ and mac_ and it will be done. I was receiving the same error.i have solved it
i had added what you had given and do the three make steps.whenever i run a tcl file i got the error
ReplyDeletenum_nodes is set 6
INITIALIZE THE LIST xListHead
can't read "mac_(0)": no such variable
while executing
"$agent install-tap $mac_(0) #arifa"
(procedure "_o19" line 31)
(Node/MobileNode add-target line 31)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 82)
(Simulator create-wireless-node line 82)
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"
invoked from within
"set n(0) [$ns node]"
(file "mactest.tcl" line 74)
can you please tell me why this happened
12 September 2012 23:23
Probably u missed below line.
Delete$self instvar dmux_ imep_ toraDebug_ mac_
mac_ has to be there in above line. You have to add it.
I add this but still i'm getting the same error.
Deleteplz help
Dear sir , This is what i get after executing. Can u verify and do pls post the output too.
ReplyDeletemcq@mcq:~/Desktop/NS 2/Final$ ns vb.tcl
num_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
Direction for pkt-flow not specified; Sending pkt up the stack on default.
check_pktTx:Invalid MAC Control subtype
Sorry dear but I have not seen any such error! Better way u can try whole process on a fresh ns2 2.34 installation. All the best!
ReplyDeletei want to know which node is monitoring
ReplyDeleteNode 0 is monitoring!
ReplyDeleteIn below code index identifies current instance of node, i.e. 0 in this case.
if (index == 0) {
if (hdcmn->ptype_ == PT_CBR) {
rcount++;
}
}
sir how do i isolate malicious node from the network?
DeleteI have to do temporary isolation and permanent isolation.the isolation should be done by its neighbouring nodes only not all the nodes in the network. can you pls suggest me how to do that.....thanks in advance
hai Mr.Durgesh
ReplyDeletei have following error pls help to debug
(_o5 cmd line 1)
invoked from within
"_o5 cmd at 0.0 _o40 hacker"
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 "_o5" line 2)
(SplitObject unknown line 2)
invoked from within
"_o5 at 0.0 _o40 hacker"
("eval" body line 1)
invoked from within
"eval $scheduler_ at $args"
(procedure "_o3" line 3)
(Simulator at line 3)
invoked from within
"$ns at 0.0 [$node_(1) set ragent_] "hacker" "
(_o5 cmd line 1)
ReplyDeleteinvoked from within
"_o5 cmd at 0.0 _o40 hacker"
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 "_o5" line 2)
(SplitObject unknown line 2)
invoked from within
"_o5 at 0.0 _o40 hacker"
("eval" body line 1)
invoked from within
"eval $scheduler_ at $args"
(procedure "_o3" line 3)
(Simulator at line 3)
invoked from within
"$ns at 0.0 [$node_(1) set ragent_] "hacker" "
I think that "$ns at 0.0 [$node_(1) set ragent_] hacker"
Deletenot "$ns at 0.0 [$node_(1) set ragent_] "hacker"
if (malicious == true) {
ReplyDeleteif (ch->ptype_ == PT_CBR) {
drop(p, DROP_RTR_ROUTE_LOOP);
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
}
in which funtion i should add this because i was not able to find the replacable content given above
rt_resolve()
DeleteHi...what if i only want the count of received and sent packets and also want to check what kind of packet it is..without malicious and promiscuous mode...how can that be accomplished????????????????/
ReplyDeleteHow to find the no. of packets received and sent by a node along with the packet type/size without using promiscuous mode and mal node????
ReplyDeleteu need to use common header to identify packet type and two counters for maintaining sent/received packets. One more thing, according to my knowledge promiscuous mode is required for listening/overhearing packets of neighbors. Otherwise, you can make use of your own acknowledgement packets. All the best!
DeleteHi sir,
ReplyDeleteI want codes to implement syn and smurf attacks......
Sorry! but, I don't know about these attacks. Drop me a mail in detail about that!
ReplyDeleteHi
ReplyDeleteThanks for your great help for ns-2 users
I want malicious node to drop the packet in some manner. For example, it drops the packets as follows:
....
if (malicious == true) {
if (ch->ptype_ == PT_CBR) {
int i;
i= 1+ rand()% 6;
if (i>3){
drop(p, DROP_RTR_ROUTE_LOOP);}
//DROP_RTR_ROUTE_LOOP is added for no reason.
}
}
...
However when I implement this code, it does not work.
Can you please help me on this ?
Thanks sir, I managed how to drop the packets in certain pattern.
ReplyDeletePlease can you help me to handle following questions?
1. You defined 'fcount' and 'rcount'. Are these for counting received(fcount) and forwarded(rcount) packets?
2. How we can add drop rate in route selection as criteria?
Thanks
u r right! rcount and fcount are used for same purpose!
DeleteI didn't get about drop rate.
Hi
ReplyDeleteMy point is that for example node 0 monitors not only node 1 but also node 2 (if we allocate the node 2 paralell with node1). So node 0 can estimate packet drop for each node(node1 and node2) and choose the one who has less packet drop.
So how we can make node 0 monitor both nodes(not in the same time) and estimate packet drop for each node ?
Morever, how we can change route choosing decision based packet drop(for example if node 2 has less packet drop we will choose node 2 as next node not node 1)?
Hello! u can make use of a table to store no. packets transmitted and no. of packets forwarded.
DeleteE.g.
If u want to monitor nodes 2 & 3 by node 0,
Node 0 will maintain a table of packets transmitted by itself to node 2 & 3 and no. of packets it receives back in promiscuous mode. No doubt intended receivers of packets should be 2 &3 only. Using this data values u can decide on path. All the best!
how to print nexthop?
ReplyDeleteHere we can find no. of packeddrop only. we need to print packet transferring path also. how can do?
I am assuming u r using AODV. If u want print whole path, u need to add an extra field in ur data/control (as per requirement) packet. There u can append whole path to packet and later extract it. All the best!
Deletehi i want to implement trust based routing in aodv. kindly pls help me to figure out what will change in aodv and which module. if any idea related to trust based routing, plz reply me as soon as possible..............
ReplyDeleteFor trust based routing, u need to decide on which parameters u r going to calculate trust of each node. If AODV is protocol, u need to modify, aodv_rtable.h, aodv_rtable.cc, aodv.cc and aodv.h files. All the best!
ReplyDeletehow to monitor the number of rts/cts packets.
DeleteHi
ReplyDeleteCan u please help me to implement trust based AODV ? I am writing paper for journal. I need to add some simulation results. If we can get some results, you also will be one of the authors of the paper....
I will help you. Drop me a mail at durgeshpkshirsagar@gmail.com and we'll discuss!
ReplyDeletei am also working in trust value.pls send me code to implement trust based aodv . pls send it soon. its urgent
DeleteHello ,
ReplyDeleteit works with ns 2.35 ?
Sorry! I have not tried it on 2.35. Better way is to check it yourself! If you get some errors ask me.
DeleteI have following error
Deletens: _o44 hacker:
(_o44 cmd line 1)
invoked from within
"_o44 cmd hacker"
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 "_o44" line 2)
(SplitObject unknown line 2)
invoked from within
"_o44 hacker"
i think it means miss-match of the word used "hacker" must check it bcoz i'm having the same problem
DeleteHi,
ReplyDeletethe monitor (node 0)calculate the packets dropped for only the malicious node(node 1) or for all its neighbors?
foe node 1 only!
Deletehi,
ReplyDeleteI followed the steps as described, but when i execute the sample tcl file,the folloing error appears on terminal
num_nodes is set 6
INITIALIZE THE LIST xListHead
(_o22 cmd line 1)
invoked from within
"_o22 cmd install-tap _o24"
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 "_o22" line 2)
(SplitObject unknown line 2)
invoked from within
"$agent install-tap $mac_(0)"
(procedure "_o19" line 24)
(Node/MobileNode add-target line 24)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 85)
(Simulator create-wireless-node line 85)
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"
invoked from within
"set n(0) [$ns node]"
(file "vanet.tcl" line 74)
can you reply the reason for this error.
Thank you.
hi,
ReplyDeleteI followed the steps as described, but when I execute the sample tcl file,the following error appears on the terminal
num_nodes is set 6
INITIALIZE THE LIST xListHead
(_o22 cmd line 1)
invoked from within
"_o22 cmd install-tap _o24"
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 "_o22" line 2)
(SplitObject unknown line 2)
invoked from within
"$agent install-tap $mac_(0)"
(procedure "_o19" line 24)
(Node/MobileNode add-target line 24)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 85)
(Simulator create-wireless-node line 85)
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"
invoked from within
"set n(0) [$ns node]"
(file "vanet.tcl" line 74)
can you reply the reason for this error. Kindly help to resolve this issue.
Thank you.
did u add return TCL_OK? Please check that!
Deletesir,could you send me ns2.34/tcl/lib/ns-mobilenode.tcl file
ReplyDeleteb'coz i'm having the error msg i think ns-mobilenode.tcl file has some problem.......
can't read "mac_(0)": no such variable
while executing
"$agent install-tap $mac_(0)"
(procedure "_o19" line 24)
(Node/MobileNode add-target line 24)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 84)
(Simulator create-wireless-node line 84)
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"
invoked from within
"set n(0) [$ns node]"
(file "sample-test.tcl" line 71)
1) If I replace line :
ReplyDelete$ns at 0.0 "[$n(1) set ragent_] hacker" with
$ns at 0.0 "[$n(2) set ragent_] hacker"
then node 2 is not dropping the packets. Where should i make changes
so that it will work properly?
2) Before I click on play forward button it shows following message on the
terminal:
No. of packets dropped are 17
No. of packets dropped are 34
No. of packets dropped are 50
No. of packets dropped are 67
No. of packets dropped are 84
No. of packets dropped are 101
No. of packets dropped are 117
No. of packets dropped are 134
No. of packets dropped are 151
How it could be?
First thing is node 2 should not be source or destination. Second thing, you can use like
Deleteif(index==2)
{
fprintf(stderr,"I am node %d and dropping packet\n",index);
}
add this is rt_resolve() method. All the best
How to detect this malicious node?
ReplyDeleteDecide ur threshold for drops first! Then u can check with that value and isolate node.
ReplyDeleteDear Durgesh .
DeleteI did all the above step-by-step. But I do not know how to detect the malicious nodes and isolate in the network.
pleas send me executable files for me .if can. thank u very much.
my email: babaei.mehrdad@gmail.com
Deletethank's
hello Durgesh,
ReplyDeletecould you send me the .tcl file for this b'coz i did same this to implement promiscious mode in AODV.
but i getting the error msg like:"can't read "mac_(0)": no such variable...."
so plz send me the tcl file... may be that would help...
thank you
or you could send me these three files...........
DeleteDrop me a test mail I will send you code!
Deletehello Sir,
ReplyDeleteI am trying to implement trust based routing in zrp. please guide me for this.
How can I count number of packets forwarded or dropped by all other in order to calculate trust, as you did between node 0 and node 1?
please help
Drop me a test mail I will send you code!
ReplyDeletePlz send code to resmi345@gmail.com
Deletesir can you please send the same code to v20021994@gmail.com ... it's urgent.
DeleteHi Durgesh,
ReplyDeleteI am working on AODV and have a similar question to kriti:
kriti10 August 2013 06:44
hello Sir,
I am trying to implement trust based routing in zrp. please guide me for this.
How can I count number of packets forwarded or dropped by all other in order to calculate trust, as you did between node 0 and node 1?
please help
My thesis is on AODV. Can you please help?
Respectfully,
Koffka.
i have the following error
ReplyDelete_o44 hacker:
(_o44 cmd line 1)
invoked from within
"_o44 cmd hacker"
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 "_o44" line 2)
(SplitObject unknown line 2)
invoked from within
"_o44 hacker"
sir,
ReplyDeletewhere should we add the author code....???
Hello sir..I am trying to implement intrusion detetion using fuzzy logic..Could u please tell me how would I able to simlute in ns2.35.And give me your mail id also..
ReplyDeletehello sir, afer running make depend
ReplyDeleteerror :
emulate/net-pcap.cc:64:18: fatal error: pcap.h: No such file or directory
compilation terminated.
Sir,
ReplyDeleteWhen I run make clean I end up with
make: *** No rule to make target `clean'. Stop.
Is there any alternative for this?
hello sir, afer running make depend
Deleteerror :
emulate/net-pcap.cc:64:18: fatal error: pcap.h: No such file or directory
compilation terminated.
sir,
ReplyDeletei have added malicious node in aodv protocol, it must drop the packet and need to send acknowledgment to source node. i have code for drop the packet but its not working properly. i have included in rt_ resolve function. i dont know where to include the code in rt_resolve. i want to know how to send acknowledgment .please any one help.my mail id :manocse89@gmail.com
Hello Durgesh i have tried all the changes that you have told but still i am getting error as Ritu Sori21 October 2013 04:15
ReplyDeletecan u plz mail me all three files at suvira.1310@gmail.com
thanx in advance
sir,
ReplyDeletei am using blackhole routing protocol to add malicious node so can u please tell me where to insert fcount code...
num_nodes is set 6
ReplyDeleteINITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
ns: _o44 hacker:
(_o44 cmd line 1)
invoked from within
"_o44 cmd hacker"
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 "_o44" line 2)
(SplitObject unknown line 2)
invoked from within
"_o44 hacker"
hello..
ReplyDeletei need your help..
can you please tell me the code of adding simple malicious node in aodv...how to edit aodv.cc and aodv.h file for malicious node
i am getting this error pls pls help me
ReplyDeletenum_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
ns: _o44 hacker:
(_o44 cmd line 1)
invoked from within
"_o44 cmd hacker"
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 "_o44" line 2)
(SplitObject unknown line 2)
invoked from within
"_o44 hacker
recompile ns2
DeleteThank u so much.. It was very useful for me..
ReplyDeleteplease tell how to introduce more than one malicious node in aodv source code
ReplyDeleteThis comment has been removed by the author.
ReplyDeletenum_nodes is set 25
ReplyDeleteINITIALIZE THE LIST xListHead
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
ns: _o215 hacker:
(_o215 cmd line 1)
invoked from within
"_o215 cmd hacker"
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 "_o215" line 2)
(SplitObject unknown line 2)
invoked from within
"_o215 hacker"
plss tell e what to do....make command is also not working
plss rply me on roohi.mini227@gm
How can I calculate the number of rts and cts packets exchanged at mac layer during a simulation.
ReplyDeleteHow can I calculate the number of rts and cts packets exchanged at mac layer during a simulation.
ReplyDeleteHi,
ReplyDeleteI get this error while executing.
ns: _o107 hacker:
(_o107 cmd line 1)
invoked from within
"_o107 cmd hacker"
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 "_o107" line 2)
(SplitObject unknown line 2)
invoked from within
"_o107 hacker"
Please do help. Its very important for me
I try to include malicious nodes in my tcl script sir.Help me sir when running my tcl script it shows the following error
ReplyDeletenum_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
Start of simulation..
ns: _o44 hacker:
(_o44 cmd line 1)
invoked from within
"_o44 cmd hacker"
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 "_o44" line 2)
(SplitObject unknown line 2)
invoked from within
"_o44 hacker"
hi,
ReplyDeleteHow to simulate DDOS attack in ns2?
hi sir ..
ReplyDeletei wore in NS2.35 when i implement this code i get this error
virtual int AODV::command(int, const char* const*)’:
aodv/aodv.cc:88:5: error: ‘maltimer’ was not declared in this scope
maltimer.handle((Event*) 0);
aodv/aodv.cc: In constructor ‘AODV::AODV(nsaddr_t)’:
aodv/aodv.cc:158:34: error: class ‘AODV’ does not have any field named ‘maltimer’
rtimer(this), lrtimer(this),maltimer(this), rqueue()
PLZ help me .. what is wrong???
You need to declare maltimer in aodv.h file.
DeleteSir , Please give your mail id
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletesir
ReplyDeleteI wanted a code for packet dropping attack in DSR.(7 nodes)
In which if the receiver gets the packet properly receiver has to send back an acknowledgement(ACK) packet to sender (No packet dropping attack)
can you please help
Thank you
Abhi
hello @abhishek plz mail me project2.matrixarc@gmail.com i will provide that code
Deleteplz help me to do watchdog mechanism in ns2
ReplyDeleteHi..I m doing project in MANET. in that i want to send bait packets(packet with fake destination address) to bait or catch malicious nodes.can u provide code for this.
ReplyDeleteHi..I m doing project in MANET. in that i want to send bait packets(packet with fake destination address) to bait or catch malicious nodes.can u provide code for this.
ReplyDeletesir,can u send me the code for calculating trust values
ReplyDeletesir can u please send me code for calculating round trip time for round trip path for finding faulty node
ReplyDeletehi,
ReplyDeletecan anyone tell me how to get current system in ns2?
i want to have function which displays current real time and also helps to find duration of session using time
how to change the environment for AODV from IPv4 to IPv6
ReplyDeletecan u please tell me how can i drop or loss RERR message in aodv tcl script
ReplyDeleteHello.....
ReplyDeleteNeed assistance in creating two dimensional arrays.
I need to create the below scenario
nblist_0 = {1,2,3,4}
nblist_1 = {3,7,5,9,1}
nblist_2 = {7,4,9,2,5}
nblist_3 = {1,2,4,6}
nblist_4 = {1,5,4} and soon
Since my logic hereafter follows the above two dimensional array, I also need the logic to access the individual data (just like an array). Kindly help!!
Hello sir..I am trying to implement intrusion detetion using IDSAODV Could u please tell me how would I able to simlute in ns2.35.And i want to implement trustedAODV with blackhole attack added. pls sir send me .tcl file , Trusted AODV .cc file and Trusted AODV.h file to find the packetdropp, throughput and delay.pls help me it is urgent to me. my email nilam.nlm@gmail.com thanks sir in advance
ReplyDeletesir , i have change AODV.cc , AODV.h and ns-mobilenode.tcl according to the above given code. after change i given make clean make depent and make command but i found following error /filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o aodv/aodv.o aodv/aodv.cc
ReplyDeleteaodv/aodv.cc:99:3: error: expected unqualified-id before ‘else’
else if(argc == 3) {
^
aodv/aodv.cc: In member function ‘virtual int AODV::command(int, const char* const*)’:
aodv/aodv.cc:98:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [aodv/aodv.o] Error 1
pls help me how to remove it.