What is Aodv Routing Protocol in Ns2

Through this article, our technical professionals have highlighted the most significant keynotes about the Aodv routing protocol in network simulator 2.

Aodv Routing Protocol in Ns2

Ad hoc on demand distance vector (AODV) protocol in Ns2 is defined as the routing protocol for ad hoc mobile networks along with large number of mobile nodes.

  • C++ code to handle Aodv route request

struct hdr_ip *ih = HDR_IP(p);

struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);

aodv_rt_entry *rt;

  • C++ code to detect the neighbor using Aodv


aodv_rt_entry::nb_lookup(nsaddr_t id)


AODV_Neighbor *nb = rt_nblist.lh_first;

 for(; nb; nb = nb->nb_link.le_next) {

   if(nb->nb_addr == id)



 return nb;


  • TCL code to define the Aodv protocol object

set val(ifq)      Queue/DropTail/PriQueue

set val(ifqlen)             50

set val(netif)  Phy/WirelessPhy

set val(mac)                Mac/802_11

set val(rp)       AODV

Run Aodv Routing Protocol in Ns2

To run the Aodv routing protocol in Ns2, we have to implement the following commands.

cd /home/research/Desktop/NS2_simulation

sudo ./ns Scenario-2.tcl

Run Aodv Routing Protocol in Ns2

As an additional note, we have highlighted the result which is acquired through implementing the Ns2 simulation result using Adov.

Result of Ns2 Simulation Using Aodv

The research scholars can reach us at any time to acquire lots about running Aodv routing protocol in Ns2.