Search This Blog

Monday 30 December 2013

How can i monitor my neighbor nodes in aodv (Promiscuous mode in aodv) ?


            >  Using tap function we can  monitor the neighbor nodes transmission.

            >  If a node forwards a packet then tap function will be called for all of its neighbors. Using this functionality we can easily find out packet drop.

            >  tap function can be found in mac.h, dsragent.h, dsragent.cc.

       
 Steps :

            >   We need to modify 3 files
                        i)  aodv.h
                        ii) aodv.cc
                        iii) ns-mobilenode.tcl ( can be found under ns-2.35/tcl/lib )

            >   In  aodv.h

                       i) Include the header file
                               #include <mac.h>
                       ii)
                           /*
                           The Routing Agent
                          */
                         class AODV: public Tap, public Agent
                        {
                          .......
                          public:
                                ........
                                void tap(const Packet *p); 
                                ........
                          protected:
                              Mac *mac_;
                                .........
                         }


            >   In aodv.cc,

                   int AODV::command(int argc, const char* const * argv )
                   {
                         .......
                        elseif( 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;
                        }
                       }
                       return Agent::command(argc, argv);
                    }
    
                     void AODV::tap(const Packet *p)
                    {
                           // Write your own code here
                    }


         >  In ns-mobilenode.tcl,

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

For more explanation visit :  http://durgeshkshirsagar.blogspot.in/2012/07/how-to-use-promiscuous-mode-in-aodv-ns2.html               
                      

23 comments:

  1. Sir,
    what code have to write in void AODV::tap(const Packet *p) to monitor two nodes by one node?

    ReplyDelete
  2. It depends. @Deepa, first of all, if you want to monitor another node then it should be in your transmission range. if you only want a node to monitor every other node, then you should write code like that using node id(i.e index)
    // let's say you are counting the no of packets dropped by node 2, which lies transmission range of node 10. For that, you need to modify two function i) forward fn ii) tap fn. In forward fn, node 10 should increase the count on node 2 by 1. In tap fn, node 10 should decrease the count on node 2 by one. If tap fn called then no drop, else the drop count will be one. like this, you need to develop your code to monitor your neighbor nodes.

    ReplyDelete
  3. Hello Sir

    how to find malicious node in a network

    ReplyDelete
  4. Replies
    1. @Saravanan Zoro, there are several ways to find a malicious node in a network. The popular one is based on trust value. Using trust also, we have several way. For more info study ieee, acm, sciencedirect papers.

      Delete
    2. how IDS will detect malicious node in heterogeneous wireless sensor network?

      Delete
  5. hello sir i need some help to crate TORA protocols what change i do in .cc,.h and packet.h file (plese reply)

    ReplyDelete
    Replies
    1. @Rishi, i barely know about TORA. Read more papers(journals) about TORA and refer this link for, how to create a new protocol http://elmurod.net/en/index.php/archives/157 . hope, it helps.

      Delete
  6. I am working in NS2 ADHOC networks .I want to find link to link bandwidth utilization of wireless nodes.How it is possible.
    How flow monitor and queue monitor can be used to measure the flow and queue status for wireless networks.
    I need your expert advice.i hope I will get a positive replay from you

    ReplyDelete
  7. I am working in NS2 ADHOC networks .I want to find link to link bandwidth utilization of wireless nodes.How it is possible.
    How flow monitor and queue monitor can be used to measure the flow and queue status for wireless networks.
    I need your expert advice.i hope I will get a positive replay from you

    ReplyDelete
    Replies
    1. @mohan, i wish, i could help but i am no expert in that area. Refer this post. i hope, you will find an answer soon. keep trying... http://karthicksivakrr.blogspot.in/2014/04/list-of-useful-blogs-for-ns2.html

      Delete
  8. Hi,
    Please help me in this. After all node set as promiscuous mode, node 1 wants to monitor its neighbor nodes {2,3,4} whether they are forwarding its (node1)packets or not. For this, how to write code in tap( ) function?

    ReplyDelete
    Replies
    1. @menaka, there are many ways , we can do that. Here is a way, in forward function, before forwarding, say node 2 forwards, node 1 should increase the count of no of packets fwded by node 2 and in tab fun node 1 should decrease the count of no of packets fwded by node 2. If the count greater than zero or some threshold, you may want to include something for congestion then pkt drop happened. hope it helps.

      Delete
  9. Greetings !!

    i want to know neighbor list of every node.could u guide me..

    ReplyDelete
  10. @Sakthi, In AODV, by sending hello messages every node updates its neighbour list. Start with sending hello messages. Hope it helps.

    ReplyDelete
  11. Hi , I dont know why I got error after compiling the aodv files could you please put your aodv.cc in complete changes as I the error may be I forgot bractes

    ReplyDelete
  12. can you post the error @Reem kadi ?

    ReplyDelete
  13. how can a neighbor node can monitor a node that either it is sending the data packet to its next intermediate node in the route or to the destination.for this how the "tap" function should be implemented or what sort of changes should be done in this function to monitor the neighboring nodes.remember that this work is going on in AODV.kindly help us in this matter.thanks.

    ReplyDelete
    Replies
    1. @Naveed, it follows the route. In general, if a node has dest node as neighbour node then it directly forwards the packet, otherwise it uses the intermediate node. Implementation of tab function is based on what you want by monitoring. In general, for packet drop calc you can inc the count in forward fun and decrease it in tab. Hope this helps. If you need more about tab fun do some digging in the code.

      Delete
  14. I am working on the comparison of Black hole detection detection techniques in DSR protocol like Trap Header, Baited Black hole DSR and Enhanced DBA-DSR. For this purpose I need source codes of these techniques. kindly help me in this regards, Thanks.

    ReplyDelete
  15. @Tayyab, no one going to provides code for your requirement. You gotta connect all the dots and codes from various blogs as per your requirement.

    ReplyDelete
  16. hi sir, i would like to know how to create a tree topology with shortest distance between the nodes in ns2.. will be greatful if i get the code or the procedure.. thanks in advance..

    ReplyDelete
  17. hi sir, i would like to know how to create a tree topology with shortest distance between the nodes in ns2... will be greatful if i get the code or the procedure.. thanks in advance..

    ReplyDelete

Thanks & Regrds,
Karthick SIva