. .
.
.
.

# Objectives

After completing this experiment you will be able to:

• Understand about the basics of Mobile and Adhoc network, various standards and different routing protocols including proactive and reactive
• Identifying and Simulating the MANET protocols using AODV and DSR with the network simulator NS2
• Analyze the trace file and they can check the entire time duration of the simulation

## Time Required

Around 3.00 hours

In Latin, adhoc means "for this", further meaning "for this purpose only". Adhoc networks are temporary network, setup anywhere without any need of external infrastructure like wires or base stations.

MANET is a self-configuring network of mobile devices connected by wireless links. Each devices moves indepedently in any direction. Each node acts as a router.Some devices will detach from some devices in that area and attached or make link with other devices.'

A typical MANET is shown in the figure-01 below

## Routing

Routing is selecting a path or route in a network for forwarding packets. The objective of routing packets in a network is to determine the best possible path in terms of minimizing the number of hops (path length), delay, packet loss, cost etc.

## Routing in MANET

MANETs are formed dynamically by collecting arbitrary wireless mobile nodes, without use of existing network infrastructure. So routing in MANET is different from traditional routing. In MANET each node acts as both host and router. The nodes transmit and receive their own packets. The nodes also take part in forwarding packets for other nodes. Therefore MANET provides limited physical security as compared to the traditional network.

## Routing protocols for MANET

Routing protocols for a MANET can be classified as:

Proactive (table-driven) : DSDV, OLSR etc.

Reactive (on-demand): AODV, DSR etc.

Hybrid: ZRP

Proactive routing protocols determine path in advance and periodically exchange routing data to maintain the path. Reactive routing protocols, on the other hand, determine a route to some destination node only when it is required to send some data to that node. If at any time a path fails, an alternative path is determined again. Hybrid routing takes the advantages of both table driven and on-demand algorithms.

## Destination-Sequenced Distance-Vector(DSDV) algorithm:

The procedure for DSDV [1] is :

1. Each mobile node maintains a routing table with an entry of routing information from all its neighbors.
2. Each routing information in a routing table specifies
3.

a)the destination identifier

b)the next hop on the route to the destination

c)the distance(in terms of hops) to the destination

d)a sequence number by monotonically increasing each time the node sends an update message to its neighbors. A route will be replaced only when the destination sequence number is less than the new one or two routes have the same sequence number but one has a lower metric.

4. After generating a new routing table, each node broadcasts this table to all its neighbors.
5. Based on the recieved tables, each mobile node update thier tables, until routing information is stable.

## Dynamic source routing (DSR)

The DSR [v] protocol is composed of two mechanisms that work together to allow the discovery and maintenance of source routes in the ad hoc network:

1.Route Discovery: Route discovery is used only when source wants to send a packet to destination and does not know a route to destination.A mobile node A wants to send a packet to a destination node B, then obtain a source route to B.

2.Route Maintenance : Route Maintenance is the mechanism by which a source node A is able to detect, while using a source route to B. If the network topology has changed and the route is broken then the source route attempts to use any other route to destination if it exist or can invoke route discovery again to find a new route. Route Maintenance is used only when source is actually sending packets to destination.

Both Route Discovery and Route Maintenance each operate entirely on demand. When the destination node is reached, it returns a reply containing the route to the source node. The reply then travels in the reverse direction of the discovered route or on a path already known by the destination, to the source. The source node, on receiving the reply, will place the route in its route cache.

## Application of MANET

The applications of MANET are:[iv]

- Military or police exercises.

- Disaster relief operations.

- Mine site operations.

- Robot data acquisition. etc.

The following are the advantages of MANETs:[iv]

-These networks can be set up at any place and time.

-These networks work without any pre-existing infrastructure.

Some of the disadvantages of MANETs are:[iv]

-Limited resources.

-Limited physical security.

-Intrinsic mutual trust vulnerable to attacks.

-Lack of authorization facilities.

-Volatile network topology makes it hard to detect malicious nodes.

-Security protocols for wired networks cannot work for ad hoc networks.

## Simulating a MANET using Network Simulator 2

The Network Simulator simulate following steps for MANET:

1. The command required to configure mobile a node :
2.

-macType \$val(mac) #MAC type
-ifqType \$val(ifq) #interface queue type
-ifqLen \$val(ifqlen) #interface queue length
-antType \$val(ant) #antenna type
-propType \$val(prop) #propagation model
-phyType \$val(netif) #network interface type
-topoInstance \$topo #topography instance
-agentTrace ON #tracing at agent level
-routerTrace ON #tracing at router level
-macTrace ON #tracing at mac level
-movementTrace ON #mobile node movement
-channel \$chan_1_

The four last option in node configuration can either be ON or OFF based on the condition of the mobile nodes. The agent trace will give the trace of TCP, routerTrace provides tracing of packets used in routing, macTrace is used to trace MAC protocol packets and movementTrace is used to allow tracing the motion of nodes for nam.

3. Create some mobile nodes and assign them to the channels:
4.

for {set i 0} {$\inline&space;i <$val(nn)} {incr i} {
set node_($\inline&space;i) [$ns_ node]
$\inline&space;node_($i) random-motion 0;
}

5. Assigning mobility to the node.
6. Specifying routing protocols.
7. set val(rp) AODV; #for AODV
set val(rp) DSR; #for DSR

Cite this Simulator:

.....
..... .....