Post on 23-Feb-2015
Simulation of Routing Protocols in Mobile
Ad-Hoc Networks
Submitted By
Nusrah Kanwal BETL – F05 - 0136
nusrah.kanwal@hamdard.edu
Project Supervisor
Shams Ul Arfeen
FACULTY OF ENGINEERING SCIENCES & TECHNOLOGY
Hamdard Institute of Information Technology
Hamdard University, Main Campus, Karachi, Pakistan.
NOVEMBER 2009
ii
Dedication
This report is dedicated to Shaheed Hakim Mohammad Saeed, my Teachers, my Supervisor, my
Parents, my fellow colleagues and the hard working students of HIIT with a hope that they will
succeed in every aspect of their Academic Career.
iii
Acknowledgement
In the name of Allah, the Most Gracious and the Most Merciful.
Peace and blessings of Allah be upon Prophet Muhammad (SAWW).
First and foremost, praise be to Allah, for giving me this opportunity, the strength and the
patience to complete my dissertation finally, after all the challenges and difficulties. I would like
to thank my supervisor, Shams Ul Arfeen for his highly motivated and most significant
contribution in this project. I would also like to thank my parents for financial and moral support
and also my friends who have helped and motivated me throughout.
May Allah reward them all abundantly.
Nusrah Kanwal
BETL – F05 – 0136
iv
Certificate
This is to certify that Ms. Nusrah Kanwal, D/O Syed Muhammad Farooq, BETL/F05/0136
have successfully completed her final year project. This project, “Simulation of Routing
Protocols in Mobile Ad-Hoc Networks” was assigned to her, to fulfill the partial requirement
for the bachelor degree of Telecommunication Engineering.
(Shams Ul Arfeen)
Project Supervisor
(Rashid Hussain)
Member
Project Committee
(Ahmed Sikandar)
Member
Project Committee
(Fahad Azim)
Deputy Director, HIIT
(Dr. Iqbal Ahmed Khan)
Director, HIIT
v
Table of Contents
Dedication ................................................................................................................................. ii
Acknowledgement ................................................................................................................... iii
Certificate ................................................................................................................................ iv
Table of Contents ..................................................................................................................... v
List of Tables ......................................................................................................................... viii
List of Figures .......................................................................................................................... ix
List of Graphs ........................................................................................................................... x
Abbreviations .......................................................................................................................... xi
Abstract ................................................................................................................................. xiii
1. Introduction to MANET ................................................................................................... 1
1.1. Background................................................................................................................. 1
1.2. Classification of Ad hoc Networks .............................................................................. 1
1.2.1. Infrastructure based wireless networks.............................................................................. 1
1.2.2. Ad hoc wireless networks(infrastructure less) ................................................................... 2
1.3. Overview of MANETs ................................................................................................ 2
1.4. Issues in MANET ....................................................................................................... 3
1.5. Aims and Objectives ................................................................................................... 4
1.6. Thesis structure ........................................................................................................... 4
2. Mobile Ad hoc Routing Protocols ..................................................................................... 5
2.1. MANET Routing Overview ........................................................................................ 5
2.2. Classification of Routing Protocols ............................................................................. 6
2.2.1. Proactive Routing Protocols ............................................................................................. 6
2.2.2. Reactive Routing Protocols .............................................................................................. 7
2.2.3. Hybrid Routing Protocols ................................................................................................. 7
2.3. Analysis of MANET Routing Protocols ...................................................................... 7
2.3.1. Ad hoc On-demand Distance Vector Routing (AODV) ..................................................... 8
2.3.1.1. Description .................................................................................................... 8
2.3.1.1.1. Route table management............................................................................. 9
2.3.1.1.2. Route discovery ........................................................................................ 9 2.3.1.1.3. Route Maintenance ................................................................................. 10
vi
2.3.1.2. Properties .................................................................................................... 10
2.3.2. Destination Sequenced Distance Vector Routing (DSDV) .............................................. 10
2.3.2.1. Description .................................................................................................. 10
2.3.2.2. Properties .................................................................................................... 12
2.3.3. Dynamic Source Routing (DSR) ..................................................................................... 12
2.3.3.1. Description .................................................................................................. 12
2.3.3.1.1. Route Discovery ..................................................................................... 13
2.3.3.1.2. Route Maintenance ................................................................................. 14 2.3.3.2. Properties .................................................................................................... 14
2.3.4. Temporarily Ordered Routing Algorithm (TORA) .......................................................... 15
2.3.4.1. Description .................................................................................................. 15
2.3.4.2. Properties .................................................................................................... 17
2.4. Comparison............................................................................................................... 17
3. Simulation Environment ................................................................................................. 19
3.1. Network Simulators Overview .................................................................................. 19
3.1.1. Network Simulator-2 ...................................................................................................... 20
3.1.2. GloMoSim ..................................................................................................................... 20
3.1.3. QualNet ......................................................................................................................... 21
3.1.4. OPNET .......................................................................................................................... 21
3.2. Choice of Simulator .................................................................................................. 22
3.2.1. NS-2 Working Flow ....................................................................................................... 23
3.2.1.1. Network Animator ........................................................................................ 23
3.2.1.2. Tool Command Language ............................................................................ 24
3.2.1.3. Trace File Format ........................................................................................ 27
3.2.1.4. AWK Script .................................................................................................. 28
4. Performance Analysis ..................................................................................................... 31
4.1. Simulation Parameters .............................................................................................. 31
4.2. Performance Analysis Factors ................................................................................... 32
4.3. Simulation Results .................................................................................................... 32
4.3.1. End to End Delay ........................................................................................................... 33
4.3.2. Normalized Routing Load .............................................................................................. 35
4.3.3. Packet Loss Ratio ........................................................................................................... 37
4.3.4. Routing Overhead .......................................................................................................... 39
4.3.5. Packet Delivery Fraction (PDF) ...................................................................................... 41
vii
5. Conclusion ....................................................................................................................... 43
5.1. Summary .................................................................................................................. 43
5.2. Future Work.............................................................................................................. 44
6. References ........................................................................................................................ 45
7. Appendix A ...................................................................................................................... 47
7.1. Installation Process of Linux ..................................................................................... 47
7.1.1. Introduction to VMware Workstation ............................................................................. 47
7.1.2. Creating new Virtual Machine ........................................................................................ 47
7.1.3. Installing VM Tools ....................................................................................................... 52
7.2. Installation Process of Network Simulator ................................................................. 53
7.2.1. Getting NS-2 .................................................................................................................. 53
7.2.2. Steps for Installation....................................................................................................... 53
8. Appendix B ...................................................................................................................... 55
8.1. AWK Program Used ................................................................................................. 55
viii
List of Tables
Table 1: DSDV Routing Table ................................................................................................. 11 Table 2: DSDV Routing Table ................................................................................................. 11
Table 3: Comparison of MANET Routing Protocols ................................................................. 17 Table 4: Simulation Parameters ................................................................................................ 31
Table 5: Simulation Results: End to End Delay ........................................................................ 33 Table 6: Simulation Results: Normalized Routing Load ........................................................... 35
Table 7: Simulation Results: Packet Loss Ratio ........................................................................ 37 Table 8: Simulation Results: Routing Overhead........................................................................ 39
Table 9: Simulation Results: Packet Delivery Fraction ............................................................. 41 Table 10: Comparison of MANET Routing Protocols (on the basis of results) .......................... 43
ix
List of Figures
Figure 1: MANET ...................................................................................................................... 2
Figure 2: Ad hoc On-demand Distance Vector Routing Protocol ................................................ 8 Figure 3: Destination Sequenced Distance Vector..................................................................... 11
Figure 4: Destination Sequenced Distance Vector..................................................................... 11 Figure 5: Dynamic Source Routing Protocol ............................................................................. 14
Figure 6: Temporarily Ordered Routing Algorithm ................................................................... 16 Figure 7: Simulators Utilization Trend...................................................................................... 19
Figure 8: NS-2 Working Flow .................................................................................................. 23 Figure 9: Screen Shot of Network Animator ............................................................................. 24
Figure 10: Old Wireless Trace File Format ............................................................................... 27 Figure 11: Screen Shot of VMware Workstation....................................................................... 47
Figure 12: Screen shot of New Virtual Machine Icon................................................................ 47 Figure 13: Screen Shot of New Virtual Machine Wizard 1........................................................ 48
Figure 14: Screen Shot of New Virtual Machine Wizard 2........................................................ 48 Figure 15: Screen Shot of CentOS Installation 1 ....................................................................... 49
Figure 16: Screen Shot of CentOS Installation 2 ....................................................................... 49 Figure 17: Screen Shot of CentOS Installation 3 ....................................................................... 50
Figure 18: Screen Shot of CentOS Installation 4 ....................................................................... 50 Figure 19: Screen Shot of CentOS Installation 5 ....................................................................... 50
Figure 20: Screen Shot of CentOS Installation 6 ....................................................................... 50 Figure 21: Screen Shot of CentOS Installation 7 ....................................................................... 51
Figure 22: Screen Shot of CentOS Installation 8 ....................................................................... 52 Figure 23: Screen Shot of CentOS Installation 9 ....................................................................... 52
Figure 24: Screen Shot of VM Tools Installation ...................................................................... 52 Figure 25: Screen Shot of VM Tools Icon................................................................................. 53
x
List of Graphs
Graph 1: End to End Delay [2 m/s] ........................................................................................... 34
Graph 2: End to End Delay [15 m/s] ......................................................................................... 34 Graph 3: End to End Delay [30 m/s] ......................................................................................... 34
Graph 4: End to End Delay [45 m/s] ......................................................................................... 34 Graph 5: Normalized Routing Load [2 m/s] .............................................................................. 36
Graph 6: Normalized Routing Load [15 m/s] ............................................................................ 36 Graph 7: Normalized Routing Load [30 m/s] ............................................................................ 36
Graph 8: Normalized Routing Load [45 m/s] ............................................................................ 36 Graph 9: Packet Loss Ratio [2 m/s] .......................................................................................... 38
Graph 10: Packet Loss Ratio [15 m/s] ....................................................................................... 38 Graph 11: Packet Loss Ratio [30 m/s] ....................................................................................... 38
Graph 12: Packet Loss Ratio [45 m/s] ....................................................................................... 38 Graph 13: Routing Overhead [2 m/s] ........................................................................................ 40
Graph 14: Routing Overhead [15 m/s] ...................................................................................... 40 Graph 15: Routing Overhead [30 m/s] ...................................................................................... 40
Graph 16: Routing Overhead [45 m/s] ...................................................................................... 40 Graph 17: Packet Delivery Fraction [2 m/s] .............................................................................. 42
Graph 18: Packet Delivery Fraction [15 m/s] ............................................................................ 42 Graph 19: Packet Delivery Fraction [30 m/s] ............................................................................ 42
Graph 20: Packet Delivery Fraction [45 m/s] ............................................................................ 42
xi
Abbreviations
AGT AGenT
AODV Ad hoc On-demand Distance Vector
AWK Aho Weinberger and Kernighan
BRP Bordercast Resolution Protocol
CBR Constant Bit Rate
CLR Clear
CMU Carngie Mellon University
DAG Directed Acyclic Graph
DSDV Destination Sequenced Distance Vector
DSR Dynamic Source Routing
DYMO Dynamic MANET On-demand
FAQ Frequently Asked Questions
GloMoSim Global Mobile information systems Simulation library
IARP IntrAzone Routing Protocol
IERP IntErzone Routing Protocol
IMEP Internet MANET Encapsulation Protocol
IP Internet IP
LAR Location Aided Routing
MAC Media Access Protocol
MANET Mobile Ad hoc NETworks
NAM Network Animator
NS Network Simulator
ODMRP On-Demand Multicast Routing Protocol
OLSR Optimized Link State Routing
OPNET Operations Network
OPSF Open Shortest Path First
OS Operation System
xii
PDF Packet Delivery Fraction
RREP Route REPly
RREQ Route REQuest
RTR RouTeR
SNT Scalable Network Technologies
STAR Source-Tree Adaptive Routing protocol
Tcl/Tk Tool Command Language
TCP Transmission Control Protocol
TORA Temporarily Ordered Routing Algorithm
UPD Update
QoS Quality of Service
QRY Query
VMware Virtual Machine ware
WRP Wireless Routing Protocol
ZRP Zone Routing Protocol
xiii
Abstract
A MANET is a collection of wireless mobile nodes dynamically forming a temporary
network without the use of any existing network infrastructure or centralized administration. Due
to the limited transmission range of a node, data is forwarded using multi-hops so that one node
can be able to exchange data with another node across the network.
A variety of new routing protocols targeted specifically at this environment have been
developed. This thesis presents the results of a detailed packet-level simulation comparing four
prominent MANET routing protocols: Ad hoc On-demand Distance Vector Routing (AODV),
Destination Sequenced Distance Vector Routing (DSDV), Dynamic Source Routing (DSR) and
Temporarily Ordered Routing Algorithm (TORA).
The comparison has been done on the basis of End to End Delay, Normalized Routing Load,
Packet Loss Ratio, Routing Overhead and Packet Delivery Fraction (PDF) by varying the
maximum speed and pause time.
The results reveal that DSDV shows a poor result as compared to AODV and DSR with
respect to packet delivery fraction. Also that DSDV will perform better in case of higher traffic
load, whereas, AODV and DSR will experience an increased overhead. DSDV is a proactive
routing protocol, and so, due to stale information, its performance is indirectly proportional to
mobility. It is also concluded that DSR is not very suitable for real-time traffic.
1
1. Introduction to MANET
1.1. Background
The next generation of wireless communication systems, needs a rapid deployment of
independent mobile users. Major examples include establishing survivable, efficient, dynamic
communication for emergency/rescue operations, disaster relief efforts, and military networks.
Such network scenarios cannot depend on centralized and organized connectivity, and can be
conceived as applications of MANETs. A MANET is an independent collection of mobile nodes
that communicate over comparatively bandwidth constrained wireless links. Since the nodes are
mobile, the network topology may change quickly and unpredictably over time. The network is
decentralized, where all network activity including discovering the topology and delivering
messages must be executed by the nodes themselves, i.e., routing functionality will be integrated
into mobile nodes.
1.2. Classification of Ad hoc Networks
As compared to wired networks, wireless networks have a unique capability of conducting
transmission without any wired links to the nodes. Nodes just have to be in each other‟s
transmission range. There are two categories of wireless networks, infrastructure based wireless
networks and infrastructure less or ad hoc wireless networks.
1.2.1. Infrastructure based wireless networks
Infrastructure networks have fixed network topology. Wireless nodes connect through a
fixed point known as base station or access point. Mostly, the access point or base station is
connected to the main network through a wired link. All of the wireless connections must pass
from the base station. If a node is in the range of several base stations, it will connect to any one
of those stations on the bases of some criteria [1], for example, communication quality or the
content of communication services.
2
1.2.2. Ad hoc wireless networks(infrastructure less)
An ad hoc wireless network is an autonomous system consisting of nodes, which may or
may not be mobile, connected with wireless links and without using pre-existing communication
infrastructure or central authority. Ad hoc networking is expected to play an important role in the
future of wireless mobile networks due to the widespread use of mobile and hand-held devices.
1.3. Overview of MANETs
MANET is a self-configuring network of mobile devices connected by wireless links.
Each device or node in a MANET is free to move by itself in any direction, and will
therefore change its links to other devices frequently. Each node must relay traffic, to another
node within its range, and therefore be a router. The most important challenge in building a
MANET is equipping each device, such that it can continuously maintain the information
required to properly route traffic.
Figure 1: MANET
A MANET can be a standalone network or it can be connected to external networks such as
the Internet.
MANETs are different from the traditional wired networks on the basis of some
characteristics; some of them are discussed below:
Limited bandwidth: Wireless links continue to have significantly lower capacity than their
hardwired counterparts [2]. In addition, the realized throughput of wireless communications,
after accounting for the effects of multiple access, fading, noise, and interference conditions, etc.,
is often much less than a radio‟s maximum transmission rate [2].
3
Dynamic topology: Nodes are free to move arbitrarily; thus, the network topology which is
typically multihop may change randomly and rapidly at unpredictable times, and may consist of
both bidirectional and unidirectional links.
Energy-constrained operation: Some or all of the nodes in a MANET may rely on batteries
or other exhaustible means for their energy. For these nodes, the most important system design
criteria for optimization may be energy conservation.
Limited physical security: Mobile wireless networks are generally more prone to physical
security threats than are fixed-cable networks. The increased possibility of eavesdropping,
spoofing, and denial-of-service attacks should be carefully considered.
Asymmetric Links: All nodes in a MANET do not have the same transmission range, and
therefore the links between them posses‟ asymmetric properties.
1.4. Issues in MANET
Some salient features that affect the design, deployment, and performance of MANET are as
follows:
Routing
Medium access scheme
Multicasting
Transport layer protocol
Pricing scheme
Quality of service provisioning
Self-organization
Security
Energy management
Addressing and service discovery
Scalability
Deployment considerations
4
1.5. Aims and Objectives
The objective for this thesis is to evaluate some of the proposed routing protocols for
MANET, based on performance. Furthermore, the following goals have been focused in the
thesis:
Get a general understanding of MANETs
Generate a simulation environment that could be used for analysis
Analyze some of the proposed routing protocols for MANETs
1.6. Thesis structure
This thesis consists of 6 chapters and two appendices. Chapter 1 enlightens the basic concept
of MANETs and its issues. Chapter 2 describes the different routing protocols. Chapter 3
describes the simulator used. Chapter 4 includes the performance analysis that has been done on
the protocols. Chapter 5 concludes the whole thesis and chapter 6 is the references that have been
used. The appendices contain the installation process of Linux and the simulator along with their
screen shots, the AWK program that has been used and the modified codes for protocols.
5
2. Mobile Ad hoc Routing Protocols
2.1. MANET Routing Overview
Routing is the most important aspect in ad hoc network since ad hoc network topology
frequently changes and multi-hop communication is required.
In MANET, routing is different from other networks and so it has its own protocols for
achieving the task of routing, some of them are invented primarily for MANETs, and some were
adapted from routing protocols in used wired networks. One of the most important targets of
these protocols is that they must be able to work with any topology, because MANET‟s topology
may change at any time.
The most important differences between MANETS and conventional networks with respect
to routing are:
Conventional networks are usually static. This is very different from Ad Hoc networks,
where the topology can be very different at different times and may change rapidly. In
conventional networks, all the routes can be known in advance. Whereas, in MANETs,
this is not always possible due to mobility and it is possible for each node to have the
route to reach all the other nodes.
In the MANETS it is not wise to overflow the routing information through the network.
This is in contrast to conventional networks where bandwidth is not limited.
Therefore it becomes clear that MANET routing protocols need to accomplish some goals
such as the followings:
1. Distributed operation: Conventional networks always worked in a centralized structure;
this does not exist in MANETS. Therefore, routing protocols need to work in a
decentralized network without any hierarchy operations are without structure and
decentralized.
2. Uni-directional links: Ad hoc routing protocols are designed with a wired network in
mind. However, in wired networks, links are assumed to be directional. In ad hoc
networks, this is not the case; differences in wireless networking hardware of nodes or
radio signal fluctuations may cause uni-directional links, which can only be traversed in
one direction.
6
3. Reactive approach: Protocols that follow a reactive approach have to provide the route
only when it is needed by the nodes. The problem related to this is that latency can be high
[3].
4. Proactive approach: With this approach the routing protocol must provide the capability
to create and maintain the routes in the routing tables continuously without introducing
high overhead [3].
2.2. Classification of Routing Protocols
Routing protocols can be classified into these categories depending on their properties
Proactive Routing Protocols
Reactive Routing Protocols
Hybrid Routing Protocols
2.2.1. Proactive Routing Protocols
For all protocols in this category (also called table-driven protocols), the route is already
available when one node wants to send data.
It does not matter that the nodes do not need the route at any particular time; they
continuously look for an available route. Therefore when the route is needed the information is
already available. The time interval at which a route advertisement broadcast is sent is important
because it will be a factor which will decide if the network has a good performance or there will
be higher overhead in the network. The nodes keep the current route information in two ways,
periodically when they do the route discovery and when they discover that any route has changed
even if they are not part of the route.
An advantage of proactive routing protocols is that when the nodes need the route, they
already have the information; hence it provides a very low latency and very good performance.
The problem arises when there is overhead in the network; due to routing packets,
because nodes require the available routes at all times. Routes which are not required are also
maintained. It can be concluded that the overhead is the main disadvantage for proactive routing
protocols [4].
Examples of proactive routing protocols are OLSR [5] or DSDV [6]
7
2.2.2. Reactive Routing Protocols
Reactive routing protocols (also called on-demand protocols) obtain routes only when
needed. When the node needs to send a packet, it will broadcast a route request. The nodes in its
transmission range will receive it and they will broadcast, and so on until some node has a route
to the destination or the route request is received by the destination. The nodes which have the
route to the destination or the destination itself unicasts a route reply towards the source node. In
this kind of protocols the nodes do not try to keep routing information if they do not need it.
An advantage of this approach is the overhead in the network is typically low. Therefore,
nodes save energy, bandwidth and memory. But as a disadvantage, these protocols have higher
route acquisition latency; because when they need a route it first needs to be discovered [4].
Examples of these protocols are AODV [7] or DSR [8].
2.2.3. Hybrid Routing Protocols
Both approaches (reactive and proactive) have advantages and disadvantages depending
on the characteristics of the networks. The hybrid routing protocols have been created to avoid
the disadvantages of the reactive and proactive protocols, but to get the advantages of both at the
same time.
In hybrid approach there are two different zones, the first one where the nodes are near
source node, proactive approach is followed the nodes will maintain the routing tables with the
neighbors within a determinate number of hops. In the other zone, the nodes far from the source,
the approach to get these nodes is reactive. [3].
Example of these protocols is ZRP [10].
2.3. Analysis of MANET Routing Protocols
The protocols that have been analyzed in this thesis are:
Ad hoc On-demand Distance Vector Routing
Destination Sequenced Distance Vector Routing
Dynamic Source Routing
Temporarily Ordered Routing Algorithm
8
2.3.1. Ad hoc On-demand Distance Vector Routing (AODV)
2.3.1.1. Description
The Ad hoc On-Demand Distance Vector(AODV) [7] routing protocol enables multi-
hop routing between participating mobile nodes wishing to establish and maintain an ad-hoc
network.
AODV is based upon the distance vector algorithm. It is a reactive protocol, it only
requests a route when needed and does not require nodes to maintain routes to destinations that
are not actively participating in the communication. As long as the end points of a
communication connection have valid routes to each other, AODV does not play any role.
Features of this protocol include loop freedom and that link breakages cause immediate
notifications to be sent to the affected set of nodes, but only that set. Additionally, AODV has
support for multicast routing and avoids the Bellman Ford "counting to infinity" problem [11].
The use of destination sequence numbers guarantees that a route is "fresh".
The algorithm uses various messages to discover and maintain links. Whenever a node
wants to find a route to another node, it broadcasts a Route Request (RREQ) to all its neighbors. The
RREQ circulates through the network until it reaches the destination or a node with a fresh
enough route to the destination. Then the route is created by unicasting a RREP back to the
source.
Figure 2: Ad hoc On-demand Distance Vector Routing Protocol
The algorithm uses hello messages (a special RREP) that are broadcasted periodically
to the immediate neighbors. If hello messages stop coming from a particular node, the neighbor
can assume that the node has moved away and mark that link to the node as broken and notify the
9
affected set of nodes by sending a link failure notification (a special RREP) to that set of nodes.
2.3.1.1.1. Route table management
AODV needs to keep track of the following information for each route table entry:
Destination IP Address: IP address of the destination node.
Destination Sequence Number: Sequence number of the destination.
Hop Count: Number of hops required to reach the destination.
Next Hop: The neighbor, which has been chosen to forward packets to the
destination for this route entry.
Lifetime: The time for which the route is available.
Active neighbor list: Neighbor nodes that are currently using this route entry.
Request buffer: Makes sure that a request is only used once.
2.3.1.1.2. Route discovery
A node broadcasts a RREQ when it needs a route to a destination and does not
have one already. This can happen if the route to the destination is unknown, or if a previously
valid route expires. After broadcasting a RREQ, the node waits for a RREP. If the reply is not
received within a certain time, the node may rebroadcast the RREQ or assume that there is no
route to the destination.
Forwarding of RREQs is done when the node receiving a RREQ does not
have a route to the destination. Therefore it rebroadcasts a RREQ. The node also creates a
temporary reverse route to the Source IP Address in its routing table with next hop equal to the IP
address field of the neighboring node that sent the broadcast RREQ. This is done to keep track
of a route back to the original node making the request, and might be used for the last RREP to
find its way back to the requesting node. The route is temporary in the sense that it is valid for a
much shorter time, than an actual route entry.
When the RREQ reaches a node that either is the destination node or a node with
a valid route to the destination, a RREP is generated and unicasted back to the requesting node.
While this RREP is forwarded, a route is created to the destination and when the RREP reaches the
source node, there exists a route from the source to the destination.
10
2.3.1.1.3. Route Maintenance
When a node detects that a route to a neighbor no longer is valid, it will eliminate
the routing entry and send a link failure message, a triggered route reply message to the
neighbors that are actively using the route, informing them that this route no longer is
available. For this purpose AODV uses an active neighbor list to monitor the neighbors that are
using a particular route. The nodes that receive this message will repeat this procedure. The
message will finally be received by the affected sources that can chose to either stop sending
data or requesting a new route by sending out a new RREQ.
2.3.1.2. Properties
The advantage with AODV compared to classical routing protocols like distance vector
and link-state is that AODV has very less number of routing messages in the network. This is
because of AODV‟s reactive approach. This advantage pays off when the topology is changing
often.
AODV routes in a more traditional sense as compared to DSR. The advantage with
a more traditional routing protocol in an ad-hoc network is that connections from the ad-hoc
network to a wired network like the Internet is most likely easier.
The sequence numbers that AODV uses represents the freshness of a route and is
increased when something happens in the surrounding area. The sequence numbers prevents
the formation of loops.
AODV only maintains one route for each destination. It uses hello messages at the IP-
level. The hello messages add a large overhead to the protocol.
AODV only supports bi-directional links and not the unidirectional links. When a
node receives a RREQ, it will setup a reverse route to the source by using the node that
forwarded the RREQ as next hop. This means that the route reply, in most cases is unicasted back
the same way as the route request used.
2.3.2. Destination Sequenced Distance Vector Routing (DSDV)
2.3.2.1. Description
DSDV [6] is a hop-by-hop distance vector routing protocol. Each node has a routing
11
table that for all reachable destinations stores the next-hop and number of hops for that
destination. Like distance-vector, DSDV requires each node to periodically broadcast routing
updates. The advantage with DSDV over traditional distance vector protocols is that DSDV
assures loop-freedom.
Figure 3: Destination Sequenced Distance Vector
Table 1: DSDV Routing Table
Figure 4: Destination Sequenced Distance Vector
Table 2: DSDV Routing Table
Dest. Next
Hop
Metric Seq. No
N4 N4 0 S406_N4
N1 N2 2 S128_N1
N2 N2 1 S564_N2
N3 N2 2 S710_N3
N5 N6 2 S392_N5
N6 N6 1 S076_N6
N7 N6 2 S128_N7
N8 N6 3 S050_N8
Dest. Next
Hop
Metric Seq. No
N4 N4 0 S516_N4
N1 N6 3 S238_N1
N2 N2 1 S674_N2
N3 N2 2 S820_N3
N5 N6 2 S502_N5
N6 N6 1 S186_N6
N7 N6 2 S238_N7
N8 N6 3 S160_N8
12
Table 1 shows the routing table of DSDV before N1 changes its position, as N1
changes its position; the entries in the routing table are also changed, and can be seen in table 2.
To assure loop-freedom DSDV uses a sequence numbers to tag each route. The
sequence number represents the freshness of a route and routes with higher sequence numbers
are favorable. If the routes have the same sequence number then the one with a lower hop-count I
considered to be used. The sequence number is increased when a node N4 detects that a route to
a destination N1 has broken. So the next time node N4 advertises its routes, it will advertise the
route to N1 with an infinite hop-count and a sequence number that is larger than before.
DSDV essentially is distance vector with some adjustments to make it better suited
for ad-hoc networks. These adjustments consist of triggered updates that will take care of
topology changes in the time between broadcasts. To reduce the amount of information in these
packets there are two types of update messages defined: full and incremental dump. The full
dump carries all available routing information and the incremental dump only carries the
information that has changed since the last dump.
2.3.2.2. Properties
Because DSDV is dependent on periodic broadcasts it requires some time to converge
before a route can be used. This converge time can probably be considered negligible in a static
wired network, where the topology is not changing so frequently. On the other hand, in an ad-
hoc network, where the topology is very dynamic, this converge time will probably mean a lot of
dropped packets before a suitable route is detected. The periodic broadcasts add a lot of overhead
into the network.
2.3.3. Dynamic Source Routing (DSR)
2.3.3.1. Description
Dynamic Source Routing (DSR) [8] [12] is also a reactive protocol. It allows nodes to
dynamically discover a route across multiple network hops to any destination. Source routing
means that each packet carries the complete ordered list of nodes through which the packet must
pass, in its header. DSR does not use periodic routing messages/router advertisements, and so it
reduces network bandwidth overhead, conserves battery power and avoids large routing updates
throughout the ad-hoc network. DSR relies on support from the MAC layer (the MAC layer
13
should inform the routing protocol about link failures). Route discovery and route maintenance
are the two basic modes of operation in DSR.
2.3.3.1.1. Route Discovery
Route discovery is the mechanism in which a node N1 wishing to send a packet to
N8, obtains the source route to N8. Node N1 requests a route by broadcasting a Route Request
(RREQ) packet. Every node receiving this RREQ searches through its route cache for a route to
the requested destination. DSR stores all known routes in its route cache. If no route is found, it
forwards the RREQ further and adds its own address to the recorded hop sequence. This request
propagates through the network until either the destination or a node with a route to the
destination is reached. When this happens, a Route Reply (RREP) is unicasted back to the
initiator. This RREP packet contains the sequence of network hops through which it may reach
the destination.
In Route Discovery, a node first sends a RREQ with the maximum propagation
limit (hop limit) set to zero, not allowing its neighbors to rebroadcast it. By using just a single
broadcast packet, this method allows a node to query the route caches of all its neighbors.
Nodes can also operate their network interface in promiscuous mode; the interface
address filtering is disabled and causes the network protocol to receive all packets that the
interface overhears. These packets are scanned for useful source routes or route error messages
and then they are discarded.
The route back to the initiator can be retrieved in several ways. The simplest way
is to reverse the hop record in the packet. Though, this assumes symmetrical links. In order to
deal with this, DSR checks the route cache of the replying node. If a route is found, it is used as
an alternative. Another way is to piggyback the reply on a RREQ targeted at the initiator. This
means that DSR can calculate correct routes in the presence of asymmetric (unidirectional) links.
Once a route is found, it is stored in the cache with a time stamp and the route maintenance
begins.
14
Figure 5: Dynamic Source Routing Protocol
2.3.3.1.2. Route Maintenance
Route maintenance is the mechanism by which a packet sender N1 detects if the
network topology has changed, lest the route to the destination N8 can no longer be in use. This
might happen because a host within a source route, moves out of wireless transmission range or
is powered off making the route unusable. A failed link is sensed by either actively monitoring
acknowledgements or passively by running in promiscuous mode, overhearing that a packet is
forwarded by a neighboring node.
When route maintenance senses a problem with a route in use, a route error
packet is sent back to the source node. When this error packet is received, the hop in error is
removed from this hosts route cache, and all routes that contain this hop are shortened at this
point.
2.3.3.2. Properties
DSR has an advantage of source routing. Intermediate nodes do not need to maintain
up-to-date routing information in order to route the packets they relay. There is also no need for
periodic routing advertisement messages, which leads to reduced network bandwidth overhead,
particularly when little or no significant host is moving. Battery power is also conserved on the
mobile hosts, both by not sending the advertisements and by not needing to receive them; a host
could go down to sleep as an alternative.
The key advantage of this protocol is that it learns routes by scanning for information
in packets that are received. A route from N1 to N8 through N2 means that N1 learns the route to
15
N8, but also that it will learn the route to N2. The source route will also mean that N2 learns the
route to N1 and N8 and that N8 learns the route to N1 and N2. This form of active learning
reduces overhead in the network, which is very good.
Each packet carries a slight overhead which contains the source route of the packet.
This overhead increases when the packet has to go through more hops to reach the destination.
So the packets sent will be somewhat bigger, because of the overhead.
Running the interfaces in promiscuous mode can be a serious security issue. As the
address filtering of the interface is turned off and all packets are scanned for information. A
potential intruder could listen to all packets and scan them for useful information such as
passwords and credit card numbers. Applications have to provide the security by encrypting their
data packets before transmission. The routing protocols are prime targets for impersonation
attacks and therefore they must also be encrypted.
2.3.4. Temporarily Ordered Routing Algorithm (TORA)
2.3.4.1. Description
Temporally Ordered Routing Algorithm (TORA) [9] is a distributed routing protocol.
The core algorithm is one in a family referred to as link reversal algorithms. TORA is designed
to minimize the effect of topological changes. A key concept in its design is that control
messages are typically confined to a very small set of nodes. It guarantees that all routes are
loop-free, but temporary loops may form, and typically provides multiple routes for any
source/destination pair. It provides only the routing mechanism and depends on Internet MANET
Encapsulation Protocol (IMEP) [13] for other basic functions.
TORA can be divided into three basic functions: creating routes, maintaining routes,
and erasing routes. The creation of routes basically assigns directions to links in an undirected
network or portion of the network, building a directed acyclic graph (DAG) rooted at the
destination (See Figure 6).
TORA assigns a height to node in the network. All messages in the network flow
downstream, from a node with higher height to a node with lower height. Query (QRY) and
Update (UPD) packets are used to discover routes. When a node with no downstream links needs
a route to a destination, it will broadcast a QRY packet. This QRY packet will spread through the
16
network until it reaches a node that has a route to the destination or it is the destination itself.
Such a node will then broadcast a UPD packet that contains the node height. Every node
receiving this UPD packet will set its own height to a larger height than specified in the UPD
message. The node then broadcasts its own UPD packet. This will result in a number of directed
links from the originator of the QRY packet to the destination. This process may result in
multiple routes. Maintaining routes refers to reacting to topological changes in the network in a
manner such that routes to the destination are re-established within a finite time, meaning that its
directed portions return to a destination-oriented graph within a finite time. Upon detection of a
network partition, all links in the portion of the network that has become partitioned from the
destination are marked as undirected to erase invalid routes. Routes are erased by using clear
(CLR) messages.
Figure 6: Temporarily Ordered Routing Algorithm
17
2.3.4.2. Properties
A comparison made by the CMU Monarch project [12] has shown that the overhead
in TORA is quite large because it uses IMEP for some of its basic functions.
The graph is aimed at the destination, which has the lowest height. However, the
source originating the QRY does not necessarily have the highest height. This can lead to the
situation, where multiple routes are possible from the source to the destination, but only one
route will be discovered. The reason for this is that the height is initially based on the distance in
number of hops from the destination.
2.4. Comparison
As yet, the protocols have been analyzed theoretically. Table 3 summarizes and compares the
result from these theoretical analyses and shows which protocol has what property.
Table 3: Comparison of MANET Routing Protocols
AODV DSDV DSR TORA
Loop-free Yes Yes Yes No, (temporary loops)
Multiple routes No No Yes Yes
Distributed Yes Yes Yes Yes
Routing Philosophy Reactive Proactive Reactive Reactive
Unidirectional link
support
No No Yes No
QoS Support No No No No
Multicast Yes No No No
Security No No No No
Power conservation No No No No
Periodic broadcasts Yes (When
needed)
Yes No Yes (IMEP)
Requires reliable or
sequenced data
No No No Yes
Routing Metric Freshest &
shortest path
Shortest
path
Shortest
path
Shortest
path
18
The only proactive protocol in this comparison is DSDV. It is the most similar protocol to
traditional routing protocol in wired networks. The addition of sequence numbers ensures loop-
free routes. DSDV will probably be good enough in networks, with low mobility. The authors of
DSDV reckoned the same and designed AODV, which is a reactive version of DSDV. They also
added multicast capabilities, which will enhance the performance considerably when one node
communicates with several nodes. The reactive approach in AODV has many similarities with
that of DSR. They both have a route discovery mode that uses request messages to find new
routes. The difference is that DSR is based on source routing and will learn more routes than
AODV. DSR also has the advantage that it supports unidirectional links. DSR has however one
major drawback and it is the source route that must be carried in each packet, causing an increase
in overhead. This can be quite costly, especially when considering QoS and also when there are a
lot of nodes. AODV can connect to the internet more easily, as compared to DSR because of its
traditional routing.
It can be concluded that none of these protocols take smart routing decisions when a
networks goes through high traffic load. Since the route selection factor used by these protocols
are metrics such as the shortest hop count and the fastest response time to a request, it might lead
to a situation where all the traffic gets routed through the same route even if there are other
routes available with lesser traffic load.
19
3. Simulation Environment
3.1. Network Simulators Overview
There are several simulation programs that can be used for the simulation. According to a
survey carried out in 2005, the simulator utilization rate are as seen in Figure 7 in the form of a
pie chart, in which each segment represents a particular simulator. From this figure, the three
most popular simulators, NS-2 (39%), GloMoSim (21%), and OPNET (9%), accounted for more
than 2/3 of the simulators used. NS-2, GloMoSim, and OPNET are highly modular discrete event
simulators. These simulators are provided for simulating the behavior of networks in a complex
network topology [14]. For this thesis, a survey was carried out to find the best suitable
simulator, based on the following criteria:
How difficult is the installation?
How frequent is the simulator used in research-papers regarding MANETs?
Is it open source?
Which protocols does it support?
How user friendly is it?
How well is its documentation?
Figure 7: Simulators Utilization Trend
20
3.1.1. Network Simulator-2
This simulator is probably the most commonly used software of the four. Network
Simulator 2 [15], also called NS-2, is developed by ISI, the Information Sciences Institute at the
USC School of engineering. The source code is free of charge. There is a comprehensive manual
for the installation and use of the software on the NS-2 homepage [16].
The software is mostly text-based and can be complicated to use if the user is not familiar
with Unix-commands. Some parts are managed with GUIs, which makes it easier to understand
the happenings.
NS-2 (now NS-3) is constantly under development and its progress can be monitored on its
homepage. There is also a bug report forum where users can report any problems and bugs they
encounter while using NS-2. In addition to these features there are also a FAQ and the possibility
to sign up to different ns-related mailing lists.
3.1.2. GloMoSim
GloMoSim stands for Global Mobile information systems Simulation library and
supports protocols for a purely wireless network [17]. It‟s developed at UCLA Parallel
Computing Laboratory (UCLA PCL) and is intended for academic institutions for research
purposes. The current version, GloMoSim 2.0 (December 2000), can be downloaded from the
GloMoSim homepage if you are within the „edu‟ domain. If commercial users want to use
GloMoSim they‟ll have to obtain the commercial version called QualNet. This version is
extended in some areas. You can read more about it in section 3.1.3.
In order to get GloMoSim to work you will need the latest Parsec Compiler (included
with the GloMoSim distribution), Parsec is a C-based simulation language developed by PCL at
UCLA. There is very little documentation of the installation procedure, which is poorly
described. If the user runs into trouble while installing, the documentation would not be of much
use.
Protocols supported by GloMoSim are AODV, Bellman-Ford, DSR, Fisheye, LAR,
ODMRP and WRP. Developing one‟s own protocols in GloMoSim is possible. But to do so the
user should have some familiarity with Parsec. Although the code to the protocols will be written
21
purely in C code, with some Parsec functions for time management, Parsec compiler will be
needed.
Although there are some papers in which GloMoSim have been used, it‟s not as
frequently used as NS-2. Also there is no FAQ, forum or a mailing list on the homepage.
3.1.3. QualNet
QualNet is a software for network simulations, developed by SNT (Scalable Network
Technologies). SNT claims that QualNet can be used for designing a network or network device
to optimize it, saving time and money [18].
The QualNet software consists of five tools plus integration modules and model libraries.
QualNet Animator allows for graphically designing the network model (using a wide library of
components) and can be used to display the simulation as it runs or later on. QualNet Designer
allows users to generate code for their own protocol from scratch and make special statistic
reports. Adjustments can be made to already defined protocol models. QualNet Analyzer is a
graphic tool that presents statistics of different experiments in graphs.
The QualNet model library is a large library of networking options and contains the
MANET library. It includes models for providing wireless dynamic routing, shadowing, fading,
mobility, detailed physical layer effects such as steerable directional antennas and complex
modulation schemes. Routing protocols provided are AODV, BRP, DSR, DYMO, Fisheye,
IARP, IERP, LAR, OLSR, STAR, ZRP and ODMRP.
Documentation and help can be found at their homepage [18]. There are manuals as well
as a FAQ and a forum. Users can also get support by emailing or phoning SNT.
QualNet‟s customers include companies like Microsoft and Boeing and it is used by the
military. There are also some publications done featuring QualNet as the simulation tool.
3.1.4. OPNET
OPNET is a simulation tool that is developed by OPNET Technologies Inc. They are a
leading provider of management software for networks and applications. OPNET have a number
solutions that aims to help the customer in different areas like, application performance
troubleshooting, application deployment planning, network configuration auditing, network
capacity and resiliency planning and network technology R&D.
22
For simulating a MANET, OPNET provides a software platform called the OPNET
Modeler. This software also contains a large number of different models for simulating network
protocols, technologies and applications. There is a wireless model included that provides these
routing protocols AODV, DSR, OLSR, OPSF and TORA.
Although OPNET is rather intended for companies to diagnose and organize their
networks, individual users can develop and implement their own protocol or modify existing
implementations of standard protocols.
The software tends to be well documented and there shouldn‟t be any problems either
with the installation or support. On the homepage [19] there are technical resources with a FAQ
and product updates as well as a forum for OPNET users. To be able to participate in the forum
and download the documents you have to have a license since they are protected by passwords.
On the negative part the software is very expensive and not easy to obtain for single individuals.
3.2. Choice of Simulator
When choosing a simulation program the question of what you want to simulate and which
resources you have to conduct these simulations are of key importance. The simulation work for
this thesis can be done on any of these four simulators. But due to time limitation and the
available backup provided, the choice was quite limited.
The question also arises of how much open source code that is publicly available. This is an
important factor since time is limited and implementing a protocol or writing the simulation code
will require a lot of time.
GloMoSim is available for downloading only if your IP address resolves to an academic
domain name. The documentation isn‟t very good and it seems to be hard to get any kind of
support. Although some papers have used GloMoSim to simulate MANET protocols, the
question is how to compare results with those who have used other simulators.
NS-2 is free to download and researchers for simulating MANETs commonly use it. It has an
extensive manual and some support in the mailing list. New features are developed continuously
and added functions for protocols are available for downloading.
Altogether the choice of simulation program is quite clear; NS-2 provides the best overall
solution.
23
3.2.1. NS-2 Working Flow
Figure 8 shows a block diagram of the working flow of NS-2.
The mobility pattern file specifies the initial position and the gradual movement of the
nodes. The connection pattern file specifies the traffic flow and how the nodes are connected.
These two files are embedded into the Tcl script, which subsequently runs on an NS-2. This Tcl
file creates two output files: NAM file and trace file. The NAM file contains the visual animation
of the scenario and can be viewed on the network animator (NAM). The trace file contains the
operations of a simulation represented as a chronological sequence of events. Each event occurs
at an instant in time.
Trace file contains raw data and AWK is used to extract useful data from them e.g. delay,
overhead, throughput etc. After having the information in the appropriate format, to plot the
result graphs is the last task for obtaining the information to evaluate the simulations. The graphs
are used to examine and compare the results of different simulation scenarios.
Figure 8: NS-2 Working Flow
3.2.1.1. Network Animator
Nam is a Tcl/TK based animation tool for viewing network simulation traces and real
world packet traces. It supports topology layout, packet level animation, and various data
inspection tools. Visualization of mobile nodes can be viewed as animations on NAM.
Figure 9 shows the animation of a MANET with 25 nodes.
24
Figure 9: Screen Shot of Network Animator
3.2.1.2. Tool Command Language
Tcl is a scripting language which provides interfacing with C++ objects such as
agents, protocols, links, queues etc.
In the beginning of a Tcl file, variables are defined and can be seen in the code below:
1. set val(chan) Channel/WirelessChannel
2. set val(prop) Propagation/TwoRayGround
3. set val(netif) Phy/WirelessPhy
4. set val(mac) Mac/802_11
5. set val(ifq) Queue/DropTail/PriQueue
6. set val(ll) LL
7. set val(ant) Antenna/OmniAntenna
8. set val(x) 1000 ;# X dimension of the topography
9. set val(y) 1000 ;# Y dimension of the topography
10. set val(ifqlen) 50 ;# max packet in ifq
11. set val(seed) 1.0
12. set val(adhocRouting) AODV
13. set val(nn) 25 ;# how many nodes are simulated
14. set val(cp) "/root/ns-allinone-2.33/ns-
2.33/tcl/mobility/scene/aodv/cp/aodv-00-15-3"
25
15. set val(sc) "/root/ns-allinone-2.33/ns-
2.33/tcl/mobility/scene/aodv/sc/aodv-00-15-3"
16. set val(stop) 600.0 ;# simulation time
In the main program, first of all, the global variables are initialized:
17. set ns_ [new Simulator]
18. set topo [new Topography]
19. set tracefd [open aodv-00-15-3.tr w]
20. set namtrace [open aodv-00-15-3.nam w]
21. $ns_ trace-all $tracefd
22. $ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
A simulator instance is being created in line 17, line 18 sets up a topography object.
Line 19, 20, 21 and 22 creates trace object for NS and NAM.
23. $topo load_flatgrid $val(x) $val(y)
24. set god_ [create-god $val(nn)]
In line 23 a new topology instance is being defined as a flat grid of area „x‟ meters x
„y‟ meters, the values of „x‟ and „y‟ are defined in the beginning.
Line 24 creates a God instance. The number of wireless nodes is passed as an
argument. It is used to create a matrix to store connectivity information of the topology.
The next code will define how nodes should be created:
25. $ns_ node-config -adhocRouting $val(adhocRouting) \
26. -llType $val(ll) \
27. -macType $val(mac) \
28. -ifqType $val(ifq) \
29. -ifqLen $val(ifqlen) \
30. -antType $val(ant) \
31. -propType $val(prop) \
32. -phyType $val(netif) \
33. -channelType $val(chan) \
34. -topoInstance $topo \
35. -agentTrace ON \
36. -routerTrace ON \
37. -macTrace OFF
26
Line 25 – 37 defines the global node setting; the variables defined in the beginning
are being called in this section.
38. for {set i 0} {$i < $val(nn) } {incr i} {
39. set node_($i) [$ns_ node]
40. $node_($i) random-motion 0 ;# disable random motion
41. }
Line 38 – 41 creates the specified number of nodes [$val(nn)] and "attach" them to
the channel.
42. puts "Loading connection pattern..."
43. source $val(cp)
44. puts "Loading scenario file..."
45. source $val(sc)
Line 42 and 43 defines the node movement model, whose path is provided in the
beginning. Line 44 and 45 defines the traffic model whose path is also provided in the beginning.
46. for {set i 0} {$i < $val(nn)} {incr i} {
47. $ns_ initial_node_pos $node_($i) 20
48. }
Line 46 – 48 defines the initial position of the nodes in NAM.
49. for {set i 0} {$i < $val(nn) } {incr i} {
50. $ns_ at $val(stop).0 "$node_($i) reset";
51. }
52. $ns_ at $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
53. puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp
$val(adhocRouting)"
54. puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)"
55. puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"
56. puts "Starting Simulation..."
57. $ns_ run
Line 49 – 57 tells the nodes when the simulation ends.
27
3.2.1.3. Trace File Format
The trace file provides traces of all the events that occurred during the simulation in a
chronological sequence. Each event occurs at an instant in time.
The trace file format used in this thesis is the „old wireless trace format‟. The traces in
a trace file may look like this:
s 100.691175361 _13_ RTR --- 758 cbr 532 [0 0 0 0] ------- [13:1 14:0 30 8] [17] 0 3
r 100.694465925 _11_ AGT --- 757 cbr 532 [13a b 12 800] ------- [9:3 11:0 29 11] [64] 2 2
r 100.700628759 _8_ RTR --- 758 cbr 532 [13a 8 d 800] ------- [13:1 14:0 30 8] [17] 1 3
f 100.700628759 _8_ RTR --- 758 cbr 532 [13a 8 d 800] ------- [13:1 14:0 29 19] [17] 1 3
It can be seen that the variables are separated by spaces. Figure 10 explains the
format:
Figure 10: Old Wireless Trace File Format
Some variables are further explained as follows [20]:
The operation performed can be of four types:
o s = send
o r = receive
28
o f = forward
o D = drop
Service of the node or the trace level can be
o AGT = agent
o RTR = router
o MAC = media access control
The different reasons for dropping a packet are given below:
o END = end of simulation
o COL = MAC collision
o DUP = MAC duplicate
o ERR = MAC packet error
o RET = MAC retry count exceeded
o STA = MAC invalid state
o BSY = MAC busy
o NRTE = no route is available
o LOOP = there is a routing loop
o TTL = time to live has reached zero
o TOUT = packet has expired
o CBK = MAC callback
o IFQ = no buffer space in IFQ
o ARP = dropped by ARP
o OUT = dropped by base stations on receiving routing updates from nodes
outside its domain
3.2.1.4. AWK Script
The word AWK is derived from the names of its inventors (Aho Weinberger and
Kernighan).
AWK is a C-like-programming language designed to search files for lines (or other
units of text) that contain certain patterns, either in files or data streams.
The raw data contained in trace files can be processed using AWK to extract useful
data, such as throughput, jitter, packet loss ratio, end to end delay etc.
29
The structure of an AWK script contains three sections:
BEGIN
Pattern
END
The BEGIN section executes only one time i.e.in the beginning of the script. Usually,
variables are defined in this section, if a user wants to print a heading; it could be done in this
section too.
As the name says, the pattern section contains the pattern that the user is looking for,
in a particular file or data stream. This pattern executes throughout the file. The functions
defined in this section are executed on one line at a time.
The END section also executes only once i.e. in the end. This section usually contains
printf functions and final calculations.
Consider the following input data stream:
s 100.691175361 _13_ AGT --- 758 cbr 532 [0 0 0 0] ------- [13:1 14:0 30 8] [17] 0 3
r 100.694465925 _11_ AGT --- 757 cbr 532 [13a b 12 800] ------- [9:3 11:0 29 11] [64] 2 2
r 100.700628759 _8_ RTR --- 758 cbr 532 [13a 8 d 800] ------- [13:1 14:0 30 8] [17] 1 3
f 100.700628759 _8_ RTR --- 758 cbr 532 [13a 8 d 800] ------- [13:1 14:0 29 19] [17] 1 3
And an AWK script which calculates sent packets:
BEGIN{
printf (“Sent Packets:”);
Sent=0;
}
{
if (( $1 == "s") && ($7 == “cbr”) && ($4=="AGT" ))
{ sent++; }
}
END{
printf ( “Sent Packets = %d,\n”, sent);
}
30
After running this AWK script on the data stream, the output would be:
Sent Packets:
Sent Packets = 1
31
4. Performance Analysis
4.1. Simulation Parameters
As scenario is a very crucial part of the simulation, 5 instances were created for each
scenario. The result was then compiled using average of those 5 instances. The simulation
parameters that have been used for the simulations are shown in Table 4.
It can be seen that the maximum speed, the pause time and the protocols have been varied.
Parameter Value
Transmission Range of each node 250 m
Total Nodes 25 nodes
Maximum Connections 15 connections
Data Rate 11 Mbps
Packet Rate 1 Packet/sec
Node Speed 2, 15, 30 and 45 m/s
Pause Time 0, 15, 30, 45 and 100 sec
Traffic Type Constant Bit Rate (CBR)
Routing Protocols AODV, DSDV, DSR and TORA
Propagation Model Random WayPoint
Queue Type Droptail
Simulation Time 600 sec
Area Size 1000 x 1000 m
Packet Size 512 bytes
Initial Node Placement Random
NS-2 version NS-2.29 and NS-2.33
Table 4: Simulation Parameters
32
4.2. Performance Analysis Factors
Before going into the actual simulation results, the factors to be measured when comparing
routing protocols in MANET are described. The performance analysis is based on the following
factors as a function of maximum speed and pause time:
End to End Delay
o It is the time taken by a packet to reach the destination
o It is preferred low
Normalized Routing Load
o It is a ratio of network control packets to all delivered packets
o It is preferred low
Packet Loss Ratio
o It is the ratio of sent packets to those not received at their destinations
o It is preferred low
Routing Overhead
o It is the number of routing packets
o It is preferred low
Packet Delivery Fraction (PDF)
o The ratio of the data packets delivered to the destinations to those generated
by the CBR sources
o It is preferred high
4.3. Simulation Results
The results obtained during the simulation are depicted in this section. The protocols that
have been simulated are DSDV, AODV, DSR and TORA, to compare how much better/worse
these protocols perform in different scenarios.
The simulations were conducted on a Dell Latitude E5500 Laptop with an Intel® Core™ 2
Duo processor at 2.4 GHz, with 2 Gigabytes of RAM.
In these simulations there are four types of different scenarios used, based on the maximum
speed of the nodes. The results will conclude how each protocol performs in the different
scenarios. The simulation results on the basis of chosen factors can be seen as follows:
33
4.3.1. End to End Delay
End to End Delay
Max. Speed 2 m/s
Pause Time AODV DSDV DSR TORA
0 0.110 0.066 0.260 0.358
15 0.084 0.048 0.640 0.418
30 0.070 0.042 0.552 0.334
45 0.214 0.044 0.514 0.670
100 0.172 0.054 0.730 0.364
Max. Speed 15 m/s
Pause Time AODV DSDV DSR TORA
0 0.254 0.232 1.544 0.764
15 0.378 0.150 1.038 1.392
30 0.388 0.178 2.078 0.880
45 0.490 0.090 1.562 1.108
100 0.404 0.088 1.080 1.094
Max. Speed 30 m/s
Pause Time AODV DSDV DSR TORA
0 0.452 0.256 1.658 0.972
15 0.352 0.248 1.896 1.486
30 0.466 0.302 2.376 1.642
45 0.482 0.226 1.616 1.450
100 0.466 0.146 2.568 1.710
Max. Speed 45 m/s
Pause Time AODV DSDV DSR TORA
0 0.438 0.208 1.134 1.682
15 0.570 0.510 1.738 1.306
30 0.588 0.310 2.192 1.558
45 0.710 0.370 3.170 1.590
100 0.536 0.108 2.392 1.368
Table 5: Simulation Results: End to End Delay
34
Graph 1: End to End Delay [2 m/s]
Graph 2: End to End Delay [15 m/s]
Graph 3: End to End Delay [30 m/s]
Graph 4: End to End Delay [45 m/s]
End-to-end delay of data packets includes all possible delay caused by buffering during
route discovery latency, transmission delays at the MAC, queuing at interface queue, and
propagation and transfer time. Among these four protocols, DSDV has the least average end-to-
end delay. DSDV is a proactive protocol and the advantage of being one is that a path to a
destination is immediately available, so it experiences no delay for route discovery, when an
application needs to send a packet.
DSR is a source routing protocol, therefore it has longer delay because its route
discovery takes more time as every intermediate node tries to extract information before
forwarding the reply, throughout the path. Hence, while source routing makes route discovery
more profitable, it slows down the transmission of packets. This is the reason why AODV
performs better than two other reactive protocols in general.
35
4.3.2. Normalized Routing Load
Normalized Routing Load
Max. Speed 2 m/s
Pause Time AODV DSDV DSR TORA
0 0.654 0.318 0.328 3.172
15 0.686 0.302 0.448 3.784
30 0.738 0.282 0.382 3.634
45 0.960 0.314 0.356 3.158
100 1.012 0.310 0.446 3.890
Max. Speed 15 m/s
Pause Time AODV DSDV DSR TORA
0 2.148 0.570 1.544 7.236
15 2.236 0.620 1.174 10.188
30 2.240 0.640 1.708 8.346
45 2.322 0.562 1.558 8.622
100 1.854 0.548 1.006 8.500
Max. Speed 30 m/s
Pause Time AODV DSDV DSR TORA
0 3.140 0.806 2.084 10.900
15 2.834 0.960 2.270 12.658
30 2.884 0.876 2.116 12.442
45 2.922 0.822 1.764 12.306
100 2.528 0.598 1.538 10.094
Max. Speed 45 m/s
Pause Time AODV DSDV DSR TORA
0 3.884 0.950 2.948 15.128
15 3.698 1.180 2.540 14.032
30 3.554 1.190 2.590 12.220
45 3.148 1.008 2.520 12.296
100 2.672 0.684 1.970 7.588
Table 6: Simulation Results: Normalized Routing Load
36
Graph 5: Normalized Routing Load [2 m/s]
Graph 6: Normalized Routing Load [15 m/s]
Graph 7: Normalized Routing Load [30 m/s]
Graph 8: Normalized Routing Load [45 m/s]
The results show that TORA has the highest normalized routing load; this is because
TORA uses IMEP for its basic functions. DSDV being a proactive protocol enjoys the advantage
of having the lowest normalized routing load, because proactive routing protocols do not need
too much routing packets.
The normalized routing load of AODV is higher than DSR, because AODV periodically
broadcasts hello messages and DSR does not.
The normalized routing load of TORA increases drastically as the mobility is increased,
whereas, in the case of AODV and DSR, it increases slightly.
37
4.3.3. Packet Loss Ratio
Packet Loss Ratio
Max. Speed 2 m/s
Pause Time AODV DSDV DSR TORA
0 7.010 27.850 4.720 19.823
15 10.440 25.130 10.550 24.573
30 9.330 21.570 5.680 20.155
45 18.990 25.640 4.890 21.955
100 21.540 29.910 10.430 23.453
Max. Speed 15 m/s
Pause Time AODV DSDV DSR TORA
0 14.110 43.350 6.540 21.221
15 15.190 47.150 4.950 30.683
30 15.890 50.180 12.170 25.712
45 19.830 44.140 11.160 30.449
100 20.390 46.490 7.930 32.025
Max. Speed 30 m/s
Pause Time AODV DSDV DSR TORA
0 14.760 52.690 6.170 26.575
15 14.960 59.160 7.310 34.059
30 17.080 57.130 8.550 35.465
45 20.320 56.960 8.230 35.795
100 25.790 48.030 14.530 35.780
Max. Speed 45 m/s
Pause Time AODV DSDV DSR TORA
0 17.260 60.740 4.980 31.626
15 18.160 65.040 7.320 31.173
30 21.640 65.450 7.380 33.052
45 23.170 62.040 11.030 36.687
100 27.650 51.820 16.950 34.362
Table 7: Simulation Results: Packet Loss Ratio
38
Graph 9: Packet Loss Ratio [2 m/s]
Graph 10: Packet Loss Ratio [15 m/s]
Graph 11: Packet Loss Ratio [30 m/s]
Graph 12: Packet Loss Ratio [45 m/s]
DSR has the lowest packet loss ratio because it stores the information of multiple paths,
whereas AODV does not. Whenever a link breaks AODV broadcasts a route request and waits
for some time to get new information by receiving a route reply; during this time AODV will
queue the packets, which are sometimes dropped because of expiration in the AODV queue. But
DSR will send the packets through an alternate path.
DSDV has the highest packet loss ratio because, being a proactive protocol, it sends
packets even before the routing tables have had enough time to converge and so the packets are
dropped, because it sends packets on a broken route that is listed as valid in its routing table.
Majority of dropped packets in TORA are due to routing loops, and it increases with the
increase in mobility.
39
4.3.4. Routing Overhead
Routing Overhead
Max. Speed 2 m/s
Pause Time AODV DSDV DSR TORA
0 4922.6 1853.6 2396.2 20569.0
15 4973.8 1838.0 3113.2 21338.4
30 5194.6 1776.8 2906.6 22665.8
45 6224.0 1885.8 2725.2 19167.8
100 6364.2 1749.8 3205.2 23126.4
Max. Speed 15 m/s
Pause Time AODV DSDV DSR TORA
0 14877.0 2618.2 11633.4 45000.4
15 15402.0 2644.2 9072.6 51545.2
30 15199.6 2580.2 12159.6 48791.6
45 15091.6 2517.4 11285.8 47144.0
100 11928.4 2364.2 7532.0 46046.4
Max. Speed 30 m/s
Pause Time AODV DSDV DSR TORA
0 21682.6 3059.6 15813.8 64271.2
15 19475.2 3163.2 16962.8 65920.2
30 19413.8 2987.6 15627.4 62297.2
45 18793.2 2848.2 13139.6 62582.2
100 14829.8 2499.8 10617.0 49306.0
Max. Speed 45 m/s
Pause Time AODV DSDV DSR TORA
0 26147.4 3030.6 22788.2 81468.6
15 24290.6 3342.8 19151.2 76536.0
30 22514.4 3320.4 19424.6 64518.6
45 19400.6 3074.8 17403.4 61352.2
100 15530.8 2568.2 13110.8 38457.6
Table 8: Simulation Results: Routing Overhead
40
Graph 13: Routing Overhead [2 m/s]
Graph 14: Routing Overhead [15 m/s]
Graph 15: Routing Overhead [30 m/s]
Graph 16: Routing Overhead [45 m/s]
TORA has high routing overhead because IMEP‟s feedback loops cause heavy
congestion and it increases significantly with the increase in mobility.
AODV has more routing overhead than DSR because route discoveries usually propagate
to every node in the network. DSR uses routing cache aggressively, and maintains multiple
routes per destination.
Routing overhead in DSDV is more or less constant. This is due to the tremendous
overhead incurred by DSDV when exchanging routing tables.
41
4.3.5. Packet Delivery Fraction (PDF)
Packet Delivery Fraction
Max. Speed 2 m/s
Pause Time AODV DSDV DSR TORA
0 92.938 72.140 95.234 79.546
15 89.398 74.764 89.294 72.428
30 80.422 78.326 94.232 77.322
45 80.848 74.286 88.492 76.406
100 78.276 69.994 89.362 74.776
Max. Speed 15 m/s
Pause Time AODV DSDV DSR TORA
0 85.788 56.660 93.138 78.180
15 84.510 52.812 94.802 68.122
30 84.002 49.770 87.538 72.964
45 80.008 55.864 91.558 67.450
100 79.168 53.476 91.866 65.842
Max. Speed 30 m/s
Pause Time AODV DSDV DSR TORA
0 85.108 47.324 93.654 72.656
15 84.894 40.852 92.472 64.814
30 82.704 42.842 91.088 63.060
45 79.460 43.016 88.646 63.248
100 73.720 51.950 85.072 61.368
Max. Speed 45 m/s
Pause Time AODV DSDV DSR TORA
0 82.668 39.260 94.948 68.084
15 81.644 34.974 92.586 67.902
30 78.070 34.568 92.456 65.598
45 76.438 37.916 88.646 61.790
100 71.866 48.170 82.590 63.464
Table 9: Simulation Results: Packet Delivery Fraction
42
Graph 17: Packet Delivery Fraction [2 m/s]
Graph 18: Packet Delivery Fraction [15 m/s]
Graph 19: Packet Delivery Fraction [30 m/s]
Graph 20: Packet Delivery Fraction [45 m/s]
DSDV‟s packet delivery fraction (PDF) is very less due to stale routing information. If a
node using DSDV is transmitting data and link failure occurs, it queues the packets until it gets a
new path for the desired destination. Node starts to drop the packets if the queue is full, and
happens frequently at high mobility. Also, as the node‟s speed increases, the difference in PDF
becomes bigger; this is because as speed increases, the probability of link failure increases.
AODV broadcasts a route request immediately in case of a link failure, and so its PDF is
quite better as compared to DSDV.
DSR on the other hand uses alternate path that it has saved during route discovery, and so
enjoys a higher PDF.
TORA has comparatively less PDF than AODV and DSR, due to the reason that it drops
a lot of packets as a result of routing loops.
43
5. Conclusion
5.1. Summary
In the previous chapter, the performance analysis was done, which brings out these
comparative results:
Factors Best to Worse Performer
End to End Delay DSDV AODV TORA DSR
Normalized Routing Load DSDV DSR AODV TORA
Packet Loss Ratio DSR AODV TORA DSDV
Routing Overhead DSDV DSR AODV TORA
Packet Delivery Fraction DSR AODV TORA DSDV
Table 10: Comparison of MANET Routing Protocols (on the basis of results)
The results are summarized as follows:
The fraction of packets received for AODV is in a range of 70-100%, and for DSR, it
is in a range of 80-100%, this is because they have link layer support for link
breakage and so they are much more stable. Whereas DSDV highly depends on
periodic broadcasts and so it shows a rather poor result, not even 50% of the packets
are received when mobility is increased.
In case of a higher traffic load, congestion will occur and packets will be dropped. So
if the routing protocol is fast enough in finding a route, the packets will have to spend
less time in a buffer, which will result in a smaller probability of packet drops. DSDV
would perform very well in such cases, but the overhead of AODV and DSR would
definitely increase.
The overall performance of DSDV decreases as mobility is increased, because of
stale information in its routing tables.
44
DSR performs better over AODV and TORA, because it has source routing, and it
stores multiple paths, so that it may react instantly in case of a broken route.
It is also observed that DSR has higher end to end delay, and that makes DSR not
very suitable for real-time traffic.
5.2. Future Work
Mobile ad-hoc networks are of increasing interest in a lot of applications, such as
collaborative computing, sensing networks, potential fourth generation wireless systems, and
reaction to incidents that destroyed the existing communication structure. There is much research
going on and there are yet many issues that could be subject to further studies.
Some of them are:
Simulator Environment: Using an improved simulator environment, e.g. by using
more protocols (e.g. ZRP), by varying number of nodes, by varying transmission
range etc.
Security: It is an important issue, as routing protocols are prime targets for
impersonation attacks, and MANETS are formed without any centralized authority.
TCP Variants: As TCP is optimized for wired links, it is not suitable for MANETs;
therefore its variants are designed such that they can use the bandwidth efficiently.
Quality of Service: the needs for Quality of Service can be taken under concern,
considering what purpose the network is created for.
Energy Management: It is an essential requirement for the efficient operation of the
battery powered MANETs.
The field of MANETs is rapidly on the rise and changing, and while there are yet many
challenges that need to be met, it is likely that such networks will see widespread use in a few
years time.
45
6. References
[1] K. Leung, et. al., “Transmission Control Protocol (TCP) in wireless Networks: issues,
approaches and challenges”. IEEE Communications Survey, Vol. 8 No. 4, pp. 64-79, 4th
October 2006.
[2] http://www.ietf.org/rfc/rfc2501.txt
[3] Björn Wigerg, et. al., “Porting AODV-UU Implementation to NS-2 and Enabling Trace-
Based Simulation”. Uppsala University, December 2002.
[4] C.Siva Murthy, et. al., “Ad Hoc Wireless Networks Architectures and Protocols”.
Published May 24, 2004 by Prentice Hall.
[5] http://www.ietf.org/rfc/rfc3626.txt
[6] Charles Perkins, et. al., “Highly dynamic destination-sequenced distance vector routing
(DSDV) for mobile computers”.
[7] Charles Perkins, et. al., “Ad-hoc On-Demand Distance Vector Routing”. In Proceedings
WMC-SA ‟99, Second IEEE Workshop on Mobile Computing Systems and Applications,
pp.90-100, Feb 1999.
[8] D. Johnson, et. al., “Dynamic Source Routing in Ad Hoc Wireless Networks”. Computer
Communication Review – Proceedings of SIGCOMM „96, Aug. 1996.
[9] V. D. Park, et. al., “A Highly Adaptive Distributed Routing Algorithm for Mobile Wireless
Networks,” Proc. INFOCOM ‟97, Apr. 1997.
[10] Haas, J., 1997, “A new routing protocol for the reconfigurable wireless networks”, Proc. of
IEEE 6th International Conference on Universal Personal Communications 97, pp. 562–
566.
[11] http://wiki.uni.lu/secan-lab/Count-To-Infinity+Problem.html
[12] Josh Broch, et. al., “A Performance Comparison of Multi-hop wireless Ad hoc Network
Routing Protocols”. Mobicom ‟98, Dallas Texas, 25-30 October, 1998.
[13] M. S. Corson, et. al., “Internet MANET Encapsulation Protocol (IMEP) Specification”.
Internet Draft draft-ietf-manet-imep-spec-01.txt
46
[14] C. R. Dow, et. al., “A Study of Recent Research Trends and Experimental Guidelines in
Mobile Ad-hoc Networks”. Proceedings of the 19th International Conference on Advanced
Information Networking and Applications (AINA‟05).
[15] http://www.isi.edu/nsnam/ns/
[16] http://www.isi.edu/nsnam/ns/ns-documentation.html
[17] http://pcl.cs.ucla.edu/projects/glomosim/
[18] http://www.scalable-networks.com/products/qualnet/
[19] http://www.opnet.com/
[20] http://www.isi.edu/nsnam/ns/doc/node186.html
47
7. Appendix A
7.1. Installation Process of Linux
7.1.1. Introduction to VMware Workstation
Virtual Machine ware (VMware) allows multiple standard operating systems and their
applications to run with high performance in secure and transportable virtual machines. Each
virtual machine is equivalent to a PC with a unique network address and full complement of
hardware choices.
Figure 11: Screen Shot of VMware Workstation
7.1.2. Creating new Virtual Machine
A new virtual machine can be created by clicking the icon shown in the figure below:
Figure 12: Screen shot of New Virtual Machine Icon
It is optional whether you install the operating system using a CD or an iso image.
48
Figure 13: Screen Shot of New Virtual Machine Wizard 1
As Cent OS is not a pre defined system in VMware, Red Hat Enterprise Linux 5 is used
as an equivalent.
Figure 14: Screen Shot of New Virtual Machine Wizard 2
Chose the disk size you want to assign to this particular machine and power it on, the
following screen will appear.
49
Figure 15: Screen Shot of CentOS Installation 1
The machine will now load the iso image… and installation of the operating system will
start.
Click next and follow instructions.
Figure 16: Screen Shot of CentOS Installation 2
50
Choose „Customize now‟ and click next.
Select the following packages:
Desktop Environment:
o Gnome desktop environment
o KDE desktop environment
Applications:
o Editors
o Emacs
o Engineering and scientific
o Games and entertainment
o Graphical and internet
o Office/productivity
o Sound and video
Figure 17: Screen Shot of CentOS
Installation 3
Figure 18: Screen Shot of CentOS
Installation 4
Figure 19: Screen Shot of CentOS
Installation 5
Figure 20: Screen Shot of CentOS
Installation 6
51
o Text based internet
Development:
o Development libraries
o Development tools
o Gnome software development
o KDE software development
o Legacy software development
o Ruby software development
o X- software development
Server:
o Printing support
Base System:
o Base
o Dial-up network support
o X-window support
And none from Clustering, Cluster storage and Languages
Click next and continue.
Figure 21: Screen Shot of CentOS Installation 7
52
Figure 22: Screen Shot of CentOS Installation 8
Figure 23: Screen Shot of CentOS Installation 9
Now chose a user name and its password.
CentOS 5.3 is now installed.
7.1.3. Installing VM Tools
Power the virtual machine on, and on the VMware Workstation click on VMInstall
VM Tools… and follow these instructions.
Figure 24: Screen Shot of VM Tools Installation
53
An icon for VM Tools will appear on the desktop
Figure 25: Screen Shot of VM Tools Icon
Extract the tar.gz file from this CD, and the place the folder in root home
Now go to vmware-tools-distrib folder and run the file vmware –install.pl as
follows:
o [root@localhost vmware-tools-distrib]# ./vmware-install.pl
This will install VM tools, now log out and log in again…
The VM Tools are now active.
7.2. Installation Process of Network Simulator
7.2.1. Getting NS-2
NS-2 is freely available from:
http://www.isi.edu/nsnam/dist/
7.2.2. Steps for Installation
a. Download the latest version of ns-allinone package
b. Copy this package into Cent OS
c. Extract package in root home
d. Go to folder ‟ns-allinone-2.33‟ and run “./install” in the terminal
[root@localhost ns-allinone-2.33]# ./install
e. After installation go back to root home and open bash profile in gedit
[root@localhost ~]# gedit .bash_profile
f. Copy the following paths in the bash profile (write the correct folder names)
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
54
fi
# User specific environment and startup programs
PATH=$PATH:~/ns-allinone-2.33/bin:~/ns-allinone-
2.33/tcl8.4.18/unix:~/ns-allinone-2.33/tk8.4.18/unix
LD_LIBRARY_PATH=~/ns-allinone-2.33/otcl-1.13:~/ns-allinone-
2.33/lib
TCL_LIBRARY=~/ns-allinone-2.33/tcl8.4.18/library
export PATH
export LD_LIBRARY_PATH
export TCL_LIBRARY
unset USERNAME
g. Save and close gedit
h. Log out from root and then again log in
i. Now to validate the software go to /root/ns-allinone-2.33/ns-2.33 and run
“./validate”
[root@localhost ns-2.33]# ./validate
NS-2 is now ready to be used.
55
8. Appendix B
8.1. AWK Program Used
BEGIN {
sends=0;
recvs=0;
routing_packets=0.0;
droppedBytes=0;
droppedPackets=0;
highest_packet_id =0;
sum=0;
recvnum=0;
}
{
time = $2;
packet_id = $6;
# CALCULATE PACKET DELIVERY FRACTION
if (( $1 == "s") && ( $7 == "cbr" ) && ( $4=="AGT" )) { sends++; }
if (( $1 == "r") && ( $7 == "cbr" ) && ( $4=="AGT" )) { recvs++; }
# CALCULATE DELAY
if ( start_time[packet_id] == 0 ) {
start_time[packet_id] = time;
}
if (( $1 == "r") && ( $7 == "cbr" ) && ( $4=="AGT" ))
{ end_time[packet_id] = time; }
else { end_time[packet_id] = -1; }
# CALCULATE TOTAL OVERHEAD
if (($1 == "s" || $1 == "f") && $4 == "RTR" && $7 =="AODV")
routing_packets++;
# DROPPED PACKETS
if (( $1 == "D" ) && ( $7 == "cbr" ) && ( $2 > 0 ))
{
droppedBytes=droppedBytes+$8;
droppedPackets=droppedPackets+1;
}
#find the number of packets in the simulation
if (packet_id > highest_packet_id)
highest_packet_id = packet_id;
}
END {
for ( i in end_time )
{
start = start_time[i];
end = end_time[i];
56
packet_duration = end - start;
if ( packet_duration > 0 )
{ sum += packet_duration;
recvnum++;
}
}
delay=sum/recvnum;
NRL = routing_packets/recvs; #normalized routing load
PDF = (recvs/sends)*100; #packet delivery ratio[fraction]
printf("Sent packets = %.2f\n",sends);
printf("Received packets = %.2f\n",recvs);
printf("Dropped packets = %d\n",droppedPackets);
printf("Packet Delivery Fraction = %.2f\n",PDF);
printf("Normalized Routing Load = %.2f\n",NRL);
printf("E2E Delay in seconds = %.2f\n",delay);
printf("Routing Overhead = %.2f\n",routing_packets++);
printf("No. of dropped data (bytes) = %d\n",droppedBytes);
}