Skip to main content

Posts

Showing posts from February, 2014

MANET Routing Protocols using ns3

#AODV #OLSR #MANETs #DSDV #DSR

Download the Code here: 
https://drive.google.com/open?id=1OkVOsifjN9UfQjPGvfR7OuS-x_GBRgCV

Check the Video for Detailed instruction and how to use the plots, graphs and source code.


Comparison of MANET routing Protocols 1. AODV
2. DSDV
3. DSR
4. OLSR
using NS3 (Network Simulator 3)
B.Tech, M.Tech, PhD...
1. Reactive Vs Proactive routing
2. PErformance comparison of MANET protocols
3. AODV Vs DSDV Comparison

https://www.nsnam.com and also at my channel.

What Version: ns-3.29
My Ubunut OS is: Ubuntu 18.04

This file we are going to use for our simulation:
/home/networks/ns-allinone-3.29/ns-3.29/examples/routing/manet-routing-compare.cc

Once you under stand the code, now lets run this example

Step 1: Copy the above file in to ~ns-3.29/scratch/ folder

Step 2: Understand this code.
Step 3: Run this code
Open the terminal, Go to ns-3.29 and run the following command

$] ./waf --run scratch/manet-routing-compare

enable the following header file

#include "ns3/flo…

Adding a malicious node in NS2 in AODV Protocol

Adding a malicious node is ns2 using aodv protocol. The node which is declared as malicious will simply drop the router packet (DROP_RTR_ROUTE_LOOP).

Two files have to be modified.
1. aodv.h
2. aodv.cc

aodv.h file changes
Declare a boolean variable malicious as shown below in the protected scope in the class AODV

bool malicious;

aodv.cc file changes
1. Initialize the malicious varible with a value "false". Declare it inside the constructor as shown below
AODV::AODV(nsaddr_t id):Agent(PT_AODV)...
{
.......
malicious = false;
}

2. Add the following statement to the aodv.cc file in the "if(argc==2)" statment.

if(strcmp(argv[1], "malicious") == 0) {
    malicious = true;
   return TCL_OK;
}

3. Implement the behavior of the malicious node by setting the following code in the rt_resolve(Packet *p) function. The malicious node will simply drop the packet as indicated below.

if(malicious==true)
{
drop(p,DROP_RTR_ROUTE_LOOP);
}

Once done, recompile ns2 as given below
Open …