Introduction:-
In Promiscuous mode each node in the network listens the packets transmitted by its own neighbor nodes.
In NS-2, some time we have to calculate the packet drops or analyze the process. For the same we need to set the network to operate in promiscuous mode. Here, I am going to explain how we can set our wireless network in promiscuous mode with AODV as Routing protocol using NS2 simulator.
1) We need to modify in total 3 files, so it's good to take a backup of it.
Files are:
and make the changes as shown in blue color.
1) We need to modify in total 3 files, 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.
#include <mac.h>
class AODV: public Tap, public Agent {
public:
void tap(const Packet *p);
......
protected:
Mac *mac_;
......
}
3) Open the file ns-allinone-2.34/ns-2.34/aodv/aodv.cc and make the changes as
shown in blue color.
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);
}
void
AODV::tap(const Packet *p) {
AODV::tap(const Packet *p) {
// put your code here
}
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)
}
Explanation:-
The above procedure will put all the nodes in the wireless network in promiscuous mode. If a node A wants to listen the packets from a node B in promiscuous mode to check whether to check B is forwarding the packets which are sent by A to B or not we can write the code in function tap()
5) To simulate a node as a malicious node in AODV here is a nice blog
http://elmurod.net/index.php/2009/10/24/adding-malicious-node-in-aodv/
getting errors.......
ReplyDeletewhile i was running tcl script getting errors.........
ReplyDeleteI am also geting the errors while running the tcl scripts. please let me know the solutions for it
Deletei have a solution. plz contact me 9978026818
DeleteWhat r the errors? Can u post them here?
ReplyDeleteHow can I set a certain node to be a promiscuous node on tcl?
ReplyDeleteThanks
Hello! In CPP code you need to filter the traffic for that node in tap() method.
ReplyDeletee.g. If I want node 1 to be in promiscuous mode, I should check the packets received by node 1 in tap() method as below,
if(index==1)//index is the current node.
{
//Your code for all packets captured by node 1 in promiscuous mode.
}
One more thing I would like to share, in NS2 every node runs its own copy of code. As we have to differentiate between the code run by node 1 and that by other nodes, we have to use if condition.
In TCL you will have to use a boolean to pass as argument with that node and u can check this with cpp code in tap() method. This is a longer way and requires binding between TCL and CPP variables. All the best!
sir i want to drop or loss RERR message in aodv routing protocol i am using ns2 can u please help me in to write tcl script for this....please
Deleteis it necessary to add any code in tcl script to make promiscuous mode active, or it will work automatically? could you help me to make a tap function to overhear packet forwarding, am trying to build a watchdog in MANET
ReplyDeletethanks.....
No! it is not necessary. I can help you, but I will require more information from you. Mail me regarding it.
ReplyDeletesir, am trying to implement a collaborative watchdog in MANET, in this approach by making each node in the MANET with a collaborative approach, they can easily identify the malicious nodes in the MANET, and then they can generate a new route if any route failure occurs, i did the malicious node simulation successfully, and now i need to make my nodes in promiscuous mode to overhear packet forwarding.... and i need the information about how to build or regenerate a route if a route failure occurs.... i hope u will me way to complete my task... i put install-tap in AODV::command(...) , how i can call this install-tap in tcl script, what is the exact statement to call the install-tap method.... pls help me sir... thanking you in advance.....
ReplyDeletesir can u help me to know, how the tcl command will looks like to enable tap agent ie to enable promiscuous mode.... i don't know how to invoke that promiscuous mode aodv
ReplyDeleteThanks....
sir can u help me to know how the tcl commands will looks like to enable promiscuous mode in aodv ie how can i invoke the defined tap agent... there is a shadow object install-tap, and how cud i use that under tcl
ReplyDeletehi, can u help me by sharing your ns2 code for promiscuous node
DeleteThanks in Advance
Hi, can you share your code to me? Thanks very much.
Deletesir i want to drop or loss RERR message in aodv routing protocol i am using ns2 can u please help me in to write tcl script for this....please
DeleteFirst of all, Promiscuous mode does not need any command from TCL code. You only have to modify the CPP code as given above. To overhear the packet you need to add method
ReplyDeletevoid
AODV::tap(const Packet *p) {
// put your code here
}
Here, your code is required for filtering purpose. Reason is, in NS2 each of the nodes is running its own copy of code. So, tap method run by every node will be in its own space. So on command prompt while execution, you will get outputs from all nodes and this output has to be filtered.
e.g.
void
AODV::tap(const Packet *p) {
fprintf(stderr,"I am node %d ",index);
}
Above code will print the node which is executing. Node which receives any kind of packet will execute tap method. Try above code.
Suppose u have 10 nodes and u want node 2 should monitor node 3, in this case, code will be like below
void
AODV::tap(const Packet *p) {
// put your code here
if(index==2)
{
//Check if packet is from node 3
//If yes then node 2 received packet from 3 by overhearing method.
}
}
If required any help drop me a mail. All the Best!
sir how could i calculate number of route request ,number of RREP forwarded, number of RREQ forwarded and number of Data packets dropped by each node?
Deletepls mail me to krish05051990@gmail.com
I would like to modify AODV protocol based on fuzzy optimization for Multiple Qos Constraints(delay, jitter, buffer, energy level) Routing.
ReplyDeletehiii what is overhearing method or can you explain the code for tap method
ReplyDeletehi sir after following your procedure and changes i did
ReplyDelete$make
and gettin gfollowing errors
void AODV::tap(const Packet*)’ cannot be overloaded
can u help me please
Hi Sir
ReplyDeleteI added this line fprintf(stderr,"Node in Promiscuous Mode\n"); in void tap but it shows nothing . what is instruction that called the function tap ?
can you help me
Hi..
ReplyDeleteCan we write a tcl code for making a node drop packets.?
hello Sir,
ReplyDeletei did make the promicious mode and now i want to add an algo. "if the node does not forward the packet then check that the node is malicious or not by sending FakeRREQ to that node and if he reply to the req. then add it in the blacklist and broadcast the alarm msg"
but sir i don't know how to implement a new list or queue in ns2 and use the info. given by promicious mode.....plz tell me if you have any idea/link related to this.
thank you sir for your time.
promicious mode is not working could you give the ns-mobilenode.tcl file
ReplyDeletethanks........
now it run i made a silly mistake ...........
ReplyDeletethanks yaar
m getting dis error after making changes...aodv/aodv.cc: In member function ‘virtual int AODV::command(int, const char* const*)’:
ReplyDeleteaodv/aodv.cc:146:30: error: ‘agrv’ was not declared in this scope
aodv/aodv.cc:148:8: error: ‘TCl_ERROR’ was not declared in this scope
make: *** [aodv/aodv.o] Error 1
wat to put inside the tap function???i want to implement watchdog and in dat i want all nodes to be in promiscous mode...plz tell me d code wat to write in tap method???
ReplyDeletewhile installing watchdog in ns2.i m having this error...please help me
ReplyDeleteaodv/aodv.cc: In member function ‘virtual void LocalRepairTimer::handle(Event*)’:
aodv/aodv.cc:246:80: error: overloaded function with no contextual type information
make: *** [aodv/aodv.o] Error 1
replace that fucntion from ur own LocalRepairTimer function in original aodv.cc...i was also getting d same error which resolved by this method only
Deletei have successfully detected the malicious node with help of watchdog..but how to avoid that malicious node from the route???
ReplyDeleteDeepika can you please tell me how to implement watchdog mechanism and what code to write in tap function. I want all the nodes to be in promiscous modde and monitoring the next neighbour pleease help me
DeleteThis comment has been removed by the author.
Deletehi deepika, can you please tell me how do you detect malicious node for that what code you are using in aodv protocol.if possible pls send me the code for detecting malicious node(black hole node),,I realy needed it....Thanks in advance
Deletemy eid is krish05051990@gmail.com...
hi deepika,
Deletedo you have the code for pathrater, if you have please mail it to vensu108@gmail.com
thankyou
hi, could anyone please sent me the code of watchdog. I already install watchdog in ns2. But I did'nt know how to detect malicious node using watchdog. Please help me to solve this
Deletewhether the given code will run in fedora??
ReplyDeleteYa! you need to add this code, configure and make.
DeleteSir,
ReplyDeleteAmong 10 nodes, only few nodes want to act as in promiscuous mode(eg:4,7,9 nodes).. can you tell me the coding sir.{id:(shanthicse@rediffmail.com)}.. i am waiting for your reply sir..it is very urgent.
How to collect information from all the nodes in the network in order to calculate the mean of the information.Is it possible by using the promiscuous mode in AODV
ReplyDeleteSir I am implementing the grayhole attack in manet, In that whenever the source sends the data packets I want all the nodes to be in promiscous mode to overhear the next node. please tell me what code to do in tap function.
ReplyDeleteSir can u describe the code in tap function to get the packet received and forwarded by each neighbor node
ReplyDeleteSir, can you please give the code of tap() function ?
ReplyDeleteThanks in advance.
Can u please mail me code of aodv modified with watchdog in ns2
ReplyDeleteSo it'll be a great help from U...
thx
Sir,
ReplyDeleteCan anyone tell how to monitor or use flow and queue monitor for wireless networks.
I am working in ADHOC networks aodv protocol
please mail me to
mohanmecse2010@gmail.com
I want to put only one node in promiscuous mode is it possible?
ReplyDeleteIf yes then how?
please help me sir, Thank you in advance
hello sir..my final year project title is to develop sniffing detection in MANET...it is possible?? if possible, how could i do it? using NS2?? thank you..
ReplyDeleteDrop me a detailed mail about your project.
Deletehi, i had a very basic doubt. please reply for this ( even though it might sound silly)
ReplyDeleteif i am using promiscuous mode to overhear other packets say the RREP packet, can the overheard RREP packet make its way into the network layer or just the mac layer( since the tap agent is added in mac).
i feel it will be completely received. please clear my doubt asap, i need to be clear with this concpt
Yes! All packets will be received irrespective of promiscuous mode.
ReplyDeletepromicious mode is not working could you give the ns-mobilenode.tcl file so i need tcl file
ReplyDeletehi durgesh thanks for the reply. i was working on promiscuous mode in my work.
ReplyDeleteIn that work, an intermediate node which happens to overhear a RREP will delete the reverse route to the RREP's next hop( next hop info is present in the rrep header).
My question is:
The overheard pkt will reach the n/w layer. In n/w layer, the destination ip addr does not match node's ip address. Now can the info related to RREP pkt be decoded inspite of the fact that the address match is not taking place at routing layer. ( I need the RREP pkt info to be decoded because i want the "type field" value in RREP pkt to ensure that the overheard pkt is RREP indeed and then make use of the ip header info to delete the reverse route to the RREP's next hop).
corrected version of above question:
ReplyDeletehi durgesh thanks for the reply. i was working on promiscuous mode in my work.
In that work, an intermediate node which happens to overhear a RREP will delete the reverse route to the RREP's next hop( next hop info is present in the rrep's ip header).
My question is:
The overheard pkt will reach the n/w layer. In n/w layer, the destination ip addr does not match node's ip address. Now can the info related to RREP pkt be decoded inspite of the fact that the address match is not taking place at routing layer. ( I need the RREP pkt info to be decoded because i want the "type field" value in RREP pkt to ensure that the overheard pkt is RREP indeed and then make use of the ip header info to delete the reverse route to the RREP's next hop).
kindly reply asap
struct hdr_cmn* hdcmn = HDR_CMN(p);
Deleteif (hdcmn->ptype_ == PT_AODV) {
//Your code if packet is AODV there you can check for RREP packet
}
sir, i have completed the code myself and is working fine, i only need a conceptual clarification, a second opinion from ur side:
Deletesee, after overhearing, the RREP pkt will enter the network layer via mac layer. In the network layer, the destination ip addr will not match the node's ip. so, can the node be allowed to read the "type field" information in RREP pkt even if the ip addr match does not take place. I believe it can read because RREP is a routing control packet (i.e, routing layer data) and RREP is manufactured in network layer.(am i right?) and then we can make use of the ip header info to delete the reverse route.
whats ur opinion on this ?
DeleteThis comment has been removed by the author.
ReplyDeletewhats ur opinion on the above 2 comments of mine(my recent replies to your reply, in which u have posted sample code for my work)
ReplyDeletehi i guess i figured it out myself, yes its possible. thankyou for your help
ReplyDeleteHello friends, please help me out from these questions and confusion...
ReplyDelete1. can I alter the data flowing in ns2, or can intermediate node compromise the integrity of the message, without the knowledge of sender and receiver.
2. can I generate exact 64 bit key or 80 bit key, using diffie hellman key generation algorithm.
3. which layer is better for encryption ??
4. if i will use, network layer for encrypting the packet.. will IP address also be encrypted... i mean header of IP address will also be encrypted..
I urgently need solution to above queries.. please reply ASAP
Suppose in a network, nodes A, B, C and D are present . Node A broadcasts a packet . Let B and C be within the range of A. So, both B and C will receive the packet . Let D be in the transmission range of B but not of node A. So, can D hear this broadcasted packet? and use the information of that packet.
ReplyDeleteI ask this question because node D is not in the range of A, so can D receive that packet inspite of low power levels ( power level will be low since D is out of range of node A and hence probably i think it cant receive it)
kindly reply sir, i need only this one answer now
ReplyDeleteNo, node D cannot listen packet broadcast by node A. I hope you would have got your answer. If not then mail me on durgeshpkshirsagar@gmail.com
DeleteHello sir .. I use Black Hole through a special independent protocol called Black Hole protocol, and works well with the AODV Protocol, when i using the Tap function within the AODV protocol , I can not control or access to a Black Hole.
ReplyDeleteonly i can access to AODV nodes.
How can I access to the Black Hole nodes through AODV protocol ?? Knowing that separate Protocols.
I hope to help me PLZ
Thanks in advance
hi sir i am dharman v currently doing my project on Detection of gray hole attack its only for aodv.cc,aodv.h ....i can add malicious node in aodv.cc and aodv.h
ReplyDeleteand i try to make camnd use i get make****.no target to specified make..
make clean
make
make depend
make install
above mention the line give my terminal i get only for error...
./configure i will run means its working ...what is t6he that problem sir ...after that i give ns % get percetage symbols sir its sucessfully ns2 is installed my machine....
its very urget for my project pls help me i am struck this step
and lot of forum i will say sir but no use nobody say the answer sir ...pls help
ReplyDeletemy mail id is vdharmanv@gmail.com pls say this mail id sir pls..
ReplyDeleteSir, can u please explain me how using this tap() node over hear communication of neighbor node ...means the logic of this code
ReplyDeletehello sir,how could i calculate number of route request ,number of RREP forwarded, number of RREQ forwarded and number of Data packets dropped by each node and number of cbr packets? in tap method coding.plz send me some help for code.
ReplyDeletepls mail me to sachi20shah@gmail.com
Thank you
Can i get the code for detection of blackhole node(malicious node) in MANET using AODV protocol. Thank you in advance.
ReplyDeletewhat i should do after these changes made???
ReplyDeletesir i want to drop or loss RERR message in aodv routing protocol i am using ns2 can u please help me in to write tcl script for this....please
ReplyDeletehi sir
ReplyDeletewould you pleas help me about trust AODV.
Im going to calculate and Detecting packet Forwards and Drops and calculate trustvalue and then define Malicious and faulty nodes and then bared them from the network.
i found below address for this issue but i dont know how can i use it.
hi sir
ReplyDeletewould you pleas help me about trust AODV.
Im going to calculate and Detecting packet Forwards and Drops and calculate trustvalue and then define Malicious and faulty nodes and then bared them from the network.
i found below address for this issue but i dont know how can i use it.
http://www.dcs.warwick.ac.uk/~adhoc1/trustaodv.html#precision
pleas help me
Thank you very much
hi can heple pleas get code for Detecting Selfish Nodes in MANETs
ReplyDeleteHi sir. Is already existing Bayesian watchdog will work correctly?
ReplyDeletehello ,
ReplyDeleteplease, somebody can help me with promicuos code in ns2 with aod. to get the number of packet send , receive by nodes. thanks