Beruflich Dokumente
Kultur Dokumente
by
Mehemed Bashir Aliwa
A Thesis
Submitted in Partial Fulfillment to the Requirements
for the Master's Degree in
Computer Engineering
Supervisor
MARCH 2008
اﻷﻛﺎدﳝﻴﺔ اﻟﻌﺮﺑﻴﺔ ﻟﻠﻌﻠﻮم واﻟﺘﻜﻨﻮﻟﻮﺟﻴﺎ واﻟﻨﻘﻞ اﻟﺒﺤﺮى
ﻛﻠﻴ ـﺔ اﳍﻨﺪﺳ ـﺔ واﻟﺘﻜﻨﻮﻟﻮﺟﻴ ـﺎ
ﻗﺴﻢ ﻫﻨﺪﺳﺔ اﳊﺎﺳﺒﺎت
ﻣﻘدم ﻣن :
إﺷراف
د .ﳏﻤـﺪ اﻟﻄﺎﻫـﺮ اﻟﺴـﲏ أ.د .ﳏﻤﺪ ﻫﺎﺷﻢ ﻋﺒﺪ اﻟﻌﺰﻳﺰ أﲪـﺪ
اﻷﻛﺎدﳝﻴﺔ اﻟﻌﺮﺑﻴﺔ ﻟﻠﻌﻠﻮم واﻟﺘﻜﻨﻮﻟﻮﺟﻴﺎ واﻟﻨﻘﻞ أﺳﺘﺎذ ورﺋﻴﺲ ﻗﺴﻢ ﻧﻈﻢ اﳌﻌﻠﻮﻣﺎت ﻛﻠﻴﺔ اﳊﺎﺳﺒﺎت
اﻟﺒﺤﺮى ﻛﻠﻴﺔ اﳍﻨﺪﺳﺔ واﻟﺘﻜﻨﻮﻟﻮﺟﻴﺎ واﳌﻌﻠﻮﻣﺎت ﺟﺎﻣﻌﻪ ﻋﲔ ﴰﺲ
ﻣﺎرس 2008
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Abstract
Ad-hoc networking is a concept in computer communications, which means that
users wanting to communicate with each other form a temporary network, without
any form of centralized administration and without any physical connections. In these
networks there is no fixed topology due to the mobility of nodes. Each node
participating in the network acts both as host and a router and must therefore be
willing to forward packets for other nodes. Hence a dynamic routing protocol is
needed for these networks to function properly. Many Routing protocols have been
developed by researchers for accomplishing this task. Consequently, there is a need
for evaluation.
The wide array of uses for ad-hoc networks creates many different levels of
security requirements. So secure routing is an important area of research in
developing secured routing protocols. Although researchers have proposed several
secure routing protocols, their resistance towards various types of security attacks and
efficiency is a primary point of concern in implementing these protocols.
The purpose of this master thesis is to use a simulator to support the mobility wireless
sensor network simulation to implemented secure routing algorithm protocol in
simulator Ns-2, evaluation, comparison and performance analysis the secure routing
algorithm protocol compared with traditional routing algorithm protocols as:
First: survey of ad-hoc sensory network and study simulator network (Ns-2) which
supports wireless sensor network and has been designed as analyzer module used to
analyze the simulation output results with 6 performance metrics an a two new
performance metrics (drop packets at routing overhead and drop packets at end of
simulation time(trace files format).
Second: simulator Ns-2 is used for evaluation, comparison, performance analysis
between three routing algorithm for sensor mobile ad-hoc networks protocol
(Classification of flat routing protocols), Destination-Sequenced Distance Vector
(DSDV), Ad-Hoc On-Demand Distance Vector (AODV) and Dynamic Source
Routing (DSR) which are currently implemented in Ns-2 simulator. The first one is a
proactive protocol depending on routing tables which are maintained at each node.
The second and third are reactive protocol, which find a route to a destination on
demand, when every communication is needed.
Third: secure routing algorithm is implemented for sensor mobile ad-hoc networks
protocol (SEAD: secure efficient distance vector routing for mobile sensor ad-hoc
networks) in simulator network Ns-2, simulation with environment of attackers,
performance analysis and compared secure routing algorithm protocol with traditional
DSDV routing algorithm for sensor mobile ad-hoc network protocol.
اﻟﻣﻠﺧـــــص
ﯾﺗﻧﺎول اﻟﻣﺷروع
اﻟﮭدف ﻣن ھذا اﻟﻣﺷروع ,أوﻻ ً :ﺑﺣث ﺷﺎﻣل ﻋن ﺷﺑﻛﺎت ذاﺗﯾﺔ اﻟﺗﻧظﯾم )(Ad-Hoc
ﻟﻠﻣﺣﺳﺳﺎت اﻟﻣﺗﻧﻘﻠﺔ ,وأﺳﺗﺧدام اﻟﻣﺣﺎﻛﻲ ) (Ns-2ودراﺳﺔ ﻛﯾﻔﯾﺔ أﺳﺗﺧﻼص اﻟﻧﺗﺎﺋﺞ ﻣﻧﮫ
وذﻟك ﺑﺄﻋداد ﺑرﻧﺎﻣﺞ ﻟﺗﺣﻠﯾل اﻟﻧﺗﺎﺋﺞ ﻣﻧﮫ.
ﺛﺎﻧﯾﺎ :ﻣﻘﺎرﻧﮫ وﺗﺣﻠﯾل اﻟﻧﺗﺎﺋﺞ ﺑﯾن ﺛﻼﺛﺔ ﺧوارزﻣﯾﺎت ﻟﻠﺗوﺟﯾﺔ )(DSDV, DSR, ADOV
ﻟﺷﺑﻛﺎت ذاﺗﯾﺔ اﻟﺗﻧظﯾم ) (Ad-Hocﻟﻠﻣﺣﺳﺳﺎت اﻟﻣﺗﻧﻘﻠﺔ ﺑﺄﺳﺗﺧدم اﻟﻣﺣﺎﻛﻲ )(Ns-2
واﻟﺑرﻧﺎﻣﺞ اﻟذي ﺗم أﻋــداده ﻟﺗﺣﻠﯾل اﻟﻧﺗﺎﺋﺞ.
ﺛﺎﻟﺛﺎ :ﺑرﻣﺟﺔ ﺧوارزﻣﯾﺔ اﻟﺗوﺟﯾﺔ اﻵﻣن ) (SEADﻟﺷﺑﻛﺎت ذاﺗﯾﺔ اﻟﺗﻧظﯾم )(Ad-Hoc
ﻟﻠﻣﺣﺳﺳﺎت اﻟﻣﺗﻧﻘﻠﺔ ﻓﻲ اﻟﻣﺣﺎﻛﻲ ) (Ns-2وﻣﻘﺎرﻧﺗﮭﺎ ﻣﻊ ﺧوارزﻣﯾﺔ اﻟﺗوﺟﯾﺔ )(DSDV
ﻟﺷﺑﻛﺎت ذاﺗﯾﺔ اﻟﺗﻧظﯾم ) (Ad-Hocﻟﻠﻣﺣﺳﺳﺎت اﻟﻣﺗﻧﻘﻠﺔ وذﻟك ﻟﻛﻲ ﯾﺑﯾن ﻟﻧﺎ ﻣدي ﻛﻔﺎءة
ﺧوارزﻣﯾﺔ اﻟﺗوﺟﯾﺔ اﻵﻣن ) (SEADﻟﺷﺑﻛﺎت ذاﺗﯾﺔ اﻟﺗﻧظﯾم ) (Ad-Hocﻟﻠﻣﺣﺳﺳﺎت
اﻟﻣﺗﻧﻘﻠﺔ.
اﻟﻔﺻل اﻟﺛﺎﻟث ﯾﻌرض ﻧﺗﺎﺋﺞ ﺗﺣﻠﯾل اﻟﻣﻘﺎرﻧﮫ اﻟﺗﻲ ﺗم أﺳﺗﺧﻼﺻﮭﺎ ﻣن اﻟﻣﺣﺎﻛﻲ )(Ns-2
ﻟﺧوارزﻣﯾﺎت اﻟﺗوﺟﯾﺔ ) (DSDV, DSR, ADOVﻟﺷﺑﻛﺎت ذاﺗﯾﺔ
اﻟﺗﻧظﯾم ) (Ad-Hocﻟﻠﻣﺣﺳﺳﺎت اﻟﻣﺗﻧﻘﻠﺔ ,وﻛﻣﺎ ﯾﻌرض اﻟﻔﺻل ﺷرح
ﻋن ﻛﯾﻔﯾﺔ أﺳﺗﺧﻼص اﻟﻧﺗﺎﺋﺞ ﻣن اﻟﻣﺣﺎﻛﻲ ) (Ns-2وذﻟك ﺑﺄﻋداد ﺑرﻧﺎﻣﺞ
ﻟﺗﺣﻠﯾل اﻟﻧﺗﺎﺋﺞ .وﻣﻘدﻣﺔ ﻋن اﻟﻣﺣﺎﻛﻲ ).(Ns-2
First, I thank ALLAH the most merciful and compassionate for giving me the
power and the desire to finish this project.
Table of Contents
Chapter 1 ......................................................................................................................12
Introduction..................................................................................................................12
1.1 Overview of Mobile Ad-hoc Sensor Network .......................................................12
1.1.2. Sensor Nodes .................................................................................12
1.1.3. Sensor Node Components..............................................................................13
1.1.4. Characteristics and Requirements of Sensor Nodes ......................................14
1.1.3. Classified of Wireless Networks....................................................................15
1.1.3.1. Infrastructure Networks ..........................................................................15
1.1.3.2. Infrastructure less (Ad-hoc) Networks....................................................16
1.1.4. Common Architectures of Mobile Network ..................................................17
1.1.5. Application of Mobile Ad-Hoc Networks .....................................................18
1.1.6. Characteristics of Mobile Ad Hoc Networks.................................................20
1.2 Scope......................................................................................................................20
1.3 Objective ................................................................................................................21
1.4 Methodology ..........................................................................................................21
1.5 Thesis Structure and Layout ..................................................................................22
Chapter 2 ......................................................................................................................25
Routing & Secure Algorithm for Ad-hoc Networks....................................................25
2.1. Introduction...........................................................................................................25
2.2. Least-Cost Algorithms ..........................................................................................25
2.2.1. Dijkstra's algorithm .................................................................................25
2.2.2. Bellman-Ford algorithm.................................................................................27
2.3. Routing Algorithm in Wired Networks ................................................................27
2.3.1. Distance vector ..................................................................................28
2.3.2. Link state Routing .................................................................................29
2.3.3. Flooding ..................................................................................30
2.4. Routing Algorithm in a Mobile Ad-hoc Networks ...............................................31
2.4.1. Introduction ................................................................................31
2.4.2. Classification of Routing Protocols in MANETs ..........................................31
2.4.3. Problems with Routing in Mobile Ad-hoc Networks ....................................31
2.4.4. Proactive and Reactive Routing Protocols.....................................................32
2.4.4.1. Table Driven (DSDV) Routing Protocols...............................................33
2.4.5.2. On-Demand Routing Protocols...............................................................37
2.4.5.2.1. DSR Routing Protocol .....................................................................37
2.4.5.2.2. AODV Routing Protocol..................................................................40
2.5. Security .................................................................................................................45
2.5.1. Security Goals ..................................................................................46
2.5.2. Attacks in Networks .................................................................................46
2.5.2.1. Passive attacks ........................................................................................47
2.5.2.2. Active attacks..........................................................................................47
2.5.3. Adversary Model .................................................................................48
2.5.4. Attack Patterns of Sensor Mobile Ad-Hoc Networks....................................48
2.5.5. Secure Routing Protocol in Mobile Ad-hoc Networks ..................................50
2.6. Summary ...............................................................................................................51
1
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 3 ......................................................................................................................54
Comparison and Performance Analysis of Ad-hoc Routing Protocols & Results.......54
3.1. Introduction...........................................................................................................54
3.2. Analysis the Simulation Traces File Format.........................................................56
3.2.1. Sent packet ..................................................................................57
3.2.2. Received packet ................................................................................57
3.2.3. Routing packets sent .................................................................................58
3.2.4. Duration of packets .................................................................................58
3.2.5. Drop packets at routing overhead ..................................................................59
3.2.6. Drops packet at End of time...........................................................................59
3.2.7. Movement Node .................................................................................59
3.3. Performance Metrics .............................................................................................59
3.3.1. Packet delivery fraction ratio .........................................................................60
3.3.2 Average End-to-End delay of data packets.....................................................60
3.3.3. Normalized routing load ................................................................................60
3.3.4. Routing packet overhead................................................................................60
3.3.5. Drop packets at routing overhead ..................................................................60
3.3.6. Drop of packets .................................................................................60
3.4. Simulation .............................................................................................................61
3.5. Simulation Procedure for Running Scenario ........................................................61
3.5.1. The Traffic sources Model.............................................................................63
3.5.2. The Mobility Model .................................................................................63
3.5.3. Simulation code of Tcl script .........................................................................64
3.5.4. Analyzer module .................................................................................64
3.5.5. Network Animator and Movement Node ......................................................65
3.6. Simulation Summary ............................................................................................66
3.7. Results & Performance Analysis Comparison of Ad-hoc Routing Protocols ......70
3.7.1. Packet delivery Comparison ..........................................................................70
3.7.2. Average End-End Delays Packet delivery.....................................................77
3.7.3. Normalized Routing Load Comparison .........................................................82
3.7.4. Routing Overhead Comparison......................................................................88
3.7.5. Drop Packets at Routing Overhead................................................................93
3.7.6. Drop Packets at End of Simulation Time Comparison ..................................97
3.7.7. Performance Analysis ...............................................................................100
3.7.7.1 Effect of Mobility ..................................................................................101
3.7.7.2 Routing Load Effect:..............................................................................101
3.8. Summary: ............................................................................................................101
Chapter 4 ....................................................................................................................107
Performance Analysis of Secure Routing Algorithm for Ad-hoc Sensor Mobile
Network......................................................................................................................107
4.1. SEAD Routing Protocol......................................................................................107
4.2. Results of simulation & Performance Analysis of Ad-hoc Secure Routing
Protocol ......................................................................................................................113
4.2.1 Packet delivery Comparison .........................................................................113
4.2.2 Average End-End Delays Packet delivery....................................................118
4.2.3 Normalized Routing Load Comparison ........................................................121
4.2.4 Routing Overhead Comparison.....................................................................125
4.2.5 Drop Packets at End Time of Simulation Comparison .................................128
4.2.6 Security Analysis and Evaluation .................................................................132
2
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 5 ....................................................................................................................136
Conclusion and Future Work .....................................................................................136
5.1. Conclusion ..........................................................................................................136
5.2. Future Work ........................................................................................................137
References ..................................................................................................................138
Publication .................................................................................................................143
Appendix A................................................................................................................144
Appendix B ................................................................................................................154
Appendix C ................................................................................................................162
Appendix D................................................................................................................170
Appendix E ................................................................................................................188
3
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
List of Abbreviations
4
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
5
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
List of Tables
6
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
List of Figures
Figure 1.1: sensor node hardware 13
Figure 1.2 Infrastructure wireless networks 15
Figure 1.3: Infrastructure network 16
Figure 1.4: Ad-hoc Network (peer to peer) 16
Figure 1.5: A two-tier mobile ad-hoc network. 18
Figure 1.6: A flat mobile ad-hoc network. 18
Figure 1.7: Example applications of MANET 19
Figure 2.1: Steps of Dijkstra's algorithm 26
Figure 2.2: Network I 26
Figure 2.3: Every node maintains a routing table 28
Figure 2.4: Node B broadcasts the new routing information to neighbors 28
Figure 2.5: Broadcasts to update tables of C, B, A with new entry of node D 29
Figure 2.6: Subnet and corresponding link state packets all six routers 29
Figure 2.7: Flooding example (hop count = 3) 30
Figure 2.8: Classification of ad-hoc routing protocols. 32
Figure 2.9: Every mobile node in the network maintains a routing table 34
Figure 2.10: Route Advertisement 35
Figure 2.11: Broken Link 35
Figure 2.12: New node add to topology 36
Figure 2.13: New node contact 36
Figure 2.14: Building of the route record during route discovery 37
Figure 2.15: Propagation of the route reply with route record 38
Figure 2.16: Data delivery 38
Figure 2.17: Route maintenance indicates a source route is broken 39
Figure 2.18: Node S is notified with a ROUTE ERROR packet 39
Figure 2.19: Propagation of the RREQ 41
Figure 2.20: Steps of propagation RREQ and reverse path of RREP 42
Figure 2.21: Path of the RREP and forward path to the source 43
Figure 2.22: Data delivery to the destination node D 43
Figure 2.23: Route maintenance indicates a link failure 44
Figure 2.24: Node is turn propagate the link failure notification 44
Figure2.25. Topology change in ad-hoc networks of nodes D 45
Figure 2.26: The release of message contents 46
Figure 3.1: Simulator usage 54
Figure 3.2: The basic structure of simulator Ns-2 55
Figure 3.3: Simulation procedure for running scenario. 62
Figure 3.4: Visualized in network animator 65
Figure 3.5: Movement node 6 at pause time 0 sec speed 2 m/s 66
Figure 3.6: Movement Node 6 at pause time 0 sec speed 20 m/s 66
Figure 3.7: (a) Packet delivery ratio at movement speed (2m/s and 20m/s) and
73
SIMT100s with 10 sources.
Figure 3.7: (b) Packet delivery ratio at movement speed (2m/s and 20m/s) and
73
SIMT500s with 10 sources.
Figure 3.7: (c) Packet delivery ratio at movement speed (2m/s and 20m/s) and
74
SIMT900s with 10 sources.
Figure 3.7: (d) Packet delivery ratio at movement speed (2m/s and 20m/s) and
74
SIMT100s with 20 sources.
Figure 3.7: (e) Packet delivery ratio at movement speed (2m/s and 20m/s) and
75
SIMT500s with 20 sources.
Figure 3.7: (f) Packet delivery ratio at movement speed (2m/s and 20m/s) and
75
SIMT900s with 20 sources.
7
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 3.7: (g) Packet delivery ratio at movement speed (2m/s and 20m/s) and
76
SIMT100s with 30 sources.
Figure 3.7: (h) Packet delivery ratio at movement speed (2m/s and 20m/s) and
76
SIMT500s with 30 sources.
Figure 3.7: (i) Packet delivery ratio at movement speed (2m/s and 20m/s) and
77
SIMT900s with 30 sources
Figure 3.8: (a) Average End-End delays at movement speed (2m/s and 20m/s) and
78
SIMT100s with 10 sources.
Figure 3.8: (b) Average End-End delays at movement speed (2m/s and 20m/s) and
78
SIMT500s with 10 sources.
Figure 3.8: (c) Average End-End delays at movement speed (2m/s and 20m/s) and
79
SIMT900s with 10 sources.
Figure 3.8: (d) Average End-End delays at movement speed (2m/s and 20m/s) and
79
SIMT100s with 20 sources.
Figure 3.8: (e) Average End-End delays at movement speed (2m/s and 20m/s) and
80
SIMT500s with 20 sources.
Figure 3.8: (f) Average End-End delays at movement speed (2m/s and 20m/s) and
80
SIMT900s with 20 sources.
Figure 3.8: (g) Average End-End delays at movement speed (2m/s and 20m/s) and
81
SIMT100s with 30 sources.
Figure 3.8: (h) Average End-End delays at movement speed (2m/s and 20m/s) and
81
SIMT500s with 30 sources.
Figure 3.8: (i) Average End-End delays at movement speed (2m/s and 20m/s) and
82
SIMT900s with 30 sources
Figure 3.9: (a) Normalized Routing load at movement speed (2m/s and 20m/s) and
83
SIMT100s with 10 sources.
Figure 3.9: (b) Normalized Routing load at movement speed (2m/s and 20m/s) and
84
SIMT500s with 10 sources.
Figure 3.9: (c) Normalized Routing load at movement speed (2m/s and 20m/s) and
84
SIMT900s with 10 sources.
Figure 3.9: (d) Normalized Routing load at movement speed (2m/s and 20m/s) and
85
SIMT100s with 20 sources.
Figure 3.9: (e) Normalized Routing load at movement speed (2m/s and 20m/s) and
85
SIMT500s with 20 sources.
Figure 3.9: (f) Normalized Routing load at movement speed (2m/s and 20m/s) and
86
SIMT900s with 20 sources.
Figure 3.9: (g) Normalized Routing load at movement speed (2m/s and 20m/s) and
86
SIMT100s with 30 sources.
Figure 3.9: (h) Normalized Routing load at movement speed (2m/s and 20m/s) and
87
SIMT500s with 30 sources.
Figure 3.9: (i) Normalized Routing load at movement speed (2m/s and 20m/s) and
87
SIMT900s with 30 sources
Figure 3.10: (a) Routing Overhead at movement speed (2m/s and 20m/s) and
89
SIMT100s with 10 sources.
Figure 3.10: (b) Routing overhead at movement speed (2m/s and 20m/s) and
89
SIMT500s with 10 sources.
Figure 3.10: (c) Routing overhead at movement speed (2m/s and 20m/s) and
90
SIMT900s with 10 sources.
Figure 3.10: (d) Routing overhead at movement speed (2m/s and 20m/s) and
90
SIMT100s with 20 sources.
Figure 3.10: (e) Routing overhead at movement speed (2m/s and 20m/s) and
91
SIMT500s with 20 sources.
Figure 3.10: (f) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
91
with 20 sources.
8
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 3.10: (g) Routing overhead at movement speed (2m/s and 20m/s) and
92
SIMT100s with 30 sources.
Figure 3.10: (h) Routing overhead at movement speed (2m/s and 20m/s) and
92
SIMT500s with 30 sources.
Figure 3.10: (i) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
93
with 30 sources
Figure 3.11: (a) Drop packets at routing overhead at movement speed (2m/s and
94
20m/s) and SIMT100s with 10 sources.
Figure 3.11: (b) Drop packets at routing overhead at movement speed (2m/s and
94
20m/s) and SIMT900s with 10 sources.
Figure 3.11: (c) Drop packets at routing overhead at movement speed (2m/s and
95
20m/s) and SIMT100s with 20 sources.
Figure 3.11: (d) Drop packets at routing overhead at movement speed (2m/s and
95
20m/s) and SIMT900s with 20 sources.
Figure 3.11: (e) Drop packets at routing overhead at movement speed (2m/s and
96
20m/s) and SIMT100s with 30 sources.
Figure 3.11: (f) Drop packets at routing overhead at movement speed (2m/s and 20m/s)
96
and SIMT900s with 30 sources
Figure 3.12: (a) Drop packets at end of simulation time at movement speed (2m/s and
97
20m/s) and SIMT100s with 10 sources.
Figure 3.12: (b) Drop packets at end of simulation time at movement speed (2m/s and
98
20m/s) and SIMT900s with 10 sources.
Figure 3.12: (c) Drop packets at end of simulation time at movement speed (2m/s and
98
20m/s) and SIMT100s with 20 sources.
Figure 3.12: (d) Drop packets at end of simulation time at movement speed (2m/s and
99
20m/s) and SIMT900s with 20 sources.
Figure 3.12: (e) Drop packets at end of simulation time at movement speed (2m/s and
99
20m/s) and SIMT100s with 30 sources.
Figure 3.12: (f) Drop packets at end of simulation time at movement speed (2m/s and
100
20m/s) and SIMT900s with 30 sources
Figure 4.1 (a) Ad-hoc network with 12 nodes. (b) Ad-hoc network with change in
108
location of the node 9.
Figure 4.2: Ad-hoc networks with value of hash in routing table entries for nodes 110
Figure 4.3: Ad-hoc networks with node(A) send update 112
Figure 4.4: Ad-hoc networks with node B detect broken link 112
Figure 4.5: (a) Packet delivery ratio at movement speed (2m/s and 20m/s) and
115
SIMT100s with 10 sources.
Figure 4.5: (b) Packet delivery ratio at movement speed (2m/s and 20m/s) and
115
SIMT900s with 10 sources.
Figure 4.5: (c) Packet delivery ratio at movement speed (2m/s and 20m/s) and
116
SIMT100s with 20 sources.
Figure 4.5: (d) Packet delivery ratio at movement speed (2m/s and 20m/s) and
116
SIMT900s with 20 sources.
Figure 4.5: (e) Packet delivery ratio at movement speed (2m/s and 20m/s) and
117
SIMT100s with 30 sources.
Figure 4.5: (f) Packet delivery ratio at movement speed (2m/s and 20m/s) and
117
SIMT900s with 30 sources
Figure 4.6: (a) Average End-End delay at movement speed (2m/s and 20m/s) and
118
SIMT100s with 10 sources.
Figure 4.6: (b) Average End-End delay at movement speed (2m/s and 20m/s) and
119
SIMT900s with 10 sources.
Figure 4.6: (c) Average End-End delay at movement speed (2m/s and 20m/s) and
119
SIMT100s with 20 sources.
9
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 4.6: (d) Average End-End delay at movement speed (2m/s and 20m/s) and
120
SIMT900s with 20 sources.
Figure 4.6: (e) Average End-End delay at movement speed (2m/s and 20m/s) and
120
SIMT100s with 30 sources.
Figure 4.6: (f) Average End-End delay at movement speed (2m/s and 20m/s) and
121
SIMT900s with 30 sources
Figure 4.7: (a) Normalized Routing load at movement speed (2m/s and 20m/s) and
122
SIMT100s with 10 sources.
Figure 4.7: (b) Normalized Routing load at movement speed (2m/s and 20m/s) and
122
SIMT900s with 10 sources.
Figure 4.7: (c) Normalized Routing load at movement speed (2m/s and 20m/s) and
123
SIMT100s with 20 sources.
Figure 4.7: (d) Normalized Routing load at movement speed (2m/s and 20m/s) and
123
SIMT900s with 20 sources.
Figure 4.7: (e) Normalized Routing load at movement speed (2m/s and 20m/s) and
124
SIMT100s with 30 sources.
Figure 4.7: (f) Normalized Routing load at movement speed (2m/s and 20m/s) and
124
SIMT900s with 30 sources
Figure 4.8: (a) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
125
with 10 sources.
Figure 4.8: (b) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
126
with 10 sources.
Figure 4.8: (c) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
126
with 20 sources.
Figure 4.8: (d) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
127
with 20 sources.
Figure 4.8: (e) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
127
with 30 sources.
Figure 4.8: (f) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
128
with 30 sources
Figure 4.9: (a) Drop packets at End of simulation time at movement speed (2m/s and
129
20m/s) and SIMT100s with 10 sources.
Figure 4.9: (b) Drop packets at End of simulation time at movement speed (2m/s and
129
20m/s) and SIMT900s with 10 sources.
Figure 4.9: (c) Drop packets at End of simulation time at movement speed (2m/s and
130
20m/s) and SIMT100s with 20 sources.
Figure 4.9: (d) Drop packets at End of simulation time at movement speed (2m/s and
130
20m/s) and SIMT900s with 20 sources.
Figure 4.9: (e) Drop packets at End of simulation time at movement speed (2m/s and
131
20m/s) and SIMT100s with 30 sources.
Figure 4.9: (f) Drop packets at End of simulation time at movement speed (2m/s and
131
20m/s) and SIMT900s with 30 sources
10
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 1
Introduction
11
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 1
Introduction
12
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
13
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
14
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
The mobile unit can move geographically while it is communicating. When it goes
out of range of one base station, it connects with a new base station and starts
communicating through it. This is called handoff. In this approach the base stations
are fixed [12]. The example in figure 1.3 shows a typical infrastructure network.
Serial data leaves the PC in an Ethernet frame, bound for the IP address of the
destination Wireless Device Server (WDS). It traverses a Local Area Network (LAN)
and is then converted to Wireless Ethernet at the Access Point. This data is received
by the WDS, which strips away the Ethernet header and presents the serial data to the
COM port. Multiple WDS could be used in the sphere of influence of each Access
Point [32].
15
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
16
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Ad-hoc networks are very useful in emergency search and rescue operations, meetings
or conventions in which persons wish to quickly share information and in data
acquisition operations in inhospitable terrain. Mobile ad-hoc networks (MANET) are
a new paradigm of wireless communication for mobile hosts. Hosts are always
represented as different nodes in the mobile ad-hoc networks. There is a number of
differences between mobile ad-hoc networks and traditional networks. Ad-hoc
networks do not rely on any fixed infrastructure. They rely on each other to keep the
network connected. Also, the topology of ad-hoc networks is dynamically changing
and its communication is based on wireless links. The definition of Mobile ad-hoc
network is a collection of wireless mobile nodes dynamically forming a temporary
network without the use of any existing network infrastructure or centralized
administration called peer to peer or ad hoc mode as shown in figure 1.4. Due to the
limited transmission range of wireless network interfaces, multiple hops may be
needed for one node to exchange data with another across the network [1], Ad-hoc
wireless networks are also self-organizing and adaptive, this means that a formed
network can be de-formed on the fly without the need for any system administration.
The term “ad-hoc” tends to imply that it can take different forms and that it can be
mobile, standalone, or networked [2]. There is a number of characteristics in mobile
ad-hoc networks. One of them is that there are dynamic topologies. Nodes are free to
move arbitrarily. Thus, the network topology is typically multi-hop (which means that
intermediate hosts must relay messages between hosts not in direct contact of each
other, which is called forwarding), so it may change randomly and rapidly at
unpredictable times. Another characteristic is bandwidth constrain. Wireless links will
continue to have significantly lower capacity than their hardwired counterparts. Also,
there is energy-constrained in the networks. Some or all of the nodes in a mobile ad-
hoc network may rely on batteries or other exhaustible means for their energy.
Finally, there is limited physical security. Mobile wireless networks are generally
more prone to physical security threats than are fixed-cable nets. The increased
possibility of eavesdropping, spoofing, and denial-of-service attacks should be
carefully considered [3].
Flat network Architecture: In this architecture, all nodes are treated equally, and
there is no gateway in a cluster [33]. An example of flat mobile ad hoc networks is
shown in figure1.6.
17
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
18
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
19
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1.2 Scope
As wireless sensor networks have been used in a lot of applications, monitoring nodes
in the network are needed for some applications. The important functions which need
to be monitored are the communicated data between each node, the movement of
nodes, etc.
The Scope of this master thesis is to use a simulator Ns-2 to support the mobility
wireless sensor network simulation, study simulator and has been designed as
analyzer module used to analyze the simulation output results with 6 performance
metrics an a two new performance metrics (drop packets at routing overhead and drop
packets at end of simulation time (trace files format). and to implement secure
routing algorithm protocol in simulator Ns-2, simulation, performance analysis and
comparing secure routing algorithm protocol with traditional routing algorithm
protocol and comparing between three routing algorithm of mobile ad-hoc network
20
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1.3 Objective
To achieve the scopes of this master thesis, some steps are required. The first: is
survey of ad-hoc sensory network, description of the operation of (routing algorithm
for ad-hoc networks and Security of Secure Routing algorithm protocol) and studying
simulator Ns-2 to analyze the output simulation results of trace file formats and design
analyzer module of performance metrics. Second: simulator Ns-2 is used in to
evaluation, comparison and performance analysis, between three mobile ad-hoc
routing algorithm protocols classification of flat routing protocols. Destination-
Sequenced Distance Vector (DSDV), Ad-Hoc On-Demand Distance Vector (AODV)
and Dynamic Source Routing (DSR), were currently implemented in simulator Ns-2.
Third: secure routing protocol SEAD: secure efficient distance vector routing for
mobile wireless ad-hoc networks is implemented in simulator network Ns-2,
simulation, performance analysis and comparing secure routing algorithm protocol
with traditional DSDV routing protocol. Finally comes the conclusion and suggestion
for future work.
1.4 Methodology
The research methodologies on sensor mobile ad-hoc routing algorithm protocols and
secure routing protocol evaluation has three parts:
First part Survey of ad-hoc sensory network and using simulator Ns-2, which
supports wireless networks is implemented to be used with the wireless sensor
network. This simulator is used to test different routing algorithms as one part of
simulation and to analyze the simulation output results of trace file formats in Ns-2
simulator that contained the data of our simulation to analyze the performance metrics
by design analyzer module, that can be shown in both text and graphical interface for
the events and for the illustration of network topology with the physical environment
as background.
Second part Ns-2 based simulator is used for evaluation, comparing different
simulation times (100s, 500s and 900s), connectivity sources (10, 20, 30 and 40) and
with two different maximum speeds of node movement 2meters per second &
20meters per second using Ns-2 simulator, simulation and performance analysis
between three different sensor mobile ad-hoc routing algorithm protocols
(Classification of flat routing protocols). Destination-Sequenced Distance Vector
(DSDV), Ad-Hoc On-Demand Distance Vector (AODV) and Dynamic Source
Routing (DSR). Which are currently implemented in Ns-2 simulator for sensor mobile
ad-hoc networking.
Third part One of the secure routing algorithm protocol is chosen SEAD: secure
efficient distance vector routing for mobile wireless ad-hoc networks and implement
the algorithm of protocol to simulator network Ns-2, simulation and performance
analysis with compared for different simulation times (100s and 900s), connectivity
sources (10, 20, 30 and 40), two different maximum speeds of node movement
2meters per second & 20meters per second and compared with traditional DSDV
routing protocol.
Finally Conclusion and future work.
21
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Finally, chapter 5 concludes the thesis and outlines future work. It summarizes the results
reported in chapter 3,4 and describes the achievements of this thesis and suggests future
work.
22
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix B attached implementation code Tcl script of simulation used to run Ns-2
simulator ver 2.31 and simulate (DSDV, DSR and AODV) routing protocols and
(SEAD) secure routing protocol for Ad-hoc sensor mobile networks.
Appendix C attached code of design analyzer module of new trace file formats for
Simulator Ns-2 ver 2.31. First implementations Java code to analyzer module of Trace
File Formats to records of the packets and computation of the performance metrics.
Second C/C++ Code to analyzer module the trace file formats records the movement
source node and movement of all source nodes at each simulation time.
23
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 2
24
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 2
Routing & Secure Algorithm for Ad-hoc Networks
2.1. Introduction
The term Routing is the process of choosing the path that individual packets should
follow through the network. The methodology used to decide the best route is called
the routing algorithm. The protocol used to exchange routing information between
nodes is called the routing protocol. To emphasize the special characteristics of a
MANET routing protocol, the following gives a brief overview of examining least-
cost algorithms that are a central part of routing in packets in networks and traditional
routing protocols for wired networks, these latter topics cover issues that are relevant
to routing algorithms.
25
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
programming language C++ tested program code c++ for three networks, each link is
labeled with its cost in both directions (see Appendix A).
For example, networks I as shown in figure 2.2. Ech link labeled with its cost in
both directions, the least cost of network I using Dijkstra’s algorithm as shown by the
result of applying this algorithm in Table 2.1 with source node A at each step, the
final iteration, the least-cost path (L) to each node and the cost of that path, have been
developed. The same procedure can be used with node B as source node, and so on.
Where T set of nodes.
26
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
I T L[B] path L[C] path L[D] path L[E] path L[F] path
0 A 1 A-B 0 ----- 4 A-D 0 ----- 0 -----
1 A,B 1 A-B 4 A-B-C 4 A-D 2 A-B-E 0 -----
2 A,B,E 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 6 A-B-E-F
3 A,B,E,C 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 5 A-B-E-C-F
4 A,B,E,C,D 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 5 A-B-E-C-F
5 A,B,E,D,C,F 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 5 A-B-E-C-F
Table 2.1: Dijkstra's algorithm with source node A of network I
h Lh[B] path Lh[C] path Lh[D] path Lh[E] path Lh[F] path
0 ∞ --- ∞ --- ∞ --- ∞ --- ∞ ---
1 1 A-B ∞ --- 4 A-D ∞ --- ∞ ---
2 1 A-B 4 A-B-C 4 A-D 2 A-B-E ∞ ---
3 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 6 A-B -C-F
4 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 5 A-B-E-C-F
5 1 A-B 3 A-B-E-C 3 A-B-E-D 2 A-B-E 5 A-B-E-C-F
Table 2.2: Bellman algorithm with source node A of network I
Another good way to practice the algorithm is to use the Web site [49]. With the Web
site, one can construct any graph used in this activity by creating vertices and
undirected. Bellman algorithm is implemented by programming language C++ tested
program code c++ for three networks; each link is labeled with its cost in both
directions (see Appendix A).
27
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
28
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 2.6: Subnet and corresponding link state packets all six routers [44]
29
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
2.3.3. Flooding
With this technique [43] every packet is sent to every node in the network and is
broadcasted by the receiving nodes exactly once [38]. Each node receiving the packet
broadcasts it to every neighboring node (in the wireless case, this means all nodes that
are within transmitter range), except the one it received it from. These neighboring
nodes in term do the same and so on as shown in figure 2.7. To avoid retransmitting
the same packet twice, every packet is tagged with a source address and a sequence
number which serve as a unique identifier. With these identifiers each node keeps
track of which packets they have transmitted. This approach has a very high
consumption of network resources since every packet is sent to every possible node to
ensure that the packet arrives to its destination. On the other hand, it results in an
extremely high delivery ratio.
30
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
2.4.1. Introduction
Within a mobile ad-hoc network, a node's radio transmission range typically cannot
cover the whole network. In order to enable a node to communicate with other nodes
out of its radio coverage, a route generally contains several intermediate nodes, and
this is why ad-hoc networks are also referred to as multi-hop networks. For data
communication in a network, a node must depend on routing protocols to discover
routes to the specific destinations. A mobile device is generally limited by its
available resources, such as computation capability and memory capacity. Moreover,
these devices are likely to be battery powered, so energy constraint is another
important issue that must be considered. Because of these resource limitations, routing
protocols designed for mobile ad-hoc networks must take special requirements into
account. Therefore, the existing routing protocols designed for wired networks are not
suitable for mobile ad-hoc networks, and new routing protocols have been designed
recently. So, it has become clear that routing in a MANET is fundamentally different
from traditional routing found on infrastructured networks [46]. Routing in a MANET
depends on many factors including topology, selection of routers and initiation of
request and specific underlying characteristic that could serve as a heuristic in finding
the path quickly and efficiently. The low resource availability in these networks
demands efficient utilization and hence the motivation for optimal routing in ad-hoc
networks. Also, the highly dynamic nature of these networks imposes severe
restrictions on routing protocols specifically designed for them.
31
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Interference: This is the major problem with mobile ad-hoc networks as links come
and go depending on the transmission characteristics, one transmission might interfere
with another one and node might overhear transmissions of other nodes and can
corrupt the total transmission.
Dynamic Topology: This is also the major problem with ad-hoc routing since the
topology is not constant. The mobile node might move or medium characteristics
might change. In ad-hoc networks, routing tables must somehow reflect these changes
in topology and routing algorithms have to be adapted. For example, in a fixed
network routing table updating takes place for every 30 sec [25]. This updating
frequency might be very low for ad-hoc networks.
32
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Protocol
Reactive Proactive
Points
Lower bandwidth is used for
maintaining routing tables.
A route can be selected
Advantages More energy-efficient.
immediately without delay.
Effective route maintenance.
33
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
received regarding the destination, as well as a new sequence number unique to the
broadcast [8].
Figure 2.9: Every mobile node in the network maintains a routing table
The route labeled with the most recent sequence number is always used. In the
event that two updates have the same sequence number, the route with the smaller
metric is used in order to optimize (shorten) the path. Mobiles also keep track of the
settling time of routes, or the weighted average time that routes to a destination will
fluctuate before the route with the best metric is received. By delaying the broadcast
of a routing update by the length of the settling time, mobiles can reduce network
traffic and optimize routes by eliminating those broadcasts that would occur if a better
route was discovered. The basic mechanisms each DSDV node maintains a routing
table listing the “next hop” for each reachable destination. DSDV tags each route with
a sequence number and considers a route R more favorable than R if R has a greater
sequence number, or if the two routes have equal sequence numbers but R has a lower
metric. Each node in the network advertises a monotonically increasing even
sequence number for itself as shown in figure 2.10 where node B advertises increases
Seq.# from 100 to 102 node B broadcasts routing information to neighbors node A,
C including destination sequence numbers with comparing to table inters in figure
2.9.
34
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
When a node B decides that its route to a destination node C has broken, it
advertises the route to node C with an infinite metric and a sequence number one
greater than its sequence number for the route that has broken (making an odd
sequence number) as shown in figure 2.11.
This causes any node A routing packets through B to incorporate the infinite-metric
route into its routing table until node A hears a route to node C with a higher sequence
number. When respond to topology changes the immediate node advertisements
information on new routes, broken links, and metric change is immediately
propagated to neighbor's node to full update or incremental update where full update
sends all routing information from its own table and incremental update send only
entries that have changed (make it fit into one single packet). For example, new node
35
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
D adds to the dynamic network topology then the node D broadcast the for first time
and sends sequence number D-000 to neighbor node C, where node C insert entry for
D with sequence number D-000, then immediately broadcasts its own table to node B
, etc. As shown in figure 2.12. When node D contact the node C increases its
sequence number to C-592 then broadcasts its new table, where node B gets this new
information and updates its table and etc. As shown in figure 2.13.
Advantages:
Simple (almost like Distance Vector), loop free through destination seq. numbers and
no latency caused by route discovery.
Disadvantages:
No sleeping nodes, bi-directional links required, overhead most routing information
never used, scalability is a major problem.
36
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
37
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
When destination node D receives ROUTE REQUEST, then the destination node D
sends ROUTE REPLY (RREP) to the source node S as shown in figure 2.15. Where
Route replies by reversing the route (as illustrated), it works only if all the links along
the route are bidirectional. Then, the source node S delivers data to the destination
node D as shown in figure 2.16 in the same row of route reply.
38
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
39
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
40
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
and initiates path discovery by broadcasting a route request packet RREQ to its
neighbors. The RREQ contains the following fields:
source-addr
source-sequence# :to maintain freshness information about the route to the
source.
dest-addr: of destination node
dest-sequence# - specifies how fresh a route to the destination node must be
before it is accepted by the source.
hop-counter
Where the (source-addr and broadcast-id) pair is used to identify the RREQ uniquely.
Then the dynamic route table entry establishment begins at all the nodes in the
network that are on the path from S to D.
41
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Intermediate nodes can reply to the RREQ only if they have a route to the destination
whose corresponding destination sequence number is greater than or equal to that
contained in the RREQ. During the process of forwarding the RREQ, intermediate
42
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
nodes record in their route tables the address of the neighbor from which the first copy
of the broadcast packet is received, thereby establishing a reverse path. If additional
copies of the same RREQ are later received, these packets are discarded. Once the
RREQ reaches the destination or an intermediate node with a fresh enough route, the
destination/intermediate node responds by uncasting a route reply (RREP) packet
back to the neighbor from which it first received the RREQ as shown in figure 2.21.
As the RREP is routed back along the reverse path, nodes along this path set up
forward route entries in their route tables which point to the node from which the
RREP came as shown in figure 2.21. These forward route entries indicate the active
forward route. Associated with each route entry is a route timer which will cause the
deletion of the entry if it is not used within the specified lifetime. Because the RREP
is forwarded along the path established by the RREQ, the source node S delivers data
to the destination node D as shown in figure 2.22, the same row of forward path,
AODV, only supports the use of symmetric links.
Figure 2.21: Path of the RREP and forward path to the source
43
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Routes maintenance work when indicates a link failure as shown in figure 2.23, where
a source node moves, it is able to reinitiate the route discovery protocol to find a new
route to the destination. Or if a node along the route moves, its upstream neighbor
notices the move and propagates a link failure notification message (an RREP with
infinite metric) to each of its active upstream neighbors to inform them of the erasure
of that part of the route.
These nodes in turn propagate the link failure notification to their upstream neighbors,
and so on until the source node is reached by route reply RREP with infinite metric
(∞) and increment dest-sequence# one as shown in figure 2.24.
The source node may then choose to reinitiate route discovery for that destination if a
route is still desired
44
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
2.5. Security
Ad-hoc networks are a new paradigm of wireless communication for mobile hosts.
No fixed infrastructure such as base stations is mobile switching .Nodes within each
other radio range communicate directly via wireless links while these which are far
apart rely on other nodes to relay messages. Node mobility causes frequent changes in
topology. Figure 2.25 shows such an example: nodes A, B, C, D, E, and F constitute
an ad-hoc network. The circle represents the radio range of node A. Initially nodes A
and D have a direct link between them. When D moves out of A’s radio range, the
link is broken. However, the network is still connected, because A can reach D
through C, E, and F.
Security is a fundamental issue that needs resolution before ad-hoc networks will
experience large scale deployment [57]. The characteristics of mobile ad-hoc
networks, as given in Chapter 2 Section 2.4.2, pose numerous challenges to achieving
conventional security goals. Since the nodes are responsible for basic network
functions, like packet forwarding and routing, network operations can be easily
jeopardized if countermeasures are not integrated into these network functions at the
early stages of design. For example, some existing routing protocols given in Chapter
2 for mobile ad-hoc networks may be able to manage the dynamic network topology
of mobile ad-hoc networks, but none of these protocols incorporate mechanisms to
prevent, tolerate or defend against attacks from malicious adversaries. Due to the
close relationship between security and the characteristics of ad-hoc networks these
protocols will have to be fundamentally altered or re-designed to effectively
incorporate security mechanisms. This is clear if one considers the number of secure
routing protocols (Ariadne [58], SEAD [55], ARAN [59], and SRP [60]) that followed
the insecure routing protocols.
Security support is of grave importance to military communications, for military
tactical operations are still the main application of ad-hoc networks today that we
need for secure routing protocol. For example, military units (e.g., soldiers, tanks, or
planes), equipped with wireless communication devices, could form an ad-hoc
network when they roam in a battlefield. Ad-hoc networks can also be used for
emergency, law enforcement, and rescue missions. Since an ad-hoc network can be
deployed rapidly with relatively low cost, it becomes an attractive option for
commercial uses such as sensor networks or virtual classrooms.
45
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
46
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
47
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Note that the active attacks present the opposite characteristics of passive attacks.
Whereas passive attacks are difficult to detect, measures are available to prevent their
success. On the other hand, it is quite difficult to prevent active attacks absolutely,
because of the wide variety of potential physical, software, and network
vulnerabilities. Instead, the goal is to detect active attacks and to recover from any
disruption or delays caused by them. If the detection has a deterrent effect, it may also
contribute to prevention.
48
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
but can monitor the traffic between communication entities from a safe distance
[68]. Since the adversary in general (and particularly in the case of commercial
networks) can obtain the necessary communication equipment to demodulate the
signal, encryption remains the most effective solution to defend against
eavesdropping.
Denial of Service: In denial of service (DoS) the attack results when the network
bandwidth is hijacked by a malicious node. It has many forms: the classic way is to
flood any centralized resource so that the network no longer operates correctly or
crashes. For instance, a route request is generated whenever a node has to send data
to a particular destination. A malicious node might generate frequent unnecessary
route requests to make the network resources unavailable to other nodes [72]. Also,
in denial of service attacks, the adversary prevents the normal use or management of
network facilities or functionality. DoS attacks can be launched at any layer of an
ad-hoc network to exhaust node resources [57]. On the physical and medium access
control layers a DoS attack, for example jamming, can be employed to impair
network availability. Jamming occurs when a malicious node deliberately emanates
a signal from a wireless device in order to overwhelm legitimate wireless signals
[65, 67]. On the network layer, an adversary could disrupt the routing fabric by
manipulating routing control packets. On higher layers, an adversary could attack
essential services, such as the key management protocol. DoS can also be caused by
the constant request of network services by an adversary even if these services are
denied. For example, hello flooding can be seen as a type of DoS attack. An attacker
can use traffic diversion to cause large amounts of data to be sent to a victim node
from some set of nodes controlled by the attacker called a Stealth Attacks [66].
Impersonation: A malicious node may impersonate another node while sending the
control packets to create an anomaly update in the routing table [72]. Without strong
authentication mechanisms in place, insider or outside adversaries can masquerade
as an authorized user and attempt to access network services [73]. This problem
becomes even more difficult to solve in open fully self-organized MANETs which
do not have any form of access control.
Cryptanalytic Attacks: Cryptanalysis is the study of mathematical techniques and
procedures used to break cryptographic techniques, procedures and algorithms, i.e.
defeating the objective of the intended service [69] called breaking an information
security service. Adversaries exploit cryptanalytic techniques to discover
cryptographic keys or derive confidential information from the recorded encrypted
data sent between communication entities. These types of attacks are however
seldomly used due to cryptanalytic complexity and/or vast computational and
memory requirements. The probability of a security hole existing elsewhere is
generally much higher depending on what cryptographic algorithms are used. A
careful analysis is still essential when selecting cryptographic algorithms to avoid a
cryptanalytic attack. Factors to consider when choosing a cryptographic scheme are:
Is the algorithm widely used? How important is the information it is protecting?
And does it have a good history of cryptanalysis? Successful cryptanalysis can also
be made more difficult by limiting the amount of information available for
cryptanalysis.
Wormhole Attacks: The wormhole attack is a severe attack against the routing
protocols of ad-hoc networks made possible by the shared wireless medium. In a
wormhole attack, an adversary records packets (routing information) at one location
in the network, tunnels the recorded data via a private network or connection to
another location in the network, and re-transmits the recorded data into the network
49
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
[70, 71]. This disrupts the routing infrastructure and consequently prevents a routing
protocol, without a protection mechanism, from finding routes more than one or two
hops from the node requesting routing services.
Sink hole and Black hole Attacks: During a black hole attack, a malicious node
uses the routing protocol to advertise itself as having the shortest path to the node
whose packets it wants to intercept. We provide a detailed description herein [63,
72]. The black hole attack: The attacker forms part of the network and interferes in
the route discovery phase of the routing protocol [58]. By sending forged routing
packets the attacker routes all packets for another destination to itself. The attacker
then disrupts the routing protocol by creating a routing black hole or sink hole in
which all packets are dropped. The attacker could also selectively drop packets by
creating a gray hole, for example, by forwarding all routing packets but no data
packets [58].
Routing table overflow Attacks: The attacker attempts to create routes to
nonexistent nodes. The goal is to have enough routes so that creation of new routes
is prevented or the implementation of routing protocol is overwhelmed [63].
Replay Attacks: In a replay attack on the routing infrastructure an adversary sends
old route advertisements to a node causing it to update its routing table with stale
routes [75]. The attacker may also record packets sent between legitimate network
nodes on the application layer and replay these recorded packets in order to gain
unauthorized access to network services or overload a node with outdated
information resulting in denial of service.
Energy consummation: Energy is a critical parameter in the MANET. Battery-
powered devices try to conserve energy by transmitting only when absolutely
necessary. An attacker can attempt to consume batteries by requesting routes or
forwarding unnecessary packets to a node [72].
50
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
As a result, in the following table 2.5, a comparison between some of the most
established secure routing protocols with respect to some performance and security
parameters is given so as to facilitate the choice of one of them to work on[78]:
Performance
ARAN ARIADNE SAODV SAR SEAD SLSP SRP
Parameters
Confidentiality Yes No No No No No No
As a result of this comparison, the researcher has ended up choosing to work with
(SEAD): Secure efficient ad-hoc distance vector routing protocol, as the selected
secure routing protocol. It will be shown how this SEAD protocol was built based
upon the early above mentioned security requirements and will be secure routing
algorithm protocol (SEAD) implemented in simulator Ns-2, simulation, performance
analysis and using secure routing algorithm protocol (SEAD) compared with
traditional routing algorithm protocol (DSDV). See Chapter 4 section 4.1, where the
operation and implementation of SEAD are described.
2.6. Summary
In this chapter there was a discussion of existing routing protocols so as to understand
routing principles in a MANET. It is a good idea to take a look at a brief overview of
examined least-cost algorithms that are a central part of routing in packets in networks
51
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
and conventional routing algorithms such as distance vector, link state and flooding
routing. This is because many of the routing protocols for a MANET have roots in
traditional routing concept as underlying algorithm. In mobile ad-hoc networks
routing protocols are classified as routing protocols in MANET can be done in many
ways, but most of these are done depending on routing strategy and network structure,
as flat routing, hierarchical routing, geographic position assisted routing and security
routing and their existing proactive, reactive advantages and disadvantages were
presented. Then, three routing algorithm protocols (DSDV, DSR and AODV) were
chosen and their operation described. Ad-hoc network security should consider the
following fundamental attributes requirements for designing a secure routing protocol
to defend against security breaches were mentioned, some adversary models and the
different types of attacks targeting MANET routing protocols were explored. Then
comparison between some of the existing secure mobile ad-hoc routing protocols was
given. One of the secure routing protocols was built following the fundamental secure
routing protocol design methodology, the secure efficient ad-hoc distance vector
routing protocol (SEAD).
52
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 3
53
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 3
Comparison and Performance Analysis of Ad-hoc Routing
Protocols & Results
3.1. Introduction
Simulator Ns-2 is used because this simulation environment consists of a set of
wireless and mobile networking extensions, Also, Ns-2 simulator is used because its
network a popular and powerful simulation environment, and the number of Ns-2
users has increased greatly in recent years. Although it was originally designed for
wired networks, Ns-2 has been extended to work with wireless networks, including
wireless LANs, mobile ad-hoc networks MANET, and sensor networks and can
simulate several network protocols such as TCP, UDP, multicast routing, etc;
however, the Network Animator (NAM) for Ns-2 is used as a visualization tool [28].
Ns-2 is primarily useful for simulating local and wide area networks usage (see figure
3.1 [27]). More recently, support has been added for simulation of large satellite and
ad-hoc wireless networks.
54
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
of a wireless network and allow arbitrary movement of nodes within the network. At
the physical layer, a realistic modeling of factors is provided such as free space and
ground reflection propagation, transmission power, antenna gain, receiver sensitivity,
propagation delay, and carrier sense. At the link layer with model there are the
complete Distributed Coordination Function (DCF), Media Access Control (MAC),
protocol of the IEEE 802.11, wireless LAN protocol standard IEEE 1997, along with
the standard Internet Address Resolution Protocol (ARP) Plummer 1982. These
wireless and mobile networking extensions are available from the Carnegie Mellon
University Monarch Project [19] and have been widely used by other researchers; a
version of them have also now been adopted as a part of the standard VINT release of
Ns-2. That has done a simulation Ns-2 study with this environment, analyzing the
behavior and performance of routing protocols and comparing it to other proposed
routing protocols for ad-hoc networks [1, 20, 21].
To setup and run a simulation, a user writes an OTcl script (object-oriented Tool
command language) [17], which is a simulation program to initiate an event
scheduler, set up the network topology using the network objects and plumbing
functions in the library, and to tell traffic sources when to start and stop transmitting
packets through the event scheduler. When Ns-2 which works as OTcl interpreter
receives the OTcl script, it will set environment parameters following the received
script. If a user wants to make a new network object, it will be easy to make a
compound object from the object library, and plumb the data path through the object
rather than write a new one. When the simulation is finished, the simulation results
are produced in one or more text-based output files that contain detailed simulation
data, which can be used to analyze directly or can be used in the graphical user
interface NAM [28]. This graphical user interface shows the simulation result in an
easy way. The language that is written in Ns-2 is not only OTcl but also C++. The
event scheduler and the basic network component objects in the data path are written
and compiled using C++ to reduce packet and event processing time. These compiled
objects need the OTcl linkage to create a matching OTcl object for each of the C++
objects to be able to work with OTcl interpreter. It can run both in Unix and
Windows, (for more details see appendix E).
55
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
s -t 12.786100000 -Hs 18 -Hd -2 -Ni 18 -Nx 274.68 -Ny 149.81 -Nz 0.00 -Ne -1.000000 -Nl AGT -Nw
--- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 18.0 -Id 19.0 -It cbr -Il 1024 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
r -t 12.786100000 -Hs 18 -Hd -2 -Ni 18 -Nx 274.68 -Ny 149.81 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw
--- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 18.0 -Id 19.0 -It cbr -Il 1024 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
s -t 12.790995225 -Hs 18 -Hd -1 -Ni 18 -Nx 274.68 -Ny 149.81 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw
--- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 18.255 -Id 19.255 -It DSR -Il 32 -If 0 -Ii 1 -Iv 32 -P dsr -Ph 1 -Pq 1 -
Ps 1 -Pp 0 -Pn 1 -Pl 0 -Pe 0->0 -Pw 0 -Pm 0 -Pc 0 -Pb 0->0
r -t 12.791807459 -Hs 40 -Hd -1 -Ni 40 -Nx 339.20 -Ny 122.05 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw
--- -Ma 0 -Md ffffffff -Ms 12 -Mt 800 -Is 18.255 -Id 19.255 -It DSR -Il 32 -If 0 -Ii 1 -Iv 32 -P dsr -Ph 1
-Pq 1 -Ps 1 -Pp 0 -Pn 1 -Pl 0 -Pe 0->0 -Pw 0 -Pm 0 -Pc 0 -Pb 0->0
f -t 12.872979638 -Hs 33 -Hd -1 -Ni 33 -Nx 424.81 -Ny 246.62 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw
--- -Ma 0 -Md ffffffff -Ms 12 -Mt 800 -Is 18.255 -Id 19.255 -It DSR -Il 48 -If 0 -Ii 3 -Iv 32 -P dsr -Ph 2
-Pq 1 -Ps 2 -Pp 0 -Pn 2 -Pl 0 -Pe 0->0 -Pw 0 -Pm 0 -Pc 0 -Pb 0->0
d -t 13.186985188 -Hs 18 -Hd 4 -Ni 18 -Nx 275.08 -Ny 149.78 -Nz 0.00 -Ne -1.000000 -Nl IFQ -Nw
ARP -Ma 0 -Md 0 -Ms 12 -Mt 800 -Is 18.0 -Id 19.0 -It cbr -Il 1076 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0
-Po 0
After the simulation we obtain the trace file format, which contains the packet dump
from the simulation, each simulation trace files records the traffic and node
movements are generated. These files need to be analyzed in order to extract the
information needed to measure the performance metrics. The new trace format was
used for analyzing the trace file format for DSDV, DSR and ADOV protocols. For
example, the new trace format looks like:
s -t 0.267662078 -Hs 0 -Hd -1 -Ni 0 -Nx 5.00 -Ny 2.00 -Nz 0.00 –Ne -1.000000 -Nl RTR -Nw --
- -Ma 0 -Md 0 -Ms 0 -Mt 0 –Ii 20 -Is 0.255 -Id -1.255 –It
The format of this trace file for ad-hoc wireless networks is as N: Node Property, I: IP
Level Packet Information, H: Next Hop Information, M: MAC Level Packet
Information, P: Packet Specific Information. Here, from the above trace file format
and table 3.1, we see that a packet was sent (s) at time (t) 0.267662078 sec, from
source node (Hs) 0 to destination node (Hd) 1. The source node id (Ni) is 0, its x-
coordinate (Nx) is 5.00, its y-coordinate (Ny) is 2.00, its z-coordinate (Nz) is 0.00, its
energy level (Ne) is 1.000000, the trace level (Nl) is RTR and the node event (Nw) is
blank. The MAC level information is given by duration (Ma) 0, destination Ethernet
address (Md) 0, the source Ethernet address (Ms) is 0 and Ethernet type (Mt) is 0. The
IP packet level information like packet id (Ii), source address. Source port number is
given by (Is) while the destination address. Destination port number is (Id).
56
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
r=> receive
Function java code used (see our implementation code to analysis trace file format in
Appendix C) is as follow:
57
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
if(tokens[0].equals("r")&&tokens[18].equals("AGT")&&tokens[34].equals("cbr"))
receives++;
S=> send
f = > forward
RTR=> Routing Trace Level
Function java code used (see our implementation code to analysis trace file in
Appendix C) as:
if((tokens[0].equals("s")||tokens[0].equals("f"))&&tokens[18].equals("RTR")&&(toke
ns[34].equals("AODV")||tokens[34].equals("DSR")||tokens[34].equals("message")))
routing_packets++;
-t=> time
if (tokens[0].equals("s")||tokens[0].equals("r")||tokens[0].equals("f"))
{
// parse the time
if(tokens[1].equals("-t"))time=Float.valueOf(tokens[2]).floatValue();
// parse the packet_id
if(tokens[39].equals("-Ii"))packet_id= Integer.valueOf(tokens[40]).intValue();
// calculate the sent packets
if(tokens[0].equals("s")&&tokens[18].equals("AGT")&&tokens[34].equals("cbr"))
sends++;
// find the number of packets in the simulation
if(packet_id >highest_packet_id) highest_packet_id = packet_id;
// set the start time, only if it is not already set
if (start_time[packet_id]==0) start_time[packet_id]=time;
// calculate the receives and end-end delay
if(tokens[0].equals("r")&&tokens[18].equals("AGT")&&tokens[34].equals("cbr"))
{
receives++;
end_time[packet_id]=time;
}
else end_time[packet_id] = -1;
}
58
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
d = > drop
RTR = > Routing Trace Level
Function java code used (see our implementation code to analysis trace file in
Appendix C) as:
if(tokens[0].equals("d")&&tokens[18].equals("RTR")&&(tokens[34].equals("AODV"
)||tokens[34].equals("DSR")||tokens[34].equals("message")))routing_drops++;
S & r & d & f / -t 0.267662078 -Hs 0 -Hd -1 -Ni 0 -Nx 5.00 -Ny 2.00 -Nz 0.00
S= send. & r= received & f= forward & d=drop
See function C++ code used of our implementation code to analysis trace file in
Appendix C.
59
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
C). As the first two metrics are the most important for best effort traffic, the routing
load metric evaluates the efficiency of the routing protocol. Note, however, that these
metrics are not completely independent. For example, lower packet delivery fraction
means that the delay metric is evaluated with fewer samples. In the conventional
wisdom, the longer the path lengths, the higher the probability of a packet drops.
Thus, with a lower delivery fraction, samples are usually biased in favor of smaller
path lengths and thus have less delay. So that another metrics is used to evaluate all
routing protocols for each simulation run in section 3.3.5, 3.3.6. The code program
used to analyze the trace files format is added to Appendix-C. This file is used to
record the packets and compute the following metrics
60
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
3.4. Simulation
A detailed simulation model based on Ns-2 simulator is used in the evaluation. To use
simulator Ns-2 to support the mobility wireless sensor network simulation first:
implement analyzer module of simulation result (output trace file format) that can
make comparison and performance analysis between three mobiles ad-hoc routing
algorithm protocols (Classification of flat routing protocols). Destination-Sequenced
Distance Vector (DSDV), Ad-Hoc On-Demand Distance Vector (AODV) and
Dynamic Source Routing (DSR) are implemented already in Ns-2. The first one is a
proactive protocol depending on routing tables which are maintained at each node.
The second and third is a reactive protocol, which finds a route to a destination on
demand, when every communication is needed. Considering the bandwidth,
throughput and packet loss, in DSDV, DSR and AODV routing protocols, DSDV is
best suited for only smaller networks, DSR and AODV is suited for general ad-hoc
networks. Second: implement secure routing algorithm protocol in simulator Ns-2 that
can evaluate, compare and analyze of the secure routing algorithm protocol which is
compared to traditional routing algorithm protocol. The parameters used for our
simulation are given in table 3.2.
Parameter Value
Number of Nodes 50
Area size of the topography x(m) 1000m
Area size of the topography y(m) 1000m
Traffic type Cbr
Wireless range 150 m
Number of traffic sources 10 , 20 , 30
Send rate of Traffic 1 packets/ Second
Speed 2 m/s & 20 m/s
Packet size 512 byte
Simulation Time (Second) 100 s ,500s, 900 s
Pause Time (s) at time simulation 100s 0 , 10 , 20 , 40 ,100 Second
Pause Time (s) at time simulation 500s 0 , 50 , 100 , 200 , 300 , 400 ,500 Second
Pause Time (s) at time simulation 900s 0 , 50 , 100 , 300 , 600 , 800 ,900 Second
Table 3.2: Scenario for the simulator Ns-2 experiments
61
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 3.3: Simulation procedure for running scenario, where the block (analyzer module of our
code) has been designed with 6 performance metrics including two new performance metrics
(drop packets at routing overhead and drop packets at end of simulation time), movement node
module and added implementation of secure routing protocol (SEAD), where simulator Ns-2 is
not supported for any secure routing protocols in MANET.
62
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
/home/administrator/ns-allinone2.31/ns-2.31/indep-utils/cmu-scen-gen/
This utility is used to generate trace files for specifying the type, duration and the rate
of traffic flow in the network. The utility can be invoked by calling the Tcl script
cbrgen.tcl as follows:
63
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
$ ns filename.tcl
Some small scripts can also be run in command line mode. For this, just type ns and
enter your commands line by line. So in this section we present a walkthrough of the
script which is used to run the simulation for analyzing the performance of routing
protocols in MANET. The script can be used to simulate any kind of routing protocol
desired. We are writing the Tcl code to set up the wireless simulation components:
network components types, parameters like the type of antenna, the radio-propagation
model, the type of ad-hoc routing protocol, traffic models and node movement models
used by mobile nodes etc. Our Implementation of simulation code Tcl script used to
simulate (DSDV, DSR and AODV) routing protocols and (SEAD) secure routing
protocol is available in the Appendix B.
64
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
$ nam filename.tr
We have shown the movement node and the connectivity of network in figure 3.4.
The output trace file format of network simulator Ns-2 can be analyzed to obtain the
movement of nodes so that we used mobility model called random waypoint model
[23] in a rectangular field. The field configurations used is 1000 m x 1000 m field
with 50 nodes as shown in table 3.7. From analyzing trace file format it is shown that
the movement node at simulation time 900s of different pause time and movement
speed (2m/s and 20m/s) is as shown in figure (3.5 and 3.6), which show the
movement of the random waypoint mobility model, each mobile node begins at a
random location and moves independently during the simulation. Each node remains
stationary for a specified period that we call the pause time and then moves in a
straight line to some new randomly chosen location at a randomly chosen speed up to
some maximum speed. Once reaching that new location, the node again remains
stationary for the pause time, and then chooses a new random location to proceed to at
some new randomly chosen speed, and the node continues to repeat this behavior
throughout the simulation run. Our implementation code C/C++ is used as analyzer
module to record the movement source node and movement of all source node at each
simulation time is attached to Appendix C.
65
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
66
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
route to the destination of that packet. We were not attempting to measure the
protocols’ performance on a particular workload taken from real life, but rather to
measure the protocols’ performance under a range of 6 metrics. The routing protocols
(DSDV, DSR, and ADOV) and SEAD: Secure efficient ad-hoc distance vector
routing protocol evaluations are based on the simulation of 50 wireless nodes forming
an ad-hoc network, moving about over a rectangular (1000m×1000m) flat space for
different simulation time as in table 3.2. We choose a space in order to force the use
of longer routes between nodes. The physical radio characteristics of each mobile
node’s network interface, include the antenna gain, transmit power, and receiver
sensitivity. In order to enable direct, fair comparisons between the protocols, it was
critical to challenge the protocols with identical loads and environmental metrics.
Each run of the simulator accepts as input a scenario file that describes the exact
motion of each node and the exact sequence of packets originated by each node,
together with the exact time at which each change in motion or packet origination is to
occur. We pre-generated 38 different scenario files with varying movement patterns
of mobility model at all pause time of simulation used random waypoint model [23,
24] for each movement speed (at the lower movement speed of 2 meter/second & at
the higher movement speed of 20 meter/second) and four files traffic loads as shown
in table 3.3, and then run simulator Ns-2 for three routing protocols (DSDV, DSR,
and ADOV) and SEAD: Secure efficient ad-hoc distance vector routing protocol
against each of these scenario files. Since each protocol was challenged in an identical
fashion, we can directly compare the performance results of the three routing
protocols and SEAD: Secure efficient ad-hoc distance vector routing protocol.
900
10
20
40
50
13
0
Time
Scenario parameter files with 5x2
0,10,20,40,100s
varying movement patterns of 7x2x2
0,50,100,200,300,400,500s
mobility model used random
0,50,100,300,600,800,900s
waypoint model 38
Number of traffic sources 10 20 30
Traffic pattern parameters
4 3
load files
Table 3.3: Total of generation Parameters input files of simulator Ns-2 at all Pause
time of simulation for all routing protocols
We run simulator Ns-2 by writing the simulation code tcl script files which is
available in Appendix B and more details of tcl script (Tool command language) see
the tutorial of network simulator Ns-2 [26] , to set up the wireless simulation
components: network components types, parameters like the type of antenna, the
radio-propagation model, the type of ad-hoc routing protocol, traffic models and node
movement models used by mobile nodes etc. with movement patterns generated for 5
different pause times: 0 , 10 , 20 , 40 , and 100 seconds for simulation time 100
seconds , 7 different pause times: 0 , 50 , 100 , 200 , 300 , 400 and 500 seconds for
simulation time 500 seconds and 7 different pause times: 0 , 50 , 100 , 300 , 600 , 800
and 900 seconds for simulation time 900 seconds. A pause time of 0 seconds
corresponds to continuous motion, and a pause time of 100 (the length of the
67
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
simulation) corresponds to no motion at simulation time 100 seconds and a pause time
of 500 and 900 (the length of the simulation) corresponds to no motion at simulation
time 500 and 900 seconds. Because the performance of the protocols is very sensitive
to movement pattern, we generated movement pattern scenario 38 files, for each value
of pause time, with each movement speed (at the lower movement speed of 2 m/s & at
the higher movement speed of 20 m/s) and four traffic communication sources model
files of 10, 20, 30 sources as in table 3.3, for all three routing protocols and SEAD:
Secure efficient ad-hoc distance vector routing protocol, was run on the same
movement patterns within environment of attackers. We experimented with two
different maximum speeds of node movement. We primarily report in this thesis data
from simulations using a maximum node speed of 2 meters per second, but also
compare this to simulations using a maximum speed of 20 meter per second. From
table (3.4, 3.5 and 3.6) after running simulator Ns-2, we produce generation outputs
trace file formats at simulation time 100s, 30 trace file formats, at simulation time
500s, 42 trace file formats and at simulation time 900s, 42 trace file formats for each
routing protocol. From table 3.7 the total generation outputs trace file formats of
simulator Ns-2 at simulation time 100,500,900 seconds for each routing protocols are
114 trace file formats and animator file formats, for only one simulation of routing
protocol at each pause time and the number of traffic pattern parameters load files and
scenario parameters file with varying movement patterns of mobility model used
random waypoint model.
68
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
finally, from running simulator Ns-2 the simulation results of all routing protocols
(DSDV, DSR, ADOV and SEAD) are as shown in table 3.8, where the DSDV routing
protocol produces generation 128 output trace file formats for all simulation time and
animator file formats for all simulation time used, the DSR routing protocol produces
generation 128 output trace file formats and animator file formats for all simulation
time used, the AODV routing protocol produces generation 128 output trace file
formats and animator file formats for all simulation time used but for SEAD: Secure
efficient ad-hoc distance vector routing protocol produces generation 72 output trace
file formats and animator file formats for all simulation time used.
The total of all generation 456 output trace file formats and animator file formats,
at each simulation time depending of the time simulation of routing protocols used as
shown in table 3.8. The trace files format outputs most important step in our
experiment is to analyze the output file formats from the simulation. After the
simulation, we obtain the trace file which contains the packet dump from the
simulation. The format of this trace file for ad-hoc wireless networks, depending on
the packet type, the trace file may log additional information [14, 29]. By using our
code to analyzer module attached to Appendix C, to analyzer the 456 output trace file
formats to record the packets and compute the performance metrics graphs that are
described in section 3.3, and the output trace files may also be visualized in network
animator (nam) that is described in section 3.5.5.
69
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
DSR Yes Yes Yes Yes Yes Yes Yes Yes Yes 128
AODV Yes Yes Yes Yes Yes Yes Yes Yes Yes 128
70
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
similar for both protocols at lower pause times with higher mobility. So for DSR and
AODV, packet delivery ratio is independent of offered traffic load, with both
protocols delivering between 95% and 100% of the packets.
The on-demand protocols, AODV and DSR perform better than the table-driven
DSDV protocol. Where DSDV delivering over 70% of the data packets regardless of
mobility rate as shown in figures 3.7(a, d and g) with the lower movement speed of
(2m/s) for 10,20 and 30, but DSDV loses about 50% more packets than AODV and
DSR for lower 10s pause times (higher mobility) at 10 and 20 sources. Nearly all of
the dropped packets are lost because a stale routing table entry directed them to be
forwarded over a broken link.
At the higher movement speed of 20 meter/second as shown in figures 3.7(a, d and g),
the on-demand protocols, DSR and AODV performed particularly well, delivering
over 90% of the data packets regardless of mobility rate at pause time 40s as shown in
figures 3.7(a, d and g) with the high movement speed of (20 meter/second) for 10,20
and 30 sources which were very similar for both protocols at high pause times with
lower mobility. So for DSR and AODV, packet delivery ratio is independent of
offered traffic load, with both protocols delivering between 75% and 90% of the
packets at 10 sources, but at 20 and 30 sources both protocols delivering between 80%
and 90% of the packets.
The on-demand protocols, AODV and DSR perform better than the table-driven
DSDV protocol. DSDV delivers over 70% of the data packets regardless of mobility
rate as figures 3.7(a, d and g) with the high movement speed of (20m/s) for 10,20 and
30, but DSDV loses about 20% more packets than AODV and DSR for lower 40s
pause times (higher mobility) at 10 and 30 sources. Nearly all of the dropped packets
are lost because a stale routing table entry directed them to be forwarded over a
broken link.
b)- Simulation time 500 seconds
At the lower movement speed of 2 meter/second, the On-demand protocols, DSR and
AODV performed particularly well, delivering over 95% of the data packets
regardless of mobility rate as shown in figures 3.7 (b, e and h) with the lower
movement speed of (2 meter/second) for 10, 20 and 30 sources which were very
similar for both protocols at lower pause times with higher mobility. So for DSR and
AODV, packet delivery ratio is independent of offered traffic load, with both
protocols delivering between 95% and 100% of the packets.
The on-demand protocols, AODV and DSR perform better than the table-driven
DSDV protocol. Where DSDV delivering over 70% to 80% of the data packets of
mobility rate as shown in figures 3.7(b and e) with the lower movement speed of
(2m/s) for 10 and 20, but DSDV loses about 40% more packets than AODV and DSR
for lower 10s pause times (higher mobility) at 10 and 20 sources. Nearly all of the
dropped packets are lost because a stale routing table entry directed them to be
forwarded over a broken link. At 30 sources the DSDV delivers over 80% to 90% of
the data packets of mobility rate as shown in figure 3.7(h) with the lower movement
speed of (2m/s).
At the higher movement speed of 20meter/second as shown in figures 3.7(b, e and h),
the on-demand protocols, DSR and AODV performed particularly well, delivering
over 90% of the data packets of mobility rate at pause time 100s as shown in figures
3.7(b and e) with the high movement speed of (20 meter/second) for 10 and 20
sources which were very similar for both protocols at high pause times with lower
mobility. So for DSR and AODV, packet delivery ratio is independent of offered
traffic load, with both protocols delivering between 85% to 100% for AODV and 90%
71
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
to 100% for DSR of the packets at 10 sources, but at 20 and 30 sources both protocols
deliver between 90% and 100% of the packets at pause time 200s to 500s with lower
mobility as shown in figures 3.7(e and h).
The on-demand protocols, AODV and DSR perform better than the table-driven
DSDV protocol. Where DSDV delivering over 55% of the data packets of mobility
rate as figures 3.7(b, e and h) with the high movement speed of (20m/s) for 10,20 and
30, but DSDV loses about 25% more packets than AODV and DSR for lower 40s
pause times (higher mobility) at 10 sources. Nearly all of the dropped packets are lost
because a stale routing table entry directed them to be forwarded over a broken link.
c)- Simulation time 900 seconds
At the lower movement speed of 2 meter/second as shown in figures 3.7(c, f and i), the
on-demand protocols, DSR and AODV performed particularly well, delivering over
95% of the data packets regardless of mobility rate as shown in figure 3.7(c) with the
lower movement speed of (2 meter/second) for 10 sources which were very similar for
both protocols at lower pause times with higher mobility and DSR performed
particularly well, delivering over 98% of the data packets regardless of mobility rate
as shown in figure 3.7(i) with the lower movement speed of (2 meter/second) for 30
sources. But DSDV delivering over 80% of the data packets regardless of mobility
rate as shown in figure 3.7(i) with the lower movement speed of (2 meter/second) for
30 sources at lower pause times with higher mobility and 90% at higher pause times
with lower mobility as shown in figures 3.7(c, i) for 10, 30 sources . So for DSR and
AODV, packet delivery ratio is independent of offered traffic load, with both
protocols delivering between 95% and 100% of the packets.
At the higher movement speed of 20 meter/second as shown in figures 3.7(c, f and i),
the on-demand protocols, DSR delivers over 95% of the data packets regardless of
mobility rate from pause time 0s to pause time 600s as shown in figure 3.7(c) with
the high movement speed of (20 meter/second) for 10 sources which were very
similar for AODV protocol at pause time 100s to pause time 600s as shown in figure
3.7(c) for pause times with lower mobility. However, DSR delivers over 25% of the
data, AODV delivering over 85% of the data and DSDV delivering over 65% of the
data as shown in figures 3.7(i) with the higher movement speed of (20 meter/second)
for 30 sources at lower pause times where higher mobility. But DSDV, DSR and
AODV are very similar at 300s to 900s pause time. As shown in figures 3.7(c, f) the
on-demand protocols, AODV and DSR perform better than the table-driven DSDV
protocol, where as DSDV delivers over 65% of the data packets regardless of mobility
rate with the high movement speed of (20m/s) for 10 sources.
72
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.2
DSDV speed 2m/s
0.1
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.7: (a) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
1
# data pakets received/#data packets
Figure 3.7: (b) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT500s with 10 sources.
73
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1
# data pakets received/#data packets
0.9
0.8
DSR speed 20m/s
0.7
sent (packets)
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.7: (c) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
0.5
DSR speed 2m/s
0.4
0.2
DSDV speed 2m/s
0.1
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(Sec)
Figure 3.7: (d) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
74
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1
# data pakets received/#data packets sent
0.5
DSR speed 2m/s
0.4
0.3 AODV speed 2m/s
0.2
DSDV speed 2m/s
0.1
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.7: (e) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT500s with 20 sources.
0.9
# data pakets received/#data packets
0.7
AODV speed 20m/s
sent (packets)
0.6
DSDV speed 20m/s
0.5
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.7: (f) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
75
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.7
DSDV speed 20m/s
0.6
(packets)
0.2
DSDV speed 2m/s
0.1
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(Sec)
Figure 3.7: (g) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
1
0.9
# data pakets received/#data
0.8
0.7 AODV speed 20m/s
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.7: (h) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT500s with 30 sources.
76
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1
# data pakets received/#data packets
0.9
DSR speed 20m/s
0.8
0.7 AODV speed 20m/s
sent (packets)
Figure 3.7: (i) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
77
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1.6
Average End-End delay (sec)
1
DSR speed 2m/s
0.8
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.8: (a) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
1.4
0.8
DSDV speed 20m/s
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.8: (b) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT500s with 10 sources.
78
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.8
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.8: (c) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
1.6
Average End-End delay(sec)
1
DSR speed 2m/s
0.8
0.4
DSDV speed 2m/s
0.2
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(Sec)
Figure 3.8: (d) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
79
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
2.5
DSR speed 20m/s
Average End-End delay(sec)
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.8: (e) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT500s with 20 sources.
0.4
AODV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.8: (f) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
80
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
1.4
DSDV speed 20m/s
1.2
0.8
AODV speed 2m/s
0.6
0.2
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.8: (g) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
8
7.5
7
DSR speed 20m/s
6.5
Average End-End delay(sec)
6
AODV speed 20m/s
5.5
5
DSDV speed 20m/s
4.5
4
DSR speed 2m/s
3.5
3
AODV speed 2m/s
2.5
2
DSDV speed 2m/s
1.5
1
0.5
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.8: (h) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT500s with 30 sources.
81
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.4
AODV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.8: (i) Average End-End delays at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
82
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
figures 3.9 (b) with 10 sources. The similar routing load at pause time 200s to 500s as
shown in figure 3.9 (b) with 10 sources.
c) - Simulation time 900 seconds
The normalized routing load at the lower movement speed of 2meter/second, DSR
protocol is lower routing load than AODV and DSDV as shown in figures 3.9 (c, f
and i) with the factor increasing a growing number of sources. The normalized routing
load was higher in DSDV at 10 sources as compared to both DSR and ADOV as
shown in figure 3.9 (c); where as the normalized routing load at 30 sources was higher
in ADOV as compared to both DSR and DSDV protocols as shown in figure 3.9 (i).
But the normalized routing load at 30 sources had a very similar scale plotted for both
protocols DSDV and DSR as shown in figure 3.9 (i). In figures 3.9 (c, f and i) at the
higher movement speed of 20 meter/second, the normalized routing load at 10 sources
had a very similar scale plotted for both protocols DSDV, DSR and AODV as shown
in figure 3.9 (c). But the DSR protocol is higher at lower pause time with 30 sources
at higher mobility as shown in figure 3.9 (i), but it was very similar with both
protocols DSDV and AODV at higher pause time, with lower mobility speed.
14
DSR speed 20m/s
Normalized Routing Load(packets)
12
ADOV speed 20m/s
10
DSDV speed 20m/s
8
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.9: (a) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
83
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
12
Normalized Routing Load(packets)
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.9: (b) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT500s with 10 sources.
18
DSR speed 20m/s
Normalized Routing Load (packets)
16
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.9: (c) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
84
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
14
DSR speed 20m/s
12
Normalized Routing Load(packets)
10
2
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.9: (d) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
14
Normalized Routing Load(packets)
Figure 3.9: (e) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT500s with 20 sources.
85
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 3.9: (f) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
12
Normalized Routing Load(packets)
10
DSDV speed 20m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.9: (g) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
86
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
14
Normalized Routing Load(packets)
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.9: (h) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT500s with 30 sources.
60
55 AODV speed 20m/s
50
45 DSDV speed 20m/s
40
35 DSR speed 20m/s
30
25 AODV speed 20m/s
20
15 DSDV speed 20m/s
10
5
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.9: (i) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
87
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
88
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
sources with comparison of routing overhead for DSR and AODV protocols. But the
AODV, DSR and DSDV have a very similar scale plotted at pause time 500s to 900s
at lower nodes mobility speed.
4800
DSR speed 20m/s
4000
AODV speed 20m/s
Routing Overhead(packets)
3200
DSDV speed 20m/s
2400
DSR speed 2m/s
1600
ADOV speed 2m/s
800
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 3.10: (a) Routing Overhead at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
120000
DSR speed 20m/s
110000
100000
Routing Overhead(packets)
20000
DSDV speed 2m/s
10000
Figure 3.10: (b) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT500s with 10 sources.
89
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
350000
AODV speed 20m/s
Routing Overhead (packets)
300000
DSDV speed 20m/s
250000
150000
AODV speed 2m/s
100000
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.10: (c) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
16000
ADOV speed 20m/s
Routing Overhead(packets)
14000
10000
DSR speed 2m/s
8000
4000
DSDV speed 2m/s
2000
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.10: (d) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
90
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
120000
DSR speed 2m/s
100000
80000
AODV speed 2m/s
60000
40000
DSDV speed 2m/s
20000
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.10: (e) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT500s with 20 sources.
350000
Routing Overhead (packets)
150000
AODV speed 2m/s
100000
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.10: (f) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
91
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
16000
AODV speed 20m/s
Routing Overhead (packets)
14000
DSDV speed 20m/s
12000
8000
ADOV speed 2m/s
6000
2000
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.10: (g) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
160000
120000
DSR speed 2m/s
100000
80000
AODV speed 2m/s
60000
40000
DSDV speed 2m/s
20000
0
0 100 200 300 400 500
Pause Time(sec)
Figure 3.10: (h) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT500s with 30 sources.
92
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
80000
DSDV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 3.10: (i) Routing overhead at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
93
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
480
Drop packets at Routing Over head (packets)
400
DSDV speed 20m/s
320
AODV speed 20m/s
240
DSR speed 2m/s
160
DSDv speed 2m/s
80
AODV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Figure 3.11: (a) Drop packets at routing overhead at movement speed (2m/s and
20m/s) and SIMT100s with 10 sources.
20000
DSR speed 20m/s
18000
Drop packets at Routing Over head
12000
10000 DSR speed 2m/s
8000
DSDV speed 2m/s
6000
4000
AODV speed 2m/s
2000
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.11: (b) Drop packets at routing overhead at movement speed (2m/s and
20m/s) and SIMT900s with 10 sources.
94
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
540
DSDV speed 20m/s
450
AODV speed 20m/s
360
90
Aodv speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.11: (c) Drop packets at routing overhead at movement speed (2m/s and
20m/s) and SIMT100s with 20 sources.
18000
16000 DSDV speed 20m/s
14000
AODV speed 20m/s
(packets)
12000
10000 DSR speed 2m/s
8000
DSDV speed 2m/s
6000
4000 AODV speed 2m/s
2000
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.11: (d) Drop packets at routing overhead at movement speed (2m/s and
20m/s) and SIMT900s with 20 sources.
95
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
880
800 DSR speed 20m/s
Drop packets at Routing Over head(packets)
720
DSDV speed 20m/s
640
560 ADOV speed 20m/s
480
400 DSR speed 2m/s
320
DSDV speed 2m/s
240
160 AODV speed 2m/s
80
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.11: (e) Drop packets at routing overhead at movement speed (2m/s and
20m/s) and SIMT100s with 30 sources.
96
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
200
AODV speed 20m/s
150
DSR speed 2m/s
100
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.12: (a) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 10 sources.
97
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
400
AODV speed 20m/s
300
DSR speed 2m/s
200
DSDV speed 2m/s
100
AODV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.12: (b) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 10 sources.
200
ADOV speed 20m/s
150
DSR speed 2m/s
100
DSDV speed 2m/s
50
AODV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 3.12: (c) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 20 sources.
98
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
500
DSDV speed 20m/s
Drop packets (packets)
400
AODV speed 20m/s
300
DSR speed 2m/s
200
DSDV speed 20m/s
100
AODV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.12: (d) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 20 sources.
500
400
Drop packets(packets)
300
AODV speed 20m/s
250
150
DSDV speed 2m/s
100
Figure 3.12: (e) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 30 sources.
99
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
56000
Drop packets (packets)
24000
DSDV speed 2m/s
16000
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 3.12: (f) Drop packets at end of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 30 sources
100
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
is independent of offered traffic load, with both protocols delivering between 85% and
100% of the packets in all cases at simulation time 100s, where at simulation time
900s with the lower movement speeds of 2m/s both protocols delivering between 90%
and 100% of the packets in all cases and with the higher movement speeds of 20m/s
both protocols delivering between 80% and 100% of the packets for 10 sources,
where DSR protocol delivering between 30% and 100% of the packets as shown in
figure 3.7(a, b and c). Since DSDV uses the table-driven approach of maintaining
routing information, it is not as adaptive to the route changes that occur during high
mobility. In contrast, the lazy approach used by the on-demand protocols, AODV and
DSR to build the routing information as and when they are created make them more
adaptive and result in better performance (high packet delivery fraction and lower
average end-to-end packet delays).
3.8. Summary:
The researcher has chosen three existing ad-hoc routing protocols (DSR, AODV
and DSDV) to understand routing principles in a MANET. It is a good idea to take a
look at a brief overview of examined least-cost algorithms that are a central part of
routing in packets in networks and conventional routing algorithms such as distance
vector, link state and flooding routing. This is because many of the routing protocols
for a MANET have roots in traditional routing concept as underlying algorithm. In
mobile ad-hoc networks, routing protocols are classified of routing protocols in
MANET which can be done in many ways, but most of these are done depending on
101
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
the routing strategy and network structure, as flat routing, hierarchical routing and
geographic position assisted routing. The simulation results have shown that:
There certainly is a need for a special ad-hoc routing protocol when mobility
increases. More conventional routing protocols like DSDV have a dramatic
decrease in performance when mobility is high. Two of the proposed protocols
are DSR and AODV. They perform very well when mobility is high.
However, the researcher has found that a routing protocol that entirely
depends on messages at the IP-level will not perform well. Some sort of
support from the lower layer, for instance link failure detection or neighbor
discovery is necessary for high performance. The size of the network and the
offered traffic load affects protocols based on source routing, like DSR, to
some extent. A large network with many mobile nodes and high offered load
will increase the overhead for DSR quite drastically. In these situations, a hop-
by-hop based routing protocol like AODV is more desirable.
The simulations have shown that there certainly is a need for a special ad-hoc
routing protocol when the mobility increases. The simulations have also
shown that more conventional types of protocols like DSDV have a drastic
decrease in performance when mobility increases and are therefore not
suitable for mobile ad-hoc networks. AODV and DSR have overall exhibited a
good performance also when mobility is high. DSR is however based on
source routing, which means that the overhead in each packet can affect the
overhead in the network quite drastically when the load offered to the network
and the size of the network increases. In these situations, a hop-by-hop based
routing protocol like AODV is more desirable. One advantage with the source
routing approach is however that in its route discovery operation it learns more
routes. Source routing is however not desirable in ordinary forwarding of data
packets because of the large overhead.
Another key aspect when evaluating these protocols is to test them in realistic
scenarios. the researcher has tested them in 38 types of scenarios. DSR had the
best performance, but the large overhead caused by the source route in each
packet makes AODV a good alternate candidate. It has almost as good
performance.
DSR & AODV PDF is in the range of 95%-100% at lower rate of mobility for
all SIMT.
DSR & AODV PDF is in the range of 95%-100% at lower rate of mobility for
all SIMT.
DSDV: PDF is in the range of 70%-90% at lower rate of mobility with
10sources of each SIMT (100s, 500s, and 900s).
DSR & AODV good output performance than DSDV protocol for each SIMT.
DSR & AODV the PDF is not good performance in higher mobility with
increase number of sources for each SIMT, where as at SIMT 500s :
- AODV PDF= 70%-92%.
- DSR PDF= 20%-97%.
- DSDV PDF= 58%-92%.
So AODV outperforms DSR, however, consistently generates less routing
load than AODV. The poor performances of DSR are mainly attributed to
aggressive use of caching, and lack of any mechanism to expire stale
routes or determine the freshness of routes when multiple choices are
available. Aggressive caching, however, seems to help DSR at low loads
and also keeps its routing load down.
102
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
The average end-to-end delay of packet delivery at the lower mobility was
higher in AODV as compared to both DSR and DSDV at SIMT 100s with 10
sources
• DSDV was lower average end-to-end delay of packet delivery at the lower
mobility.
• DSR was higher average end-to-end delay of packet delivery at the higher
mobility.
• Note: the average end-to-end delay of packet delivery was sensitive of
different (SMIT and mobility).
• In all cases at lower mobility, DSR has lower normalized routing load than
AODV and DSDV at higher mobility lower with 10,20 sources.
• At lower mobility the normalized routing load was higher in DSDV at 10
sources as compared to both DSR and ADOV for all different SIMT.
• At lower mobility the normalized routing load at 20 and 30 sources was higher
in ADOV as compared to both DSR and DSDV.
DSDV has lower normalized routing load at higher and lower mobility with
increasing grow number of sources 30.
AODV has higher routing overhead at lower & higher mobility with 10, 20
sources.
DSR has higher routing overhead at lower & higher mobility with 30 sources
DSDV has lower routing overhead at lower & higher mobility with 30 sources
The Drop packets at routing overhead in all cases were higher in AODV.
In all case AODV has lower drop packets at end of simulation time.
DSDV, each node maintains routing information for all known destinations.
DSDV, connectivity information needs periodical update throughout the whole
network, do the best performance when node mobility rate and movement
speed are low.
DSDV, approximately constant overhead.
DSDV, packet loss is mainly caused by stale routing entries.
DSDV is effective for creating ad-hoc networks for small of mobile nodes.
AODV & DSR are effective for creating ad-hoc networks for large of mobile
nodes.
DSDV limits the number of nodes that can join the network.
DSDV, when every topology of a network changes, DSDV is unstable until
update packets propagate through the network.
DSDV need of bandwidth and the size of tables grow simultaneously with
mobility and number of nodes.
- Overhead for maintaining and updating tables will increase.
- Heavy routing overhead will degrade the performance of network
- Traffic overhead even if there is no change in network topology
- Overhead: most routing information never used.
DSDV, maintains routes which are never used.
DSDV, no sleeping nodes, where routing information must be updated
periodically
DSR & AODV, good performance at all mobility rates
AODV overhead is higher and still requires transmission of many routing
overhead packets.
AODV higher drop packet routing overhead drops.
103
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
104
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
105
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 4
106
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 4
Performance Analysis of Secure Routing Algorithm for
Ad-hoc Sensor Mobile Network
107
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Figure 4.1 (a) Ad-hoc network with 12 nodes. (b) Ad-hoc network with change in
location of the node 9.
(a) (b)
Table 4.1: (a) Routing table node 1, (b) Routing table node 1 after topology change
SEAD used destination sequence numbers, as in DSDV; we also use these destination
sequence numbers to provide replay protection of routing update messages in SEAD.
SEAD incorporates One-Way Hash function to authenticate in the routing update
mechanism to enhance the routing security. A one-way hash chain is built on a one-
way hash function. Like a normal hash function, a one-way hash function, H, maps an
input of any length to a fixed-length bit string. Thus,
108
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Where P is the length in bits of the output of the hash function, function H should be
simple to compute yet must be computationally infeasible in general to invert. A more
formal definition of one-way hash functions has many names: compression function,
contraction function, message digest, fingerprint, cryptographic checksum, message
integrity check (MIC), and manipulation detection code (MDC). Whatever one calls
it, it is central to modern cryptography. One-way hash functions are another building
block for many protocols [56]. To create a one-way hash chain, a node chooses a
random initial value x, where xє{0, 1}P and computes the list of values
Let the hash chain values calculated using H be (h1, h2,..., hn), where n is divisible by
m, then for a routing table entry with sequence number i, let k=((n/m)-i). If the
metric j (distance) is used to authenticate the routing update entry, then h(km+j) is used
to authenticate the table update entry for that sequence number i and distance j.
Where 0 < i ≤ (m-1) and n=(m-1)×m. The group of elements used for routing
update with sequence number i is:
So that one-way hash chains, for example we use m=5, were i=sequence number, j=
distance, m=network diameter, n=length of hash chain as shown in table 4.2 one-way
hash chain elements are used for authentication in reverse order. as 0 < i ≤ (m-1) and
n = (m-1) × m = 20.
109
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Note that from the above example a node generates its hash chain so that n is divisible
by m. When a node first enters the network, or after a node has used most of its
available hash chain elements, it can pick a new random x, generate a new hash chain
from this x, and send the new generated hn = h19 value to a trusted entity or an
alternative authentication and distribution service. Each node’s routing table is tagged
with the destination nodes address, next hop node address, hash value, sequence
number and metric as shown in figure 4.2
j
0 1 2 3 4
i
3 h5 h6 h7 h8 h9
4 h0 h1 h2 h3 h4
Figure 4.2: Ad-hoc networks with value of hash in routing table entries for nodes
110
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
In the example given above for sequence number i, the node sets the hash value in that
entry to its hkm= h15. If the node lists an entry for some other destination in that
update, it sets the (address in that entry to that destination nodes address, the metric
and sequence number) to the values for that destination in its routing table, and the its
hash value to the hash of the hash value received in the routing update entry from
which it learned that route to that destination.
So that nodes receiving any routing update can easily authenticate each entry in the
update, given any earlier authentic hash element from the same hash chain, the group
of elements used for routing update with sequence number i is:
A malicious node can modify h(km+j) only if it knows the value of h(km+j-1), which is
impossible to calculate. So the hashing technique is used to authenticate the nodes
participating in the ad-hoc network.
The attacker can never forge better distances or sequence numbers, attacker can only
generate worse distances or sequence numbers, however, other information such as
node name or next hop can be forged.
They differ from DSDV in that they do not use an average weighted settling time in
sending triggered updates. To reduce the number of redundant triggered updates, each
node in DSDV tracks, for each destination, the average time between when the node
receives the first update for some new sequence number for that destination, and when
it receives the best update for that sequence number for it (with the minimum metric
among those received with that sequence number), when deciding to send a triggered
update, each DSDV node delays any triggered update for a destination for this
average weighted settling time, in the hope of only needing to send one triggered
update, with the best metric, for that sequence number. SEAD does not use such a
delay, in order to prevent attacks from nodes that might maliciously not use the delay.
Since a node selects the first route it receives with highest sequence number and
lowest metric as shown in figure 4.3, an attacker could attempt to cause more traffic to
be routed through itself, by avoiding the delay in its own triggered updates. Such an
attack could put the attacker in a position to eavesdrop on, modify, or discard other
nodes' packets.
In addition, unlike DSDV, when a node detects that its next-hop link to some
destination is broken, the node does not increment the sequence number for that
destination in its routing table when it sets the metric in that entry to infinity as shown
in figure 4.4.
Since higher sequence numbers take priority, this node's routing update with this
new sequence number must be authenticated, but we did not include a mechanism for
authenticating these larger sequence numbers. Instead, the node flags its routing table
entry for this destination to not accept any new updates for this same sequence
number, effectively preventing the possible routing loop.
111
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
112
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
113
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
packets regardless of mobility rate as shown in figures 4.5 (a , c and e) with the lower
movement speed of (2meter/second) for 10, 20, 30 and 40 sources. So for SEAD,
packet delivery ratio is independent of offered traffic load, delivering between 95%
and 100% of the packets.
The SEAD: Secure efficient ad-hoc distance vector routing protocol perform better
than the table-driven DSDV protocol. Where DSDV delivering over 70% of the data
packets regardless of mobility rate as shown in figures 4.5 (a , c and e) with the lower
movement speed of (2 m/s) for 10, 20 and 30, but DSDV loses about 50% more
packets than SEAD for lower 10s pause times (higher mobility) at 10 and 20 sources.
Nearly all of the dropped packets are lost because a stale routing table entry directed
them to be forwarded over a broken link.
At the higher movement speed of 20 meter/second as shown in figures 4.5 (a , c and
e), the SEAD: Secure efficient ad-hoc distance vector routing protocol performed
particularly well, delivering over 70% of the data packets regardless of the mobility
rate at pause time 0s as shown in figures 4.5(a , c and e) with the high movement
speed of (20 meter/second) for 10, 20 and 30 sources, where as at high pause times
with lower mobility it delivers over 80% of the data packets. So for SEAD, packet
delivery ratio is independent of offered traffic load, with both protocols delivering
between 70% and 85% of the packets at 10, 20 and 30 sources.
The SEAD: Secure efficient ad-hoc distance vector routing protocol perform better
than the table-driven DSDV protocol. the DSDV delivers 20% of the data packets
regardless of the mobility rate at pause time 0s as shown in figures 4.5 (a, c and e)
with the high movement speed of (20 meter/second) for 10, 20, 30 and 40 sources
while at high pause times with lower mobility it delivers over 70% of the data
packets, but DSDV loses about 40% more packets than SEAD for lower 40s pause
times (higher mobility) at 10, 20 and 30 sources. Nearly all of the dropped packets are
lost because a stale routing table entry directed them to be forwarded over a broken
link.
b)- Simulation time 900 seconds
At the lower movement speed of 2 meter/second as shown in figures 4.5 (b, d and f),
the SEAD: Secure efficient ad-hoc distance vector routing protocol performed
particularly well, delivering over 95% of the data packets regardless of the mobility
rate as shown in figure 4.5 (b) with the lower movement speed of (2 meter/second)
for 10 sources, SEAD performed particularly well, delivering over 85% of the data
packets regardless of the mobility rate as shown in figures 4.5 (d and f) with the lower
movement speed of (2 meter/second) for 20 and 30 sources at pause time 800, with
another pause time are delivering 95% data packets of mobility rate. However, DSDV
delivers over 82% to 90% of the data packets regardless of the mobility rate as shown
in figures 4.5 (b, d and f) with the lower movement speed of (2 meter/second) for 10,
20 and 30 sources at lower pause times with higher mobility and 90% at higher pause
times with lower mobility. So for SEAD, packet delivery ratio is independent of
offered traffic load, delivering between 85% and 90% of the packets at 20 and 30
sources, but delivering between 92% and 98% of the packets at 10 sources.
At the higher movement speed of 20 meter/second as shown in figures 4.5 (b, d and f),
the SEAD: Secure efficient ad-hoc distance vector routing protocol 80% of the data
packets regardless of the mobility rate from pause time 0s to pause time 50s as shown
in figures 4.5 (b, d and f), with the high movement speed of (20 meter/second) for 10,
20 and 30 sources where very similar for DSDV protocol at pause time 300s to pause
time 900s as shown in figures 4.5(d and f) for pause times with lower mobility at 20
and 30 sources. However, in all cases SEAD delivers over 80% of the data, and
114
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
DSDV delivers over 65% of the data as shown in figures 4.5 (b, d and f), with the
higher movement speed of (20 meter/second) for 10, 20 and 30 sources at lower pause
times with higher mobility. But SEAD and DSDV are very similar at 300s to 900s
pause times, so that SEAD: Secure efficient ad-hoc distance vector routing protocol
perform better than the table-driven DSDV protocol. Where as DSDV delivers over
65% of the data packets regardless of the mobility rate with the high movement speed
of (20 m/s) for 10 sources.
8500
6500
4500
2500
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.5: (a) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
1
# data pakets received/#data packets sent (packets)
0.8
0.7
DSDV speed 20m/s
0.6
0.5
0.4 SEAD speed 2m/s
0.3
0.2
DSDV speed 2m/s
0.1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.5: (b) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
115
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
8500
SEAD speed 20m/s
7500
Routing Overhead (packets)
6500
DSDV speed 20m/s
5500
4500
2500
1500
DSDV speed 2m/s
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.5: (c) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
0.9
# data pakets received/#data packets sent
0.7
DSDV speed 20m/s
0.6
(packets)
0.5
0.2
DSDV speed 2m/s
0.1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.5: (d) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
116
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
8500
SEAD speed 20m/s
7500
Routing Overhead (packets)
6500
DSDV speed 20m/s
5500
4500
SEAD speed 2m/s
3500
2500
DSDV speed 2m/s
1500
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.5: (e) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
1
# data pakets received/#data packets sent (packets)
0.7
DSDV speed 20m/s
0.6
0.5
0.3
0.2
DSDV speed 2m/s
0.1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.5: (f) Packet delivery ratio at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
117
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.8
Average End-End delay (sec)
0.7
DSDV speed 20m/s
0.6
0.5
0.3
0.1
0
0 10 20 30 40 50 60 70 80 90 100
Pause Tim e(sec)
Figure 4.6: (a) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
118
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.63
Average End-End delay(sec)
0.54
DSDV speed 20m/s
0.45
0.36
SEAD speed 2m/s
0.27
0.18
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.6: (b) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
0.8
0.2
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.6: (c) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
119
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.72
SEAD speed 20m/s
0.63
Average End-End delay(sec)
0.54
DSDV speed 20m/s
0.45
0.36
SEAD speed 2m/s
0.27
0.18
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.6: (d) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
0.8
0.2
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.6: (e) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
120
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
0.72
SEAD speed 20m/s
0.63
Average End-End delay(sec)
0.54
DSDV speed 20m/s
0.45
0.36
SEAD speed 2m/s
0.27
0.18
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.6: (f) Average End-End delay at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
121
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
20
18
SEAD speed 20m/s
16
Normalized Routing Load (packets)
14
10
8
SEAD speed 2m/s
6
4
DSDV speed 2m/s
2
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.7: (a) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 10 sources.
10
9
SEAD speed 20m/s
Normalized Routing Load (packets)
7
DSDV speed 20m/s
6
2
DSDV speed 2m/s
1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.7: (b) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 10 sources.
122
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
18
SEAD speed 20m/s
Normalized Routing Load (packets)
16
14
DSDV speed 20m/s
12
10
4
DSDV speed 2m/s
2
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.7: (c) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 20 sources.
9
SEAD speed 20m/s
8
Normalized Routing Load(packets)
7
DSDV speed 20m/s
6
2
DSDV speed 2m/s
1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.7: (d) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 20 sources.
123
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
20
18
SEAD speed 20m/s
Normalized Routing Load (packets)
16
14
DSDV speed 20m/s
12
10
8 SEAD speed 2m/s
6
4
DSDV speed 2m/s
2
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.7: (e) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT100s with 30 sources.
8
Normalized Routing Load(packets)
7
DSDV speed 20m/s
6
2
DSDV speed 2m/s
1
0
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.7: (f) Normalized Routing load at movement speed (2m/s and 20m/s) and
SIMT900s with 30 sources
124
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
8500
6500
4500
2500
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.8: (a) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
with 10 sources.
125
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
49000
33000
DSDV speed 20m/s
25000
9000
DSDV speed 2m/s
1000
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.8: (b) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
with 10 sources.
8500
SEAD speed 20m/s
7500
Routing Overhead (packets)
6500
DSDV speed 20m/s
5500
4500
2500
1500
DSDV speed 2m/s
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.8: (c) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
with 20 sources.
126
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
49000
25000
9000
DSDV speed 2m/s
1000
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.8: (d) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
with 20 sources.
8500
SEAD speed 20m/s
7500
Routing Overhead (packets)
6500
DSDV speed 20m/s
5500
4500
SEAD speed 2m/s
3500
2500
DSDV speed 2m/s
1500
500
0 10 20 30 40 50 60 70 80 90 100
Pause Time(sec)
Figure 4.8: (e) Routing overhead at movement speed (2m/s and 20m/s) and SIMT100s
with 30 sources.
127
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
33000
DSDV speed 20m/s
25000
1000
0 100 200 300 400 500 600 700 800 900
Pause Time(sec)
Figure 4.8: (f) Routing overhead at movement speed (2m/s and 20m/s) and SIMT900s
with 30 sources
128
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
600
300
SEAD speed 2m/s
200
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 4.9: (a) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 10 sources.
300
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 4.9: (b) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 10 sources.
129
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
600
400
SEAD speed 20m/s
300
100
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 4.9: (c) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 20 sources.
400
Drop packets(packets)
300
100
DSDV speed 2m/s
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 4.9: (d) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 20 sources.
130
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
400
SEAD speed 20m/s
300
100
DSDV speed 2m/s
0
0 10 20 30 40 50 60 70 80 90 100
Pause Time (sec)
Figure 4.9: (e) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT100s with 30 sources.
400
SEAD speed 20m/s
300
0
0 100 200 300 400 500 600 700 800 900
Pause Time (sec)
Figure 4.9: (f) Drop packets at End of simulation time at movement speed (2m/s and
20m/s) and SIMT900s with 30 sources
131
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
132
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
updates. To reduce the number of redundant triggered updates to prevent DoS attacks
by causing other attackers (reply, warmhole). Each node in DSDV tracks, for each
destination, the average time between when the node receives the first update for
some new sequence number for that destination, and when it receives the best update
for that sequence number for it (with the minimum metric among those received with
that sequence number), when deciding to send a triggered update, each DSDV node
delays any triggered update for a destination for this average weighted settling time,
in the hope of only needing to send one triggered update, with the best metric, for that
sequence number. SEAD does not use such a delay, in order to prevent attacks from
nodes that might maliciously not use the delay.
Since a node selects the first route it receives with highest sequence number and
lowest metric as shown in figure 4.3, an attacker could attempt to cause more traffic to
be routed through itself, by avoiding the delay in its own triggered updates. Such an
attack could put the attacker in a position to eavesdrop on, modify, or discard other
nodes' packets.
4.1. Summary
In security is a fundamental issue that needs resolution before ad-hoc networks will
experience large scale deployment. The characteristics of mobile ad-hoc networks,
pose numerous challenges in achieving conventional security goals. Since the nodes
are responsible for basic network functions, like packet forwarding and routing,
network operations can be easily jeopardized if countermeasures are not integrated
into these network functions at the early stages of design, some existing routing
protocols given in Chapter (2,3) for mobile ad-hoc networks may be able to manage
the dynamic network topology of mobile ad-hoc networks, but none of these protocols
incorporate mechanisms to prevent, tolerate or defend against attacks from malicious
adversaries. Due to the close relationship between security and the characteristics of
ad-hoc networks these protocols will have to be fundamentally altered or redesigned
to effectively incorporate security mechanisms. This is clear if one considers the
number of secure routing protocols as (Ariadne, SEAD, ARAN, and SRP) that
followed in the secure routing protocols in MANET. Security support is of grave
importance to military communications.
The simulation results have shown that the securing ad-hoc environments are a
challenging task. The main purpose of this thesis was to acquire in depth knowledge
of ad-hoc routing protocols and secure routing protocols. Security evaluation of the
secure routing protocol is done using SEAD: secure efficient distance vector routing
for mobile wireless ad-hoc networks and implement the algorithm of protocol to
simulator network Ns-2 and performance evaluation of ad-hoc secure routing protocol
133
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
SEAD and compared with DSDV protocol was done with most commonly identified
performance metrics.
SEAD: PDF is in the range of 90%-100% at lower rate of mobility with 10sources
of each SIMT (100s, 900s).
DSDV: Packet delivery ratio is in the range of 70%-90% at lower rate of mobility
with 10sources of each SIMT (100s, 900s).
SEAD: PDF is in the range of 70%-80% at higher rate of mobility with 10sources of
SIMT (100s).
DSDV: PDF is in the range of 20%-69% at higher rate of mobility with 10sources
of SIMT (100s).
SEAD: PDF is in the range of 80%-100% at higher rate of mobility with 10sources
of SIMT (900s).
DSDV: Packet delivery ratio is in the range of 65%-98% at higher rate of mobility
with 10sources of SIMT (900s).
So the SEAD good output performance than DSDV protocol for each Simulation
where the PDF is in the range of 90%-100% at higher rate of mobility with SIMT
900S at 100s 70%-80%. At lower mobility 90%-100% for each SIMT.
The average end-to-end delay of packet delivery at the lower mobility SEAD higher
as compared to DSDV in all cases, but at higher mobility it was higher in DSDV as
compared to SEAD for each SIMT
In all cases at the lower & higher mobility, DSDV lower normalized routing load
than SEAD.
In all cases at the lower & higher mobility, the routing overhead packets generated
by routing protocol to achieve the level of data packet delivery, where as in SEAD
they are constant and higher as compared with DSDV protocol.
In all cases at the lower & higher mobility, SEAD protocol has lower drop packets
at end of simulation time as compared with DSDV protocol, so nearly all of the
dropped packets are lost at end of simulation time.
SEAD outperforms DSDV in terms of packet delivery ratio and at drop packets at
end of simulation time.
SEAD does not allow for new nodes to join the network.
SEAD use efficient one-way hash function to prevent sequence number and hop
count from being modified by malicious node.
Hash chains are consumed very fast; these constructs would also satisfy the low
power requirement.
SEAD is robust against uncoordinated attacks.
SEAD is unable to defend against a simple collusion attack, involving two attacker
nodes, sharing information via a tunnel. (Sending the routing information as data).
This attack can be used to achieve a wormhole between the two bad nodes. This
causes a lot of communication to pass through them. This situation can then be
exploited. In the secure routing protocol, most of the security attacks are possible
with a compromised node. From the study results, it concludes that table driven
protocol is more prone to security attacks. The performance evaluation of SEAD
and DSDV shows that, SEAD out performs DSDV in all the performance metrics.
But it is important to see that at lower simulation pause times SEAD outperforms
DSDV. This is due to the routing mechanism involved in these protocols. SEAD
encapsulates routing information in routing tables, so at lower pause time SEAD out
performs DSDV.
134
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 5
135
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Chapter 5
Conclusion and Future Work
5.1. Conclusion
This thesis first, compared the performance of DSDV, AODV and DSR routing
protocols for ad-hoc networks using ns-2 simulations and second, implemented secure
routing algorithm protocol of sensor MANET (SEAD) and compared to traditional
DSDV routing protocol with environment attackers, by performance analysis.
First: DSDV uses the proactive table-driven routing strategy while both AODV and
DSR use the reactive On-demand routing strategy. Both AODV and DSR perform
better under high mobility simulations than DSDV. High mobility results in frequent
link failures and the overhead involved in updating all the nodes with the new routing
information as in DSDV is much more than that involved in AODV and DSR, where
the routes are created as and when required.
DSR and AODV both use on-demand route discovery, but with different routing
mechanics. In particular, DSR uses source routing and route caches, and does not
depend on any periodic or timer-based activities. DSR exploits caching aggressively
and maintains multiple routes per destination. AODV, on the other hand, uses routing
tables, one route per destination, and destination sequence numbers, a mechanism to
prevent loops and to determine freshness of routes. The general observation from the
simulation is that for application-oriented metrics such as packet delivery ratio and
delay are DSR & AODV good output performance than DSDV protocol for each
SIMT. The PDF for DSR & AODV are not good performance in higher mobility with
the increase of the number of sources for each SIMT, where AODV PDF= 70%-92%,
DSR PDF= 20%-97%, DSDV PDF= 58%-92%, So AODV, outperforms DSR. DSR,
however, consistently generates less routing load than AODV. The poor performances
of DSR are mainly attributed to aggressive use of caching, and lack of any mechanism
to expire stale routes or determine the freshness of routes when multiple choices are
available. Aggressive caching, however, seems to help DSR at low loads and also
keeps its routing load down.
Second: Securing ad-hoc environments is a challenging task. The main purpose of this
thesis was to acquire in-depth knowledge of ad-hoc routing protocols and secure
routing protocol. Security evaluation of the secure routing protocol SEAD with
traditional routing protocol DSDV use the most commonly identified attack patterns
in ad-hoc networks. Performance evaluation of ad-hoc secure routing protocol SEAD
and DSDV was done with the most commonly identified performance metrics added
two new performance metrics. In the secure routing protocol, most of the security
attacks are possible with a compromised node. SEAD based on the design of the
destination-sequenced distance vector protocol. SEAD use efficient one-way hash
function to prevent sequence number and hop count from being modified by
malicious node and consumed very fast, These constructs would also satisfy the low
power requirement. SEAD is robust against uncoordinated attacks. SEAD does not
allow for new nodes to join the network.
From the simulation results, it is concluded that the performance evaluation of SEAD
and DSDV shows that, SEAD outperforms DSDV in all the performance metrics. But
it is important to see that at lower simulation pause times SEAD outperforms. This is
due to the routing mechanism involved in these protocols. SEAD encapsulates routing
information in routing tables, so at lower pause time SEAD good outperforms DSDV.
136
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
137
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
References
[1]. Josh Broch, David A Maltz, David B Johnson, Yih-Chun Hu and Jorjeta
Jetcheva, A performance comparison of multi-hop wireless ad-hoc network
routing protocols. Proceedings of the Fourth Annual ACM/IEEE International
Conference on Mobile Computing and Networking, October 25–30, 1998.
[2]. Website: Wireless Security Courses, Useful Definitions,
http://www.kjhole.com/Definitions.html
[3]. J. Macker and S. Corson. Mobile ad-hoc networking (manet): Routing protocol
performance issues and evaluation considerations. University of Maryland,
Network Working Group Request for Comments: 2501, Jan 1999.
[4]. I.F. Akyildiz, W. Su, Y. Sankarasubramaniam and E. Cayirci. Wireless sensor
networks: a survey, Broadband and Wireless Networking Laboratory, School of
Electrical and Computer Engineering, Georgia Institute of Technology, Atlanta,
GA 30332, USA, 20 December 2001.
[5]. Website: Ismail Akturk, Come491 GRADUATION PROJECT Wireless Sensor
Networks, Center for Computation & Technology, Louisiana State University,
USA, November 27- 2007, http://www.ismailakturk.com/wsn.html
[6]. Charles Perkins and Elizabeth Royer, Ad-hoc on-demand distance vector
routing. In Proceedings of the 2nd IEEE Workshop on Mobile Computing
Systems and Applications, New Orleans, LA, February 1999, pp. 90-100.
[7]. Elizabeth M. Royer and Charles E. Perkins. An Implementation Study of the
AODV Routing Protocol. Proceedings of the IEEE Wireless Communications
and Networking Conference, Chicago, IL, September 2000.
[8]. Charles E. Perkins and Pravin Bhagwat. Highly Dynamic Destination-
Sequenced Distance-Vector Routing (DSDV) for Mobile Computers, IBM,
T.J.Watson Research Center, Computer Science Department university of
Maryland, 1994.
[9]. Chai-Keong Toh, Elizabeth M. Royer and Santa Babara. A review of current
routing protocols for ad-hoc mobile wireless networks, IEEE Personal
Communications, April 1999.
[10]. David A. Maltz Josh Broch David B. Johnson, Experiences Designing and
Building a Multi-HopWireless Ad-Hoc Network Testbed, DRAFT PAPER The
CMU , Monarch Project , Computer Science Department , Carnegie Mellon
University , Pittsburgh, PA 15213 , http://www.monarch.cs.cmu.edu/
[11]. Dave Johnson, NASA Ad-hoc Networking Demonstration, Computer Science
Department, Rice University, 30 September 2003.
[12]. Yi Wang. An Overview of Wireless Ad-hoc Networks:Challenges and Future.
Department of Electronic Engineering , Tsinghua University, Beijing, P. R.
China, 100084, (Student No. 034820)
[13]. Ns-2 network simulator installation, http://www.isi.edu/nsnam/ns/
[14]. The Ns-2 Manual, (formerly ns Notes and Documentation) The VINT Project A
Collaboration between researchers at UC Berkeley, LBL, USC/ISI, and Xerox
PARC, August 23-2006, http://www.isi.edu/nsnam/ns/.
[15]. Yih-Chun Hu and David B. Johnson. Caching Strategies in On-Demand Routing
Protocols for Wireless Ad-Hoc Networks. In Proceedings of the Sixth Annual
IEEE/ACM International Conference on Mobile Computing and Networking,
pages 231–242, August 2000.
138
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
[16]. Web site: VINT, Virtual InterNetwork Testbed Project simulation framework
builds, A Collaboration among USC/ISI, Xerox PARC, LBNL and UCB,
October 19, 1997, http://www.isi.edu/nsnam/vint/.
[17]. Practical Programming in Tcl and Tk, Fourth Edition, June 10-2003, By
Brent B. Welch, Ken Jones, Jeffrey Hobbs.
[18]. Web site: Ns-2 Trace Formats, http://nsnam.isi.edu/nsnam/index.php/NS-
2_Trace_Formats
[19]. Web site: The Rice University Monarch Project: Mobile Networking
Architectures, http://www.monarch.cs.cmu.edu/.
[20]. Samir R. Das, Charles E. Perkins, Elizabeth M. Royer and Mahesh K. Marina.
Performance Comparison of Two On-demand Routing Protocols for Ad-hoc
Networks, IEEE Personal Communications Magazine special issue on Ad-hoc
Networking, February 2001, p. 16-28.
[21]. Samir R. Das, Charles E. Perkins, and Elizabeth M. Royer. Performance
Comparison of Two On-demand Routing Protocols for Ad-Hoc Networks."
Proceedings of the IEEE Conference on Computer Communications
(INFOCOM), Tel Aviv, Israel, March 2000, p. 3-12.
[22]. E. Altman, T. Jimenez, Ns Simulator for beginners, univ.de Los Andes, Merida,
Venezuela and ESSI, Sophia-Antipolis, France, December 4-2003.
[23]. J.-Y. Le Boudec and M. Vojnovic. Perfect Simulation and Stationarity of a Class
of Mobility Models, IEEE Infocom 2005, Miami, FL, 2005
http://lcawww.epfl.ch/Publications/LeBoudec/lebvoj04.pdf.
[24]. Web site: Ns-2 Code for Random Trip Mobility Model, by S. PalChaudhuri,
Rice University, http://www.cs.rice.edu/~santa/research/mobility/.
[25]. Yongwei Wang, Venkata C. Giruka, and Mukesh Singhal. A Truthful
Geographic Forwarding Algorithm for Ad-hoc Networks with Selfish Nodes,
Department of Computer Science, University of Kentucky, Lexington, KY
40506, USA , International Journal of Network Security, Vol.5, No.3, PP.252–
263, Nov. 2007.
[26]. Web site: Tutorial for the Network simulator Ns-2,
http://www.isi.edu/nsnam/ns/tutorial/.
[27]. Stuart Kurkowski, Tracy Camp, Neil Mushell and Michael Colagrosso, A
Visualization and Analysis Tool for Ns-2 Wireless Simulations: iNSpect,
Colorado School of Mines skurkows, tcamp, nmushell, January15, 2006,
http://toilers.mines.edu/pub/Public/PublicationList/MCS-06-01.pdf,
http://www.cl.cam.ac.uk/~sos22/p50-kurkowski.pdf.
[28]. Web site: NAM: Network Animator, http://www.isi.edu/nsnam/nam/
[29]. Web site: Ns-2 Trace Formats, http://nsnam.isi.edu/nsnam/index.php/NS-
2_Trace_Formats.
[30]. Web site: Running Ns-2 and Nam Under Windows 9x/2000/XP Using Cygwin,
http://www.isi.edu/nsnam/ns/ns-cygwin.html.
[31]. YUAN Peiyan and LI Layuan. Performance Evaluation and Simulations of
Routing Protocols in Ad-Hoc Networks, International Workshop on Broadband
Wireless Access for ubiquitous Networking, Alghero, Italy, September 20-2006.
[32]. Web site: Industrial Ethernet Book Issue, http://wireless.industrial-
networking.com/articles/articledisplay.asp?id=224
[33]. Qi Xu, Secure Forwarding in Personal Ad-Hoc Networks, Master Thesis,
Design and Analysis of Communication Systems , Faculty of Electrical
Engineering, Mathematics and Computer Science , University of Twente, May-
2005.
139
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
[34]. Web site: Elizabethtown, Mt. Joy and the Entire Pennsylvania Central Valley,
Serving Computer Wellness Center, 2006 E~Town Computers,
http://www.etowncomputers.com/networking.htm
[35]. Web site: Daniele Raffo. Security Schemes for the OLSR Protocol for Ad-Hoc
Networks, PhD Thesis, Universite , 15 SEP 2005,
http://perso.crans.org/~raffo/papers/phdthesis/thesisch1.html
[36]. D. Johnson and D. Maltz. Dynamic source routing in Ad-hoc wireless networks.
Computer Science Department Carnegie Mellon University, 1996.
[37]. John Donne, Personal Area Networking, Technical Manager TDK Systems
Europe Ltd http://www.tdksystems.com/download/wp/BLUETOOTH-
PERSONAL%20AREA%20NETWORKING.pdf.
[38]. Josh Broch, David Johnson, and David Maltz. The dynamic source routing
protocol for mobile ad-hoc networks. Computer Science Department Carnegie
Mellon University Pittsburgh, PA 5213-3891, http://www.monarch.cs.cmu.edu/
[39]. Mobile Ad-hoc Networking, Copyright 2004, by Stefano Basagni, Marco Conti,
Silvia Giordano and Ivan Stojmenovic, by the Institute of Electrical and
Electronics Engineers.
[40]. Computer Networks, Fourth Edition, by Andrew s, Tanenbaum.
[41]. Web site: Freesoft. Distance Vector Algorithms,
http://www.freesoft.org/CIE/RFC/1058/6.htm.
[42]. Web site: Wikipedia, The free Encyclopedia.
http://en.wikipedia.org/wiki/Distance- vector_routing_protocol.
[43]. Data and computer communications, fifth Edition, 1997, by William Stallings.
[44]. Web site: Douglas E. Comer, The Interior Gateway Routing Protocol: OSPF,
http://www.it.iitb.ac.in/xnet/ospf/info/ospf0.html
[45]. Web site: Freesoft. Distance Vector Algorithms,
http://www.freesoft.org/CIE/RFC/1058/6.htm.
[46]. Mobile ad-hoc networks, from wireless lan to 4g networks, copyright 2005 ,by
George Aggelou.
[47]. Xiaoyan Hong, Kaixin Xu, and Mario Gerla. Scalable routing protocols for
mobile Ad-hoc networks, University of California at Los Angeles IEEE
Network, August 2002.
[48]. Web site: Jae Chung and Mark Claypool, Ns-2 by Example, Worcester
Polytechnic Institvte, Computer Science, http://nile.wpi.edu/NS/
[49]. Web site: Graph Theory illustrating Dijkstra’s algorithm Applet,
http://links.math.rpi.edu/applets/appindex/graphtheory.html
[50]. Web site: JavaTM applet illustrating Dijkstra’s algorithm at the Website,
http://www.lupinho.de/gishur/html/DijkstraApplet.html
[51]. Web site:Use Dijkstra’s algorithm to find the shortest path between two cities:
http://www.unf.edu/~wkloster/foundations/DijkstraApplet/DijkstraApplet.htm
[52]. Web site: illustrating Dijkstra’s algorithm Applet
http://www.dgp.toronto.edu/people/JamesStewart/270/9798s/Laffra/DijkstraApp
let.html
[53]. Web site: Dijkstra's Algorithm,
http://www.cs.usask.ca/resources/tutorials/csconcepts/1999_8/tutorial/advanced/
dijkstra/dijkstra.html
[54]. Web site: Simulation of Bellman's Algorithm,
http://www.laynetworks.com/Simulation%20of%20Bellman%20Algorithm.htm
140
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
[55]. Y. Hu, D. Johnson, and A. Perrig. SEAD: Secure Efficient Distance Vector
Routing for Mobile Wireless Ad-hoc Networks. In proceedings of the 4th IEEE
Workshop on Mobile Computing Systems and Applications (WMCSA), 2002
[56]. Applied Cryptography, Second Edition: Protocols Algorthms and Source Code
in C. 01/01/1996, by Bruce Schneier.
[57]. L. Zhou and Z. J. Haas. Securing Ad-Hoc Networks. IEEE Network: special
issue on network security, vol. 13, no. 6, pp. 24–30, 1999.
[58]. Y.-C. Hu, D. B. Johnson, and A. Perrig. Ariadne: A Secure On Demand Routing
Protocol for Ad-Hoc Networks. In proc. Eighth ACM International Conf. on
Mobile Computing and Networking, September 2002.
[59]. B. Dahill, E. Levine, E. Royer, and C. Shields. A Secure Routing Protocol for
Ad-Hoc Networks. University of Massachusetts, Technical Report UM-CS-
2001-037, August 2001.
[60]. P. Papadimitratos and Z. J. Haas. Secure Routing for Mobile Ad-Hoc Networks.
In proc. SCS Communication Network and Distributed System Modeling and
Simulation Conf. (CNDS’02), January, 27-31 2002.
[61]. Gregory S. Yovanof and Kerem,Ericsi. Performance Evaluation of Security-
AwhereRouting Protocols for Clustered Mobile Ad-Hoc Networks, Athens
Information Technology, Int’l Workshop on Wireless Ad-Hoc Networks,
Finland, 1 June 2004.
[62]. Web site: Bryan J. Byerly. SIP Security Requirements. Internet Engineering
Task Force, January 8-2001, http://www.softarmor.com/wgdb/docs/draft-ietf-
sip-security-requirements-00.txt
[63]. Janne Lundberg. Routing Security in Ad-Hoc Networks. Helsinki University of
Technology Telecommunications Softwhereand Multimedia Laboratory, HUT
TML 2000.
[64]. Cryptography and Network Security Principles and Practices, Fourth Edition,
Nov 2005, by William Stallings.
[65]. T. Karygiannis and L. Owens. Wireless Network Security 802.11, Bluetooth and
Handheld Devices. National Institute of Standards and Technology, US
Department of Commence, Technical Report NIST Special Publication 800-48,
November 2002. http://www.csrc.nist.gov/ publications/ nistpubs/ 800-48/
NIST_SP_800-48.pdf
[66]. M. Jakobsson, W. S and Y. B. Stealth Attacks on Ad-Hoc Wireless Networks. In
proc. Vehicular Technology Conf., October, 6-9.2003.
http://www.informatics.indiana.edu/markus/papers/router.pdf
[67]. Timothy X Brown, Jesse E. James and Amita Sethi. Jamming and Sensing of
Encrypted Wireless Ad-Hoc Networks. University of Colorado at Boulder,
Technical Report CU-CS-1005-06, Department of Computer Science,
http://www.cs.colorado.edu/department/publications/reports/docs/CU-CS-1005-
06.pdf
[68]. Jiejun Kong, Xiaoyan Hong and Mario Gerla. A NEW SET OF PASSIVE
ROUTING ATTACKS IN MOBILE AD-HOC NETWORKS. Computer
Science Department, University of California, Los Angeles, CA 90095,
http://www.cs.ucla.edu/NRL/wireless/uploads/milcom03-jkong.pdf
[69]. Web site: Handbook in Applied Cryptography. 5th printing in august 2001.
October 1996, by A. Menezes, P. van Oorschot, and S. Vanstone,
http://www.cacr.math.uwaterloo.ca/hac/
[70]. Yih-Chun Hu, Adrian Perrig and David B. Johnson. Wormhole Detection
in Wireless Ad-Hoc Networks. Technical Report TR01-384, Department
141
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
142
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Publication
143
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix A
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void printtable(int,int);
void printheader(int);
void Read_Example();
void Read_NetworkI();
void Read_NetworkII();
void Read_Any_Network();
int N,final[10],l[10],pred[10],ENF=200,w[10][10];
main(){
int s,recent,stop,i,j,n,newlabel;
int counter,y,x,add,exit=1;
144
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
while (exit==1)
{ stop=1; counter=0; add=0;
cout<<" This program to find short path using"<<"\n";
cout<<" <<<<< Dijkstra Algorithm >>>>>"<<"\n\n";
cout<<" <<< Eng. Mehmed Bisheer Aliwa spring 20-1-2007 >>>\n\n";
cout<<">Master Thesis "<<"\n\n";
cout<<" To run Book Example References [43] page 298-299(enter 1)"<<"\n";
cout<<" run Network I (enter 2)"<<"\n";
cout<<" run Network II (enter 3)"<<"\n";
cout<<" Run any Network (enter 4)"<<"\n";
cin>>x;
switch(x)
{ case 1:Read_Example();break;
case 2:Read_NetworkI();break;
case 3:Read_NetworkII();break;
default:Read_Any_Network();
}
cout<<" Please enter Source Node "<<"\n";
cin>>s;
/////////////////for initialize////////////
for(n=1;n<=N;n++)
{ l[n]=ENF;
final[n]=0;
pred[n]=1;
}
l[s]=0;
final[s]=1;
recent=s;
///////////////////////////////////////////
printheader(s);
while(stop==1)
{ for(n=1;n<=N;n++)
if((w[recent][n]<ENF)&&(w[recent][n]!=0)&&(final[n]==0))
{
newlabel=l[recent]+w[recent][n];
add++;
if(newlabel<l[n])
{ l[n]=newlabel;
pred[n]=recent;
}
}
counter++;
printtable(counter,s);
int temp=ENF;
for(int x=1;x<=N;x++)
if((final[x]==0)&&(l[x]<temp))
{y=x;
temp=l[x];
}
if(temp<ENF)
145
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{final[y]=1;
recent=y;
}
else
stop=0;
}
cout<<"\n\n\n .......<<<Eng. Mehmed Bisheer Aliwa>>>.......>spring 20-1-2007 \n";
cout<< "\n To exit press any key ";
cout<<"\n AND to Continue press ( 1 )\n";
cin>>exit;
}
return 0;
}
//////////////////////////////////////////////////////
void printheader(int s)
{ int i,x,y;
cout<<"\n"<<"itre"<<" "<<"T";
for(i=1;i<=N;i++)
if (i!=s)
{ if(N>6)
if((i==1)||(i==2))
cout<<" "<<"L["<<i<<"]";
else
cout<<" "<<"L["<<i<<"]";
else
cout<<" "<<"L["<<i<<"]";
x=wherex();
y=wherey();
gotoxy(x-=3,++y);
cout<<"path";
gotoxy(x+=3,--y);
}
cout<<"\n";
}
//////////////////////////////////////////////////////
void printtable(int counter,int s)
{ int i,j,arrive,path[10],k,x,y,x1,y1;
cout<<"\n\n";
x=wherex();
y=wherey();
x=x+14;
cout<<counter<<" "<<"[";
for(i=1;i<=N;i++)
if (final[i]==1)
cout<<i;
cout<<"]";
for(j=1;j<=N;j++)
if (j!=s)
{ i=0;
gotoxy(x,y);
146
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
if (l[j]==ENF)
cout<<"ENF"<<" "<<"-";
else
{ cout<<l[j]<<" ";
arrive=pred[j];
path[i]=j;
path[++i]=arrive;
while(arrive!=s)
{ arrive=pred[arrive];
path[++i]=arrive;
}
x1=wherex();
y1=wherey();
gotoxy(x1-=2,++y1);
for(k=i;k>=0;k--)
{cout<<path[k];
if(k!=0)
cout<<",";
}
gotoxy(x1+=2,--y1);
}
if(N>6)
x=x+7;
else
x=x+10;
}
}
//////////////Read any given network//////////////////////////
void Read_Any_Network()
{int i,j,n;
cout<<" Please enter Number of Nodes (max N=10)"<<"\n";
cin>>N;
cout<<" Please enter wait (for no link enter 0)"<<"\n";
for(i=1;i<=N;i++)
for(j=1;j<=N;j++)
if(i!=j)
{ cout<<"\n"<<"w["<<i<<"]["<<j<<"]=";
cin>>n;
if(n!=0)
w[i][j]=n;
else w[i][j]=ENF;
}
else w[i][j]=0;
}
147
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
w[1][1]=0;w[1][2]=2;w[1][3]=5;w[1][4]=1;w[1][5]=ENF;w[1][6]=ENF;
w[2][1]=3;w[2][2]=0;w[2][3]=3;w[2][4]=2;w[2][5]=ENF;w[2][6]=ENF;
w[3][1]=8;w[3][2]=6;w[3][3]=0;w[3][4]=3;w[3][5]=1;w[3][6]=5;
w[4][1]=7;w[4][2]=2;w[4][3]=3;w[4][4]=0;w[4][5]=1;w[4][6]=ENF;
w[5][1]=ENF;w[5][2]=ENF;w[5][3]=1;w[5][4]=1;w[5][5]=0;w[5][6]=2;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=8;w[6][4]=ENF;w[6][5]=4;w[6][6]=0;
}
///////////////////////////////
void Read_NetworkI()
{
N=6;
w[1][1]=0;w[1][2]=1;w[1][3]=ENF;w[1][4]=4;w[1][5]=ENF;w[1][6]=ENF;
w[2][1]=1;w[2][2]=0;w[2][3]=3;w[2][4]=ENF;w[2][5]=1;w[2][6]=ENF;
w[3][1]=ENF;w[3][2]=3;w[3][3]=0;w[3][4]=ENF;w[3][5]=1;w[3][6]=2;
w[4][1]=4;w[4][2]=ENF;w[4][3]=ENF;w[4][4]=0;w[4][5]=1;w[4][6]=ENF;
w[5][1]=ENF;w[5][2]=1;w[5][3]=1;w[5][4]=1;w[5][5]=0;w[5][6]=4;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=2;w[6][4]=ENF;w[6][5]=1;w[6][6]=0;
}
////////////////////////////////////////
void Read_NetworkII()
{
N=10;
w[1][1]=0;w[1][2]=1;w[1][3]=ENF;w[1][4]=ENF;w[1][5]=1;w[1][6]=ENF;w[1][7]=
ENF;w[1][8]=ENF;w[1][9]=ENF;w[1][10]=ENF;
w[2][1]=1;w[2][2]=0;w[2][3]=1;w[2][4]=ENF;w[2][5]=ENF;w[2][6]=ENF;w[2][7]=
ENF;w[2][8]=ENF;w[2][9]=ENF;w[2][10]=ENF;
w[3][1]=ENF;w[3][2]=1;w[3][3]=0;w[3][4]=ENF;w[3][5]=ENF;w[3][6]=3;w[3][7]=
1;w[3][8]=ENF;w[3][9]=ENF;w[3][10]=4;
w[4][1]=ENF;w[4][2]=ENF;w[4][3]=ENF;w[4][4]=0;w[4][5]=5;w[4][6]=ENF;w[4][
7]=ENF;w[4][8]=1;w[4][9]=1;w[4][10]=2;
w[5][1]=1;w[5][2]=ENF;w[5][3]=ENF;w[5][4]=5;w[5][5]=0;w[5][6]=ENF;w[5][7]=
1;w[5][8]=ENF;w[5][9]=ENF;w[5][10]=ENF;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=3;w[6][4]=ENF;w[6][5]=ENF;w[6][6]=0;w[6][
7]=ENF;w[6][8]=ENF;w[6][9]=1;w[6][10]=ENF;
w[7][1]=ENF;w[7][2]=ENF;w[7][3]=1;w[7][4]=ENF;w[7][5]=1;w[7][6]=ENF;w[7][
7]=0;w[7][8]=1;w[7][9]=ENF;w[7][10]=ENF;
w[8][1]=ENF;w[8][2]=ENF;w[8][3]=ENF;w[8][4]=1;w[8][5]=ENF;w[8][6]=ENF;w[
8][7]=1;w[8][8]=0;w[8][9]=ENF;w[8][10]=ENF;
w[9][1]=ENF;w[9][2]=ENF;w[9][3]=ENF;w[9][4]=1;w[9][5]=ENF;w[9][6]=1;w[9][
7]=ENF;w[9][8]=ENF;w[9][9]=0;w[9][10]=ENF;
w[10][1]=ENF;w[10][2]=ENF;w[10][3]=4;w[10][4]=2;w[10][5]=ENF;w[10][6]=EN
F;w[10][7]=ENF;w[10][8]=ENF;w[10][9]=ENF;w[10][10]=0;
}
148
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int printtable(int,int);
void printheader(int);
void Read_Example();
void Read_NetworkI();
void Read_NetworkII();
void Read_Any_Network();
int N,final[10],l[10],pred[10],predl[10],w[10][10],ENF=200;
main(){
int s,h,n,i,j,newlabel,path_num=ENF,x,min=ENF,pred1,exit=1,add;
while (exit==1)
{ h=0;pred1=0,add=0;
cout<<" This program to find short path using"<<"\n";
cout<<" <<<<< Bellman Ford Algorithm >>>>>"<<"\n";
cout<<" <<< Eng. Mehmed Bisheer Aliwa >>>\nDATE:20 - 1 - 2007 \n\n";
cout<<">Master Thesis"<<"\n\n";
cout<<" To run Book Example References [43] page 298-299(enter 1)"<<"\n";
cout<<" Run Network I in assignment (enter 2)"<<"\n";
cout<<" Run Network II in assignment (enter 3)"<<"\n";
cout<<" Run any Network (enter 4)"<<"\n";
cin>>x;
switch(x)
{ case 1:Read_Example();break;
case 2:Read_NetworkI();break;
case 3:Read_NetworkII();break;
default:Read_Any_Network();
}
cout<<" Please enter Source Node "<<"\n";
cin>>s;
/////////////////for initialize////////////
for(n=1;n<=N;n++)
{ l[n]=ENF;
final[n]=ENF;
pred[n]=1;
predl[n]=1;
}
l[s]=0;
final[s]=0;
///////////////////////////////////////////
printheader(s);
path_num=printtable(h,s);
while(h<=path_num)
{
149
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
for(i=1;i<=N;i++)
{ min=ENF;
pred1=0;
if(i!=s)
{
for(j=1;j<=N;j++)
if((w[j][i]<ENF)&&(i!=j))
{ newlabel=l[j]+w[j][i];
add++;
if(newlabel<min)
{ min=newlabel;
pred1=j;
}
}
final[i]=min;
pred[i]=pred1;
}
}
for(i=1;i<=N;i++)
l[i]=final[i];
path_num=printtable(++h,s);
for(i=1;i<=N;i++)
predl[i]=pred[i];
}
cout<<"\n\n\n .......<<<Eng. Mehmed Bisheer Aliwa>>>.......> spring 20-1-2006 \n";
cout<< "\n To exit press any key ";
cout<<"\n AND to Continue press ( 1 )\n";
cin>>exit;
}
return 0;
}
//////////////////////////////////////////////////////
void printheader(int s)
{ int i,x,y;
cout<<"\n"<<"h";
for(i=1;i<=N;i++)
if (i!=s)
{ if(N>6)
if((i==1)||(i==2))
cout<<" "<<"L["<<i<<"]";
else
cout<<" "<<"L["<<i<<"]";
else
cout<<" "<<"L["<<i<<"]";
x=wherex();
y=wherey();
gotoxy(x-=3,++y);
cout<<"path";
gotoxy(x+=3,--y);
}
150
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
cout<<"\n";
}
//////////////////////////////////////////////////////
int printtable(int counter,int s)
{ int i,j,arrive,path[10],k,x,y,x1,y1,max=1;
cout<<"\n\n";
x=wherex();
y=wherey();
x=x+6;
cout<<counter<<" ";
for(j=1;j<=N;j++)
if (j!=s)
{ i=0;
gotoxy(x,y);
if (l[j]==ENF)
cout<<"ENF"<<" "<<"-";
else
{ cout<<l[j]<<" ";
arrive=pred[j];
path[i]=j;
path[++i]=arrive;
while(arrive!=s)
{ arrive=predl[arrive];
path[++i]=arrive;
}
x1=wherex();
y1=wherey();
gotoxy(x1-=2,++y1);
for(k=i;k>=0;k--)
{cout<<path[k];
if(k!=0)
cout<<",";
}
gotoxy(x1+=2,--y1);
}
if(i>max)
max=i;
if(N>6)
x=x+8;
else
x=x+10;
}
return(max);
}
//////////////Read any given network//////////////////////////
void Read_Any_Network()
{int i,j,n;
cout<<" Please enter Number of Nodes (max N=10) "<<"\n";
cin>>N;
cout<<" Please enter wait (for no link enter 0)"<<"\n";
151
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
for(i=1;i<=N;i++)
for(j=1;j<=N;j++)
if(i!=j)
{ cout<<"\n"<<"w["<<i<<"]["<<j<<"]=";
cin>>n;
if(n!=0)
w[i][j]=n;
else w[i][j]=ENF;
}
else w[i][j]=0;
}
////////////////////Read Exampl of Book///////////////////////
void Read_Example()
{
N=6;
w[1][1]=0;w[1][2]=2;w[1][3]=5;w[1][4]=1;w[1][5]=ENF;w[1][6]=ENF;
w[2][1]=3;w[2][2]=0;w[2][3]=3;w[2][4]=2;w[2][5]=ENF;w[2][6]=ENF;
w[3][1]=8;w[3][2]=6;w[3][3]=0;w[3][4]=3;w[3][5]=1;w[3][6]=5;
w[4][1]=7;w[4][2]=2;w[4][3]=3;w[4][4]=0;w[4][5]=1;w[4][6]=ENF;
w[5][1]=ENF;w[5][2]=ENF;w[5][3]=1;w[5][4]=1;w[5][5]=0;w[5][6]=2;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=8;w[6][4]=ENF;w[6][5]=4;w[6][6]=0;
}
///////////////////////////////
void Read_NetworkI()
{
N=6;
w[1][1]=0;w[1][2]=1;w[1][3]=ENF;w[1][4]=4;w[1][5]=ENF;w[1][6]=ENF;
w[2][1]=1;w[2][2]=0;w[2][3]=3;w[2][4]=ENF;w[2][5]=1;w[2][6]=ENF;
w[3][1]=ENF;w[3][2]=3;w[3][3]=0;w[3][4]=ENF;w[3][5]=1;w[3][6]=2;
w[4][1]=4;w[4][2]=ENF;w[4][3]=ENF;w[4][4]=0;w[4][5]=1;w[4][6]=ENF;
w[5][1]=ENF;w[5][2]=1;w[5][3]=1;w[5][4]=1;w[5][5]=0;w[5][6]=4;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=2;w[6][4]=ENF;w[6][5]=1;w[6][6]=0;
}
////////////////////////////////////////
void Read_NetworkII()
{
N=10;
w[1][1]=0;w[1][2]=1;w[1][3]=ENF;w[1][4]=ENF;w[1][5]=1;w[1][6]=ENF;w[1][7]=
ENF;w[1][8]=ENF;w[1][9]=ENF;w[1][10]=ENF;
w[2][1]=1;w[2][2]=0;w[2][3]=1;w[2][4]=ENF;w[2][5]=ENF;w[2][6]=ENF;w[2][7]=
ENF;w[2][8]=ENF;w[2][9]=ENF;w[2][10]=ENF;
w[3][1]=ENF;w[3][2]=1;w[3][3]=0;w[3][4]=ENF;w[3][5]=ENF;w[3][6]=3;w[3][7]=
1;w[3][8]=ENF;w[3][9]=ENF;w[3][10]=4;
w[4][1]=ENF;w[4][2]=ENF;w[4][3]=ENF;w[4][4]=0;w[4][5]=5;w[4][6]=ENF;w[4][
7]=ENF;w[4][8]=1;w[4][9]=1;w[4][10]=2;
w[5][1]=1;w[5][2]=ENF;w[5][3]=ENF;w[5][4]=5;w[5][5]=0;w[5][6]=ENF;w[5][7]=
1;w[5][8]=ENF;w[5][9]=ENF;w[5][10]=ENF;
w[6][1]=ENF;w[6][2]=ENF;w[6][3]=3;w[6][4]=ENF;w[6][5]=ENF;w[6][6]=0;w[6][
7]=ENF;w[6][8]=ENF;w[6][9]=1;w[6][10]=ENF;
152
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
w[7][1]=ENF;w[7][2]=ENF;w[7][3]=1;w[7][4]=ENF;w[7][5]=1;w[7][6]=ENF;w[7][
7]=0;w[7][8]=1;w[7][9]=ENF;w[7][10]=ENF;
w[8][1]=ENF;w[8][2]=ENF;w[8][3]=ENF;w[8][4]=1;w[8][5]=ENF;w[8][6]=ENF;w[
8][7]=1;w[8][8]=0;w[8][9]=ENF;w[8][10]=ENF;
w[9][1]=ENF;w[9][2]=ENF;w[9][3]=ENF;w[9][4]=1;w[9][5]=ENF;w[9][6]=1;w[9][
7]=ENF;w[9][8]=ENF;w[9][9]=0;w[9][10]=ENF;
w[10][1]=ENF;w[10][2]=ENF;w[10][3]=4;w[10][4]=2;w[10][5]=ENF;w[10][6]=EN
F;w[10][7]=ENF;w[10][8]=ENF;w[10][9]=ENF;w[10][10]=0;
}
Note: from the above code C/C++ to run Dijksta's/Bellman program using Borland
C++ V 4.5 will appear four chosen:-
To run Example of Book that shown above (enter 1)
To run Network I that shown above (enter 2)
To run Network II that shown above (enter 3)
To run any Network that shown above (enter 4)
If enter 1 the wait of example in first page will be using by the program, wherethe
program will need to enter the start node (source node). The table of shortest path and
their cost will appear (first column iteration, second the node will be used, third each
node their cost and below each code their path). The same thing if enter 2 or 3.
But if enter 4, the program will request number of node less than 10. The program
will request to enter wait for all nodes with each other. If no connect between nodes
enter 0 and max wait 199. The program will request the start or source node. The table
of shortest path and their cost will appear.
153
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix B
154
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
155
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
156
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $wtopo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF
# Create the specified number of nodes [$opt(nn)] and "attach" them
# to the channel.
for {set i 0} {$i < $opt(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
# Define node movement model
puts "Loading connection pattern..."
source $opt(cp)
# Define traffic model
puts "Loading scenario file..."
source $opt(sc)
# Define node initial position in nam
for {set i 0} {$i < $opt(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your scenario
# The function must be called after mobility model is defined
$ns_ initial_node_pos $node_($i) 20
}
# Tell nodes when the simulation ends
for {set i 0} {$i < $opt(nn) } {incr i} {
$ns_ at $opt(stop).000000001 "$node_($i) reset";
}
# tell nam the simulation stop time
$ns_ at $opt(stop) "$ns_ nam-end-wireless $opt(stop)"
$ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt"
puts "Starting Simulation..."
$ns_ run
157
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
158
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
159
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
#
#==================================================
# Main Program
#==================================================
# Initialize Global Variables
# create simulator instance
set ns_[new Simulator]
# set wireless channel, radio-model and topography objects
set wtopo [new Topography]
# create trace object for ns and nam
set tracefd [open $opt(tr) w]
$ns_ trace-all $tracefd
# use new trace file format
$ns_ use-newtrace
set namtrace [open nam-50-1.tr w] ;# for nam tracing
$ns_ namtrace-all-wireless $namtrace 1000 1000
# define topology
$wtopo load_flatgrid $opt(x) $opt(y)
# Create God
set god_ [create-god $opt(nn)]
# define how node should be created
#global node setting
$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $wtopo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF
# Create the specified number of nodes [$opt(nn)] and "attach" them
# to the channel.
for {set i 0} {$i < $opt(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
# Define node movement model
puts "Loading connection pattern..."
source $opt(cp)
# Define traffic model
puts "Loading scenario file..."
source $opt(sc)
# Define node initial position in nam
for {set i 0} {$i < $opt(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your scenario
160
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
161
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix C
Analyzer Module of Trace File Format for
Simulator Ns-2 ver 2.31
import java.util.*;
import java.lang.*;
import java.io.*;
class tesst{
public class m{
}
public static void main(String arg[]){
System.out.println("Result of trace file format of simulator Ns-2 of Mobility Ad-Hoc
Networks ----2007");
String s,thisLine,currLine,thisLine1;
int j=0;
FileInputStream fin,fin1;
FileOutputStream fout,fout1;
//+++++++++++++++++++++++++++++++++
final int FILES=4;
//+++++++++++++++++++++++++++++++++
final int MAX_PACKETS=3799999;
try{
int i=0,sends=0, receives=0, packet_id=0, highest_packet_id = 0, line_count=0,
current_line=0, routing_packets=0;
int count=0, dropAGT=0, routing_drops=0, dpIFQ=0, dpRTR=0, dp=0;
float pdfraction, pdratio=0, time=0, packet_duration=0, end_to_end_delay=0,
avg_end_to_end_delay=0, dropratio=0;
float start_time[] = new float[MAX_PACKETS];
float end_time[] = new float[MAX_PACKETS];
float sent_packets[] = new float[MAX_PACKETS];
float received_packets[] = new float[MAX_PACKETS];
String tokens[] = new String[100];
// initialize the start time
for (i=0; i<MAX_PACKETS ; i++)
{
start_time[i] = 0;
}
fout =new FileOutputStream ("trace-output.txt");
DataOutputStream op = new DataOutputStream(fout);
op.writeBytes("Send - Received - Pdfraction - Pdratio - Routing overhead -
Normalized routingload - AverageEnd-End delay");
op.writeBytes(" - DropAGT - Dropratio - Droprouting overheadpackets -
Normalizedroutingload of Droppackets R & S - DropIFQ ");
162
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
op.writeChar('\n');
op.writeChar('\n');
for (int h=0;h<FILES+1;h++)
{
j=0;
sends=0;
dpIFQ=0;
dropAGT=0;
routing_drops=0;
receives=0; routing_packets=0;
highest_packet_id = 0;
end_to_end_delay=0;
for (i=0; i<MAX_PACKETS ; i++)
{ start_time[i] = 0; end_time[i]=0;
}
fin = new FileInputStream ("final_sources"+h+".tr");
while ((thisLine = br.readLine()) != null)
{
// scan it line by line
java.util.StringTokenizer st = new java.util.StringTokenizer(thisLine, " ");
i=0;
while(st.hasMoreElements())
tokens[i++]= st.nextToken();
if (tokens[0].equals("s") || tokens[0].equals("r") || tokens[0].equals("f") ||
tokens[0].equals("d"))
{
// analyze the time
if (tokens[1].equals("-t")) time = Float.valueOf(tokens[2]).floatValue();
// analyze the packet_id
if (tokens[39].equals("-Ii")) packet_id = Integer.valueOf(tokens[40]).intValue();
/// calculate the sent packets
if (tokens[0].equals("s")&&tokens[18].equals("AGT")&& tokens[34].equals("cbr"))
sends++;
//--------------------------------------------------------------------------------------
// calculate the drops packets IFQ
if (tokens[0].equals("d") && tokens[18].equals("IFQ")) dpIFQ++;
if (tokens[0].equals("d") && tokens[18].equals("RTR")) dpRTR++;
/// calculate the drop packets at application layer
if (tokens[0].equals("d") && tokens[18].equals("AGT") &&
tokens[34].equals("cbr")) dropAGT++;
// calculate the drops at routing packets
if (tokens[0].equals("d") && tokens[18].equals("RTR") &&
(tokens[34].equals("AODV") || tokens[34].equals("DSR") ||
tokens[34].equals("message")))
routing_drops++;
//--------------------------------------------------------------------------------------
// find the number of packets in the simulation
if (packet_id >highest_packet_id) highest_packet_id = packet_id;
// set the start time, only if its not already set
if (start_time[packet_id] == 0) start_time[packet_id] = time;
163
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
164
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
165
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{
fscanf(inFile, "%c", &f1);
if (r==rr){
ww='-';
if(ww==f1){
fscanf(inFile, "%c", &f1);
ww='t';
if(ww==f1){
fscanf(inFile, "%f", &f3);
tt=f3;
//fprintf(copy, "\n time= %f", tt);
}
}
}
ww='H';
if (ww==f1)
{
fscanf(inFile, "%c", &f1);
w='s' ;
if (w==f1)
{
fscanf(inFile, "%d", &f2);
nod=f2 ;
if(node==nod){
fprintf(copy, "\n time= %f node= %d",tt,nod);
for (i=1;i<2000;i++){
fscanf(inFile, "%c", &f1);
ww='-';
if(ww==f1){
fscanf(inFile, "%c", &f1);
ww='t';
if(ww==f1){
fscanf(inFile, "%f", &f3);
tt=f3;
rr=1 ;
break;
}
else
ww='N';
if (ww==f1){
fscanf(inFile, "%c", &f1);
w='x' ;
if (w==f1){
fscanf(inFile, "%f", &fx);
x=fx ;
fprintf(copy, " x= %f ", x);
}
w='y' ;
if (w==f1){
fscanf(inFile, "%f", &fy);
166
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
y=fy ;
fprintf(copy, " y= %f ", y);
}
}
}
}
}
}
}
if(feof(inFile)) break;
}
fclose(inFile);
fclose(copy);
cout<<"\n.......................................................................\n";
cout<<"\n\n\nwe make (x,y) = Movement for node in file\n\n\n The name of file:
xy.txt\n\n\npress Enter to return menu";
getch();
}
//-----------------------------------------------------------------------------
void nxxy()
{
clrscr();
FILE *inFile;
FILE *copy;
int i = 0;
char w ,ww ;
int nod,pq,pn,pw,f2,node,r,rr;
float tt ,f3,fx,fy,pp,x,y;
char f1, h;
inFile = fopen("r.tr", "r");
copy = fopen("xy-all.txt", "w");
fprintf(copy, "\n (x,y) = movement node \n");
tt=0 ;
r=1 ;
rr=1 ;
tt=0 ;
while(feof)
{
fscanf(inFile, "%c", &f1);
if (r==rr){
ww='-';
if(ww==f1){
fscanf(inFile, "%c", &f1);
ww='t';
if(ww==f1){
fscanf(inFile, "%f", &f3);
tt=f3;
}
}
}
167
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
ww='H';
if (ww==f1)
{
fscanf(inFile, "%c", &f1);
w='s' ;
if (w==f1)
{
fscanf(inFile, "%d", &f2);
nod=f2 ;
fprintf(copy, "\n time= %f node= %d",tt,nod);
for (i=1;i<2000;i++){
fscanf(inFile, "%c", &f1);
ww='-';
if(ww==f1){
fscanf(inFile, "%c", &f1);
ww='t';
if(ww==f1){
fscanf(inFile, "%f", &f3);
tt=f3;
rr=1 ;
break;
}
else
ww='N';
if (ww==f1){
fscanf(inFile, "%c", &f1);
w='x' ;
if (w==f1){
fscanf(inFile, "%f", &fx);
x=fx ;
fprintf(copy, " x= %f ", x);
}
w='y' ;
if (w==f1){
fscanf(inFile, "%f", &fy);
y=fy ;
fprintf(copy, " y= %f ", y);
}
}
}
}
}
}
if(feof(inFile)) break;
}
fclose(inFile);
fclose(copy);
cout<<"\n.......................................................................\n";
cout<<"\n\n\nwe make (x,y) = Movement for node in file\n\n\n The name of file:
xy-all.txt\n\n\npress Enter to return menu";
168
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
getch();
}
//...........................................................................................................
//This the main program to do all function by call using switch case
//...........................................................................................................
void main (void)
{
clrscr();
int j=30;
while(j>0)
{
clrscr();
cout<<"*****************************************************";
cout<<"\n This program for \nDATE: 2007 \n Movement Node analysis form
Trace file format Ns-2 Simulator \n";
cout<<"******************************************************";
cout<<" \n\n......... Movement Node .......";
cout<<"\n\n->To Run program choose( 0 , 1 , 2 )\n\n(1)-> Movement source Node Enter(1)";
cout<<"\n\n(2)-> Movement All Node Enter(2)";
cout<<"\n\n(0)-> Exit";
cout<<"\n****************************************************";
cout<<"\n\n Enter number--->>: " ;
cin>>j;
switch(j)
{
case 1:
{
nxy();
break;
}
case 2:
{
nxxy();
break;
}
}
}
}
169
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix D
/*
SEAD.cc, of Ns-2 Ver: 2.31
*/
extern "C" {
#include <stdarg.h>
#include <float.h>
};
#include "/home/administrator/ns/ns-2.31/dsdv/dsdv.h"
#include "/home/administrator/ns/ns-2.31/dsdv/rtable.h"
#include "priqueue.h"
#include <random.h>
#include <cmu-trace.h>
#include <address.h>
#include <mobilenode.h>
#define TESLA
#define DSDV_STARTUP_JITTER 2.0 // secs to jitter start of periodic activity from
#define DSDV_ALMOST_NOW 0.1 // jitter used for events that should be
effectively
// instantaneous but are jittered to prevent synchronization
#define DSDV_BROADCAST_JITTER 0.01 // jitter for all broadcast packets
#define DSDV_MIN_TUP_PERIOD 1.0 // minimum time between triggered updates
#define IP_DEF_TTL 32 // default TTTL
#undef TRIGGER_UPDATE_ON_FRESH_SEQNUM
static inline double
jitter (double max, int be_random_)
{
return (be_random_ ? Random::uniform(max) : 0);
}
void DSDV_Agent::trace (char *fmt,...)
{
va_list ap;
if (!tracetarget)
return;
va_start (ap, fmt);
vsprintf (tracetarget->pt_->buffer (), fmt, ap);
tracetarget->pt_->dump ();
va_end (ap);
}
void
DSDV_Agent::tracepkt (Packet * p, double now, int me, const char *type)
{
char buf[1024];
unsigned char *walk = p->accessdata ();
int ct = *(walk++);
170
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
171
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
return;
}
assert(prte && prte->trigger_event == e);
if (now < next_possible)
{
s.schedule(a->trigger_handler, e, next_possible - now);
a->cancelTriggersBefore(next_possible);
return;
}
update_type = 0;
Packet * p = a->makeUpdate(/*in-out*/update_type);
if (p != NULL)
{
if (update_type == 1)
{
s.cancel(a->periodic_callback_);
s.schedule (a->helper_, a->periodic_callback_,
a->perup_ * (0.75 + jitter (0.25, a->be_random_)));
if (a->verbose_) a->tracepkt (p, now, a->myaddr_, "PU");
}
else
{
if (a->verbose_) a->tracepkt (p, now, a->myaddr_, "TU");
}
assert (!HDR_CMN (p)->xmit_failure_);
s.schedule (a->target_, p, jitter(DSDV_BROADCAST_JITTER, a->be_random_));
a->lasttup_ = now;
}
for (a->table_->InitLoop (); (prte = a->table_->NextLoop ());)
if (prte->trigger_event && prte->trigger_event == e)
{
prte->trigger_event = 0;
delete e;
}
}
void
DSDV_Agent::cancelTriggersBefore(Time t)
{
struct rtable_ent *prte;
Scheduler & s = Scheduler::instance ();
for (table_->InitLoop (); (prte = table_->NextLoop ());)
if (prte->trigger_event && prte->trigger_event->time_ < t)
{
s.cancel(prte->trigger_event);
delete prte->trigger_event;
prte->trigger_event = 0;
}
}
void
DSDV_Agent::needTriggeredUpdate(rtable_ent *prte, Time t)
172
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{
Scheduler & s = Scheduler::instance();
Time now = Scheduler::instance().clock();
assert(t >= now);
if (prte->trigger_event)
s.cancel(prte->trigger_event);
else
prte->trigger_event = new Event;
s.schedule(trigger_handler, prte->trigger_event, t - now);
}
void
DSDV_Agent::helper_callback (Event * e)
{
Scheduler & s = Scheduler::instance ();
double now = s.clock ();
rtable_ent *prte;
rtable_ent *pr2;
int update_type;
if (periodic_callback_ && e == periodic_callback_)
{
update_type = 1;
Packet *p = makeUpdate(/*in-out*/update_type);
if (verbose_)
{
trace ("VPC %.5f _%d_", now, myaddr_);
tracepkt (p, now, myaddr_, "PU");
}
assert (!HDR_CMN (p)->xmit_failure_); // DEBUG 0x2
s.schedule (target_, p, jitter(DSDV_BROADCAST_JITTER, be_random_));
s.schedule (helper_, periodic_callback_, perup_ * (0.75 + jitter (0.25, be_random_)));
lasttup_ = now;
return;
}
for (table_->InitLoop (); (prte = table_->NextLoop ());)
if (prte->timeout_event && (prte->timeout_event == e))
break;
if (prte)
{
if (verbose_)
{
trace ("VTO %.5f _%d_ %d->%d", now, myaddr_, myaddr_, prte->dst);
}
for (table_->InitLoop (); (pr2 = table_->NextLoop ()); )
{
if (pr2->hop == prte->dst && pr2->metric != BIG)
{
if (verbose_)
trace ("VTO %.5f _%d_ marking %d", now, myaddr_, pr2->dst);
pr2->metric = BIG;
pr2->advertise_ok_at = now;
173
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
pr2->advert_metric = true;
pr2->advert_seqnum = true;
#ifndef TESLA
pr2->seqnum++;
#endif
needTriggeredUpdate(pr2, now);
}
}
// OK the timeout expired, so we'll free it. No dangling pointers.
prte->timeout_event = 0;
}
else
{
fprintf(stderr,"DFU: unknown queue event\n");
abort();
}
if (e)
delete e;
}
void
DSDV_Agent::lost_link (Packet *p)
{
hdr_cmn *hdrc = HDR_CMN (p);
rtable_ent *prte = table_->GetEntry (hdrc->next_hop_);
if(use_mac_ == 0) {
drop(p, DROP_RTR_MAC_CALLBACK);
return;
}
if (verbose_ && hdrc->addr_type_ == NS_AF_INET)
trace ("VLL %.8f %d->%d lost at %d",
Scheduler::instance().clock(),
hdr_ip::access(p)->saddr(), hdr_ip::access(p)->daddr(), myaddr_);
if (!use_mac_ || !prte || hdrc->addr_type_ != NS_AF_INET)
return;
if (verbose_)
trace ("VLP %.5f %d:%d->%d:%d lost at %d [hop %d]",
Scheduler::instance ().clock (),
hdr_ip::access (p)->saddr(),
hdr_ip::access (p)->sport(),
hdr_ip::access (p)->daddr(),
hdr_ip::access (p)->dport(),
myaddr_, prte->dst);
if (prte->timeout_event)
{
Scheduler::instance ().cancel (prte->timeout_event);
helper_callback (prte->timeout_event);
}
else if (prte->metric != BIG)
{
assert(prte->timeout_event == 0);
174
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
175
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
change_count = 0;
rtbl_sz = 0;
unadvertiseable = 0;
for (table_->InitLoop ();
(prte = table_->NextLoop ()); )
{
rtbl_sz++;
if ((prte->advert_seqnum || prte->advert_metric)
&& prte->advertise_ok_at <= now)
change_count++;
if (prte->advertise_ok_at > now) unadvertiseable++;
}
if (change_count * 3 > rtbl_sz && change_count > 3)
{ // much of the table has changed, just do a periodic update now
periodic = 1;
}
if (periodic)
{
change_count = rtbl_sz - unadvertiseable;
assert(change_count >= 1);
#if 0
trace("DAM %.5f _%d_ sz %d cc %d unat %d", now, myaddr_, rtbl_sz,
change_count, unadvertiseable);
#endif
rtable_ent rte;
bzero(&rte, sizeof(rte));
seqno_ += 2;
rte.dst = myaddr_;
rte.hop = Address::instance().get_nodeaddr(iph->saddr());
rte.metric = 0;
rte.seqnum = seqno_;
rte.advertise_ok_at = 0.0;
rte.advert_seqnum = true;
rte.changed_at = now;
rte.new_seqnum_at = now;
rte.wst = 0;
rte.timeout_event = 0;
rte.q = 0;
table_->AddEntry (rte);
}
if (change_count == 0)
{
Packet::free(p); // allocated by us, no drop needed
return NULL; // nothing to advertise
}
//* ****** make the update packet.... ***********
assert(rtbl_sz <= (1500 / 12));
p->allocdata ((change_count * 6) + 1);
walk = p->accessdata ();
*(walk++) = change_count;
176
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
#ifdef TESLA
hdrc->size_ = change_count * 22 + IP_HDR_LEN;
#else
hdrc->size_ = change_count * 12 + IP_HDR_LEN;
#endif
#if 0
int jjj = 0;
#endif
for (table_->InitLoop (); (prte = table_->NextLoop ());)
{
#if 0
jjj++;
trace("DAM %.5f _%d_ jjj %d cc %d -dst %d ok at %f",
now, myaddr_, jjj, change_count, prte->dst,
prte->advertise_ok_at );
#endif
if (periodic && prte->advertise_ok_at > now)
{
continue;
}
if (periodic || ((prte->advert_seqnum || prte->advert_metric)
&& prte->advertise_ok_at <= now))
{
if (!periodic && verbose_)
trace ("VCT %.5f _%d_ %d", now, myaddr_, prte->dst);
assert (prte->dst < 256 && prte->metric < 256);
*(walk++) = prte->dst;
*(walk++) = prte->metric;
*(walk++) = (prte->seqnum) >> 24;
*(walk++) = ((prte->seqnum) >> 16) & 0xFF;
*(walk++) = ((prte->seqnum) >> 8) & 0xFF;
*(walk++) = (prte->seqnum) & 0xFF;
prte->last_advertised_metric = prte->metric;
prte->advert_seqnum = false;
if (periodic)
{
prte->advert_seqnum = false;
prte->advert_metric = false;
}
change_count--;
}
}
assert(change_count == 0);
return p;
}
void
DSDV_Agent::updateRoute(rtable_ent *old_rte, rtable_ent *new_rte)
{
int negvalue = -1;
assert(new_rte);
177
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
178
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
179
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{
if (rte.metric < prte->metric)
{
if (rte.metric == prte->last_advertised_metric)
{
rte.advert_metric = false;
trigger_update = false;
}
else
{
rte.advert_metric = true;
trigger_update = true;
}
updateRoute(prte,&rte);
}
else
{
}
}
else if ( prte->seqnum < rte.seqnum )
{
rte.advert_seqnum = true;
if (rte.metric == prte->last_advertised_metric)
{
rte.advert_metric = false;
}
else
{
rte.advert_metric = true;
}
updateRoute(prte,&rte);
#ifdef TRIGGER_UPDATE_ON_FRESH_SEQNUM
trigger_update = true;
#else
trigger_update = false;
#endif
}
else if ( prte->seqnum > rte.seqnum )
{
if (rte.metric == BIG && prte->metric != BIG)
{
prte->advertise_ok_at = now;
prte->advert_metric = true;
needTriggeredUpdate(prte,now);
}
else
{
}
}
else
180
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{
fprintf(stderr,"%s DFU: unhandled adding a route entry?\n", __FILE__);
abort();
}
if (trigger_update)
{
prte = table_->GetEntry (rte.dst);
assert(prte != NULL && prte->advertise_ok_at == rte.advertise_ok_at);
needTriggeredUpdate(prte, prte->advertise_ok_at);
}
if (rte.q && rte.metric != BIG)
{
Packet *queued_p;
while ((queued_p = rte.q->deque()))
recv(queued_p, 0); // give the packets to ourselves to forward
delete rte.q;
rte.q = 0;
table_->AddEntry(rte); // record the now zero'd queue
}
}
prte = table_->GetEntry(Address::instance().get_nodeaddr(iph->saddr()));
if (prte)
{
if (prte->timeout_event)
s.cancel (prte->timeout_event);
else
{
prte->timeout_event = new Event ();
}
s.schedule (helper_, prte->timeout_event, min_update_periods_ * perup_);
}
else
{
bzero(&rte, sizeof(rte));
rte.dst = Address::instance().get_nodeaddr(iph->saddr());
rte.hop = Address::instance().get_nodeaddr(iph->saddr());
rte.metric = 1;
rte.seqnum = 0;
rte.advertise_ok_at = now + 604800; // check back next week... :)
rte.changed_at = now;
rte.new_seqnum_at = now;
rte.wst = wst0_;
rte.timeout_event = new Event ();
rte.q = 0;
updateRoute(NULL, &rte);
s.schedule(helper_, rte.timeout_event, min_update_periods_ * perup_);
}
Packet::free (p);
}
int
181
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
DSDV_Agent::diff_subnet(int dst)
{
char* dstnet = Address::instance().get_subnetaddr(dst);
if (subnet_ != NULL) {
if (dstnet != NULL) {
if (strcmp(dstnet, subnet_) != 0) {
delete [] dstnet;
return 1;
}
delete [] dstnet;
}
}
return 0;
}
void
DSDV_Agent::forwardPacket (Packet * p)
{
hdr_ip *iph = HDR_IP(p);
Scheduler & s = Scheduler::instance ();
double now = s.clock ();
hdr_cmn *hdrc = HDR_CMN (p);
int dst;
rtable_ent *prte;
hdrc->direction() = hdr_cmn::DOWN;
dst = Address::instance().get_nodeaddr(iph->daddr());
if (diff_subnet(iph->daddr())) {
prte = table_->GetEntry (dst);
if (prte && prte->metric != BIG)
goto send;
dst = node_->base_stn();
prte = table_->GetEntry (dst);
if (prte && prte->metric != BIG)
goto send;
else {
fprintf(stderr, "warning: Route to base_stn not known: dropping pkt\n");
Packet::free(p);
return;
}
}
prte = table_->GetEntry (dst);
if (prte && prte->metric != BIG)
{
goto send;
}
else if (prte)
{ /* must queue the packet */
if (!prte->q)
{
prte->q = new PacketQueue ();
}
182
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
prte->q->enque(p);
if (verbose_)
trace ("VBP %.5f _%d_ %d:%d -> %d:%d", now, myaddr_, iph->saddr(),
iph->sport(), iph->daddr(), iph->dport());
while (prte->q->length () > MAX_QUEUE_LENGTH)
drop (prte->q->deque (), DROP_RTR_QFULL);
return;
}
else
{ // Brand new destination
rtable_ent rte;
double now = s.clock();
bzero(&rte, sizeof(rte));
rte.dst = dst;
rte.hop = dst;
rte.metric = BIG;
rte.seqnum = 0;
rte.advertise_ok_at = now + 604800; // check back next week... :)
rte.changed_at = now;
rte.new_seqnum_at = now; // was now + wst0_, why??? XXX -dam
rte.wst = wst0_;
rte.timeout_event = 0;
rte.q = new PacketQueue();
rte.q->enque(p);
assert (rte.q->length() == 1 && 1 <= MAX_QUEUE_LENGTH);
table_->AddEntry(rte);
if (verbose_)
trace ("VBP %.5f _%d_ %d:%d -> %d:%d", now, myaddr_,
iph->saddr(), iph->sport(), iph->daddr(), iph->dport());
return;
}
send:
hdrc->addr_type_ = NS_AF_INET;
hdrc->xmit_failure_ = mac_callback;
hdrc->xmit_failure_data_ = this;
if (prte->metric > 1)
hdrc->next_hop_ = prte->hop;
else
hdrc->next_hop_ = dst;
if (verbose_)
trace ("Routing pkts outside domain: \
VFP %.5f _%d_ %d:%d -> %d:%d", now, myaddr_, iph->saddr(),iph->sport(), iph-
>daddr(), iph->dport());
assert (!HDR_CMN (p)->xmit_failure_ || HDR_CMN (p)->xmit_failure_ ==
mac_callback);
target_->recv(p, (Handler *)0);
return;
}
void
DSDV_Agent::sendOutBCastPkt(Packet *p)
183
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
{
Scheduler & s = Scheduler::instance ();
s.schedule (target_, p, jitter(DSDV_BROADCAST_JITTER, be_random_));
}
void
DSDV_Agent::recv (Packet * p, Handler *)
{
hdr_ip *iph = HDR_IP(p);
hdr_cmn *cmh = HDR_CMN(p);
int src = Address::instance().get_nodeaddr(iph->saddr());
int dst = cmh->next_hop();
if( src == myaddr_ && cmh->num_forwards() == 0) {
// * Add the IP Header
cmh->size() += IP_HDR_LEN;
iph->ttl_ = IP_DEF_TTL;
}
else if( src == myaddr_) {
drop(p, DROP_RTR_ROUTE_LOOP);
return;
}
// * Packet I'm forwarding...
else {
if(--iph->ttl_ == 0) {
drop(p, DROP_RTR_TTL);
return;
}
}
184
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
185
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
186
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
187
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Appendix E
Network Simulator Ns-2
E.1. Introduction
The simulation environment consists of a set of wireless and mobile networking
extensions that we have created Broch 1998, also, Ns-2 simulator is used because its
network simulator ns-2 is a popular and powerful simulation environment, and the
number of NS-2 users has increased greatly in recent years. Although it was originally
designed for wired networks, NS-2 has been extended to work with wireless
networks, including wireless LANs, mobile ad-hoc networks MANET, and sensor
networks and can simulate several network protocols such as TCP, UDP, multicast
routing, etc; however, the Network Animator (NAM) for NS-2 is used as a
visualization tool NS-2 is primarily useful for simulating local. More recently, support
has been added for simulation of large satellite and ad-hoc wireless networks. Ns-2 is
an open source discrete event simulator used by the research community for research
in networking. The ns-2 simulation software are developed at the University of
California at Berkeley and the Virtual Inter Network Test bed (VINT) Project Fall
1997. It is constantly under development by an active community of researchers. The
standard ns-2 distribution runs on Linux. However, a package for running ns-2 on
cygwin (Linux Emulation for Windows) is available. The latest version at the time is
ns-2.31, Where the old version as 2.29, 2.28, 2.27, 2.26, 2.1b9, 2.1b8, 2.1b7, 2.1b6,
2.1b5, 2.1b4, 2.1b3, 2.1b2, 2.1b1, 2.0 and 2.0b17. It can run both in UNIX and
Windows. But to run in Windows, it requires installing first cygwin to set the
computer environment as UNIX environment and second installing ns-2. These
extensions provide a detailed model of the physical and link layer behavior of a
wireless network and allow arbitrary movement of nodes within the network. At the
physical layer, we provide realistic modeling of factors such as free space and ground
reflection propagation, transmission power, antenna gain, receiver sensitivity,
propagation delay, carrier sense. At the link layer, with model the complete
Distributed Coordination Function (DCF) Media Access Control (MAC) protocol of
the IEEE 802.11 wireless LAN protocol standard IEEE 1997, along with the standard
Internet Address Resolution Protocol (ARP) Plummer 1982. These wireless and
mobile networking extensions are available from the Carnegie Mellon University
Monarch Project and have been widely used by other researchers; a version of them
have also now been adopted as a part of the standard VINT release of Ns-2. That has
done a simulation Ns-2 study with this environment, analyzing the behavior and
performance of routing protocols and comparing it to other proposed routing protocols
for ad-hoc networks. To setup and run a simulation, a user writes an OTcl script
(object-oriented Tool command language), which is a simulation program to initiate
an event scheduler, set up the network topology using the network objects and
plumbing functions in the library, and to tell traffic sources when to start and stop
transmitting packets through the event scheduler. When NS-2 which works as OTcl
interpreter receives the OTcl script, it will set environment parameters following the
received script. If a user wants to make a new network object, it will be easy to make
a compound object from the object library, and plumb the data path through the object
rather than write a new one. When the simulation is finished, the simulation results
are produced in one or more text-based output files that contain detailed simulation
data, which can be used to analyze directly or can be used in the graphical user
interface NAM. This graphical user interface shows the simulation result in an easy
188
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
way. The language that is written in NS-2 is not only OTcl but also C++. The event
scheduler and the basic network component objects in the data path are written and
compiled using C++ to reduce packet and event processing time. These compiled
objects need the OTcl linkage to create a matching OTcl object for each of the C++
objects to be able to work with OTcl interpreter. It can run both in Unix and
Windows.
189
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
modules, the exchanging messages which represent the packets in the network are
used. OMNeT++ supports users to study the effect of scale, node level architecture,
energy efficiency, communication architecture, system architecture, protocols etc.
190
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
each unknown destination hardware address, there is a buffer for a single packet.
Incase additional packets to the same destination is sent to ARP, the earlier buffered
packet is dropped. Once the hardware address of a packet’s next hop is known, the
packet is inserted into the interface queue.
E.3.3. Interface Queue:
The class PriQueue is implemented as a priority queue which gives priority to routing
protocol packets, inserting them at the head of the queue. It supports running a filter
over all packets in the queue and removes those with a specified destination address.
E.3.4. Mac Layer:
The IEEE 802.11 distributed coordination function (DCF) Mac protocol has been
implemented. It uses a RTS/CTS/DATA/ACK pattern for all unicast packets and
simply sends out DATA for all broadcast packets. The implementation uses both
physical and virtual carrier sense.
191
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
192
Secure Routing Algorithm for Ad Hoc Sensor Mobile Networks
Procedure for installation ns-2 over cygwin, installing ns-2 can be time-consuming for
beginners, especially when building it in a cygwin environment. The detailed
instructions for downloading and building Ns-2 on cygwin.
./install
At the command prompt the installer will check if all prerequisites are met, and if so,
will build the whole package. The installation is similar to Unix install, so at the end
of the build process you're advised to set some environment variables. This step is
required for ns to work. You might want to add these variables to your ~/.bashrc, so
you don't have to retype them every time. Finally, you might want to check your
installation with
./validate
193