Routing Protocol Simulation With NS2 Essay Example
Routing Protocol Simulation With NS2 Essay Example

Routing Protocol Simulation With NS2 Essay Example

Available Only on StudyHippo
  • Pages: 16 (4390 words)
  • Published: August 5, 2018
  • Type: Research Paper
View Entire Sample
Text preview

Network simulation provides a cost-effective approach for exploring network technology when physically testing a network system is impractical and costly. It offers an efficient solution for testing, evaluating, and validating new technologies by minimizing the time and expenses involved. By using network simulation, researchers can concentrate on specific aspects of the system while benefiting from others' research without being bogged down by unrelated components.

NS2 is a simulation platform that is developed in free open source for network technologies, making it easy for researchers to use it for the development of network technology. Until today, NS2 contains rich modules that are almost related to all aspects of network technology.

Wireless network communications have experienced significant growth in recent years. Ad hoc networks, which rely on mobile network hosts instead of cable infrastructure, have enabled communication in any environment. This ha

...

s not only facilitated free communication but also provided effective solutions for military, disaster relief, and temporary communications.

This paper aims to compare, analyze, and evaluate popular routing protocols for ad hoc networks by running simulation tests with NS2. Given that ad hoc networks are constantly moving and their topology is changing, traditional internet routing protocols (e.g., RIP, OSPF) are unable to adapt to the actual needs of these networks. As a result, numerous specialized routing protocols have been developed for ad hoc networks.

Introduction

A mobile ad hoc network (MANET) is also known as a mobile mesh network. It is a network of mobile devices connected by wireless links that can configure itself.

Wireless network communications have experienced rapid development in recent years, driven by the desire to eliminate wired network constraints and enable communication anytime and anywhere. Mobile communications ca

View entire sample
Join StudyHippo to see entire essay

now be achieved through portable computers with wireless interfaces and PDAs. While most current mobile communications still rely on a wired infrastructure, such as a base station, a new network technology called Ad Hoc network technology has emerged to enable communication without a fixed infrastructure. Ad hoc networks utilize free mobile network hosts, eliminating the need for cable infrastructure. This advancement has not only enabled free communication in various environments but also provided effective communication solutions for military operations, disaster relief efforts, and temporary communications.

Every device in a Mobile Ad hoc Network (MANET) has the freedom to move autonomously in any direction, resulting in frequent changes to its connections with other devices. As a result, each device must act as a router and forward traffic not related to its own use. The main obstacle in constructing a MANET lies in providing each device with the ability to constantly update and maintain the necessary information for efficient traffic routing.

Such networks can function independently or can be linked to the larger Internet.

Ad-hoc networks were initially used in the military but have now expanded into civilian fields with the advancements in wireless networks. A mobile ad-hoc network operates without any infrastructure, allowing nodes to easily and automatically form and dissolve connections. Nodes have the flexibility to move and can join or leave the network as needed. The rapid deployment and resilience of mobile ad-hoc networks make them increasingly popular in both military and civilian applications.

Recently, the wireless communication network known as Ad-hoc has gained attention in the industry and become a popular area of research. Ad-hoc networking enables flexible and convenient communication without the need for infrastructure, expanding

the possibilities for mobile communications and promising a bright future.

The ad hoc network is a combination of mobile communication and computer network, utilizing the computer network packet exchange mechanism instead of circuit switching. The communication hosts in ad hoc networks are typically portable computers, PDAs, and other mobile devices. Contrastingly, mobile IP networks differ in that mobile hosts can access the network through various connections such as fixed wired networks, wireless links, and dial-up links. Ad hoc networks, however, rely solely on wireless links for connection.

Mobile IP networks require support from adjacent base stations and adhere to traditional internet routing protocols. On the other hand, ad hoc networks lack this support and do not have routing functionality within the mobile host. In the case of mobile IP networks, when a mobile host moves from one zone to another, the network topology remains unchanged. Conversely, in ad hoc networks, the movement of mobile hosts results in a change in topology.

The primary aim of the study is to examine and contrast well-known ad-hoc routing protocols through simulating the Ad-hoc networking mode and its network layer using NS2. The goal of this article is to investigate and enhance the essential technology of self-configuring networks, particularly routing protocols, within an ad-hoc network structure.

When establishing a functioning Ad Hoc wireless network, certain aspects must be taken into account. These aspects encompass application size, scalability, reliability, and real-time requirements.

When creating and constructing an ad hoc network, it is crucial to thoroughly contemplate the distinct attributes of the network structure. This will enable us to devise a routing protocol that is specifically tailored for the network, ultimately optimizing performance throughout.

There are

two types of Ad Hoc wireless network topologies: flat structure and hierarchical structure. In a flat network structure, all network nodes have the same status.

The Ad Hoc wireless network topology is structured hierarchically, with clusters forming the subnet. Each cluster comprises a cluster head and multiple cluster members, both of which possess dynamic and automatic networking capabilities. The hierarchy is determined by various hardware configurations and can be categorized as single-band or multi-band structures.

In a single band hierarchy, all nodes utilize the same frequency for communication. Conversely, in a multi-band hierarchy, lower level networks have smaller communication ranges compared to higher level networks. Within each cluster, members communicate on the same frequency, while cluster head nodes use one frequency to interact with members and another frequency to maintain communication with other heads.

Both flat and hierarchical network structures have advantages and disadvantages. The flat structure network is simple, with equal status for each node. Communication between the source and destination nodes can take multiple paths, preventing network bottlenecks and ensuring relative safety. However, the network's size is limited. As the network scale expands, the routing maintenance overhead exponentially grows and consumes the limited bandwidth.

On the other hand, hierarchical network structures are not limited by network size. They have good scalability and smaller routing overhead due to clustering. Although complex cluster head selection algorithms are required in hierarchical structures, the high system throughput and simple node localization make ad hoc networks increasingly adopt this grading trend. Many proposed network routing algorithms are based on the hierarchical network structure model.

A wireless ad hoc network is formed by the integration of mobile communications and computer networks. Each node in

the network performs both router and host functions. The key characteristics of ad hoc networks are primarily focused in the following areas:

Dynamically altering network configurations:

Ad Hoc networks do not have a fixed infrastructure or centrally managed communication equipment. Network nodes have the ability to move in any direction at any speed rate. Additionally, the power of wireless transmitter devices, environmental conditions, and signal interference can all contribute to dynamic changes in the network topology.

Having limited resources:

The energy supplied to mobile hosts in Ad Hoc networks is restricted, causing a reduction in the network's functions when a host experiences significant energy loss. Furthermore, the network faces bandwidth limitations and encounters signal conflicts and interference. Consequently, the available bandwidth for mobile hosts is often considerably lower than the maximum theoretical bandwidth.

Multi-hop communication:

Multi-hop is used in Ad Hoc network communication when two network nodes cannot communicate directly due to limited resources. It enables communication between a source host and destination host that are not within the same network coverage.

Insufficient measures are in place to ensure proper physical security.

Communication among nodes in an Ad Hoc network occurs over a wireless channel, making the transmitted information highly vulnerable. Eavesdropping, retransmission, falsification, or forgery attacks can be easily executed. If the routing protocol is subjected to malicious attacks, the entire self-organizing network will cease to function effectively.

The unique characteristics of the Ad Hoc network necessitate specific considerations in the design of routing algorithms. An effective routing algorithm must consider the limitations of network resources, the dynamic nature of network topology, and strive to enhance network throughput.

Ad-Hoc wireless network routing protocols

The main concern in ad hoc network design is the development of

a routing protocol capable of ensuring efficient and effective communication between two nodes. The dynamic nature of the network, where the topology constantly changes due to mobility, requires a specialized routing protocol for ad hoc networks. Based on the previously described architecture and features of Ad Hoc networks, the routing protocol design needs to fulfill the following conditions:

The requirement for quick response capability in the dynamic network topology, as well as the prevention of routing loops and the provision of a straightforward and convenient network node localization method.

Efficiently utilizing limited bandwidth resources and compressing unnecessary overhead are essential considerations.

The implementation of multi-hop should generally not involve more than three intermediate transfers.

Minimizing the launch time and launch data is necessary to conserve limited working energy.

Design a routing protocol with security features to minimize the risk of being attacked under different circumstances.

There have been numerous proposals for ad hoc network routing protocols due to the specific characteristics of these protocols. The IETF's MANET working group is currently conducting research on ad hoc network routing protocols and has produced several protocol drafts, including DSR, AODV, and ZRP. In addition, professional researchers have published numerous articles and proposed various network routing protocols for ad hoc networks, such as DSDV and WRP. Based on the routing trigger principle, the existing routing protocols can be classified into three types: Proactive Routing protocol, Reactive routing protocol, and Hybrid routing protocols.

Proactive routing protocol, also referred to as Table-driven routing protocol, is a routing approach where each node maintains a routing table containing information to reach other nodes. The routing table is constantly updated based on changes in the network topology, providing an accurate

reflection of the network's structure. This enables immediate access to the destination node when the source code needs to send messages. This type of routing protocol is typically derived from existing wired network routing protocols and adapted for wireless ad hoc network requirements. For instance, the Destination-Sequenced Distance Vector protocol is a modification of the Routing Information Protocol (RIP). Although proactive routing protocols have minimal delays, they entail a substantial number of control messages, leading to significant overhead. Noteworthy proactive routing protocols include DSDV, HSR, GSR, and WRP.

Destination-Sequenced Distance Vector (DSDV)

DSDV prevents the formation of routing loops by assigning a unique serial number to each route. It utilizes a combination of time-driven and event-driven technology to regulate the transfer of the routing table. Each mobile node maintains its own routing table, which includes information such as valid points, routing hops, and destination routing serial number. The destination routing serial number is used to differentiate between old and new routes in order to avoid routing loops.

Each node sends its local routing table periodically to its neighbour nodes, or whenever the routing table changes. If there are no moving nodes, a larger packet with a longer interval is used to update the route. When a neighbouring node receives the information containing a modified routing table, it compares the serial numbers of the destination nodes. The routing with a larger serial number is chosen and the one with a smaller serial number is discarded. If the serial numbers are the same, the best optimized route, such as the shortest path, is used.

The routing information in each node is exchanged periodically with adjacent nodes, and the routing table is

also updated when there are changes. There are two methods to update the routing table. The first method is Full dump, where the topology update message includes the entire routing table. This method is mainly used when the network changes rapidly. The second method is Incremental update, where the update message only includes the changed part in routing. This method is typically used in networks with slower changes.

HSR, which stands for Hierarchical Source Routing, is a routing protocol used in hierarchical networks. In this protocol, nodes at higher levels store the location information of their peers. The logical sequence address is assigned from the root node at the highest level to the leaf node at the lowest level. The node address can be used using the sequence address.

The GSR protocol is similar to the DSDV mechanism as it utilizes a link-state routing algorithm. However, it prevents the excessive broadcast of routing packets. The protocol includes four main tables: adjacent node table, network topology table, next hop routing table, and distance table.

WRP is a distance-vector routing protocol that has various tables, including distance table, routing table, link overhead table, and packet retransmission table. It uses the Short Path Spanning Tree (SST) of the neighbouring node to generate its own SST and transmit updates. If there are no changes in the network routing, the receiver node sends an idle message to indicate the connection status. However, if there are changes, it modifies the distance table to find a better route. The algorithm's notable feature is that it detects changes in neighbouring nodes and then checks the sturdiness of adjacent nodes to avoid loops, ensuring faster convergence.

Reactive Routing

protocol, also referred to as on-demand routing protocol, operates by finding a route only when required. The nodes do not need to continuously maintain routing information; instead, they initiate a route look up only when there is a need to send a packet. Reactive routing protocols have a smaller overhead compared to proactive routing protocols, but they have a larger packet transmission delay, making them unsuitable for real-time applications. Some commonly used reactive routing protocols are AODV, DSR, TORA, and others.

Dynamic Source Routing (DSR) is a routing protocol.

"The purpose of DSR is to limit the amount of bandwidth used by control packets in ad hoc wireless networks. This is achieved by removing the need for regular table-update messages, which are necessary in a table-driven approach."

The primary mechanisms of DSR are Route Discovery and Route Maintenance. When a source node needs to send a packet to a destination node but lacks knowledge of the route, it uses the Route Discovery mechanism.

The route maintenance mechanism is employed by the source node when using a source route to reach the destination node. This mechanism detects routes that have become non-viable due to changes in the network topology.

The processes of route discovery and route maintenance in Dynamic Source Routing (DSR) are entirely demand-based, eliminating the necessity for periodically transmitting routing broadcast packets and link state detection packets.

TORA is an adaptive distributed routing algorithm that utilizes the link reversal technique. It is specifically designed for high-speed dynamic multi-hop wireless networks. Acting as a source-initiated on-demand routing protocol, it has the capability to discover multiple paths from the source to the destination node. The distinguishing characteristic of TORA is its

transmission of control messages within the local area exclusively when there are changes in network topology. Hence, each node only needs to store information regarding its neighboring nodes. The protocol consists of three components: route generation, route maintenance, and route deletion. At initialization, the destination node's transmission sequence number is set to 0. The source disseminates a QRY packet containing the ID of the destination node, and a UDP packet is sent by a node with a non-zero transmission sequence number as response. By always having their sequence numbers greater than that of the source by 1, these receiving nodes become upstream nodes. This process establishes a Directed Acyclic Graph (DAG) from the source to the destination node. When nodes change positions, routes need to be reconstructed. During the route deletion phase, TORA broadcasts a CLR in order to eliminate invalid routes. However, one issue with TORA arises when multiple nodes are involved in both route selection and deletion as this can lead to routing oscillation.

AODV is a Reactive routing protocol that improves upon the DSDV algorithm. To find the route to the destination node, the source end broadcasts a routing request packet which is then broadcasted to surrounding nodes until it reaches the destination node or an intermediate node with routing information to the destination node. Duplicated request packets are discarded by nodes, and routing loops are prevented using the serial number of routing request packets. Nodes can determine whether intermediate nodes have responses to corresponding routing requests. When forwarding a route request packet, a node adds the ID of its upstream node to the routing table to establish a reverse route from the

destination node to the source node. If the source end moves, the route discovery algorithm is re-initiated. If intermediate nodes move, adjacent nodes detect link failure and send link failure messages to their upstream nodes, propagating the message to the source node. The source node then relaunches the route discovery process based on the situation.

The accomplishment of AODV is the integration of the DSR and DSDV protocols. AODV includes the functionalities of both route discovery and route maintenance from DSR, while also utilizing by-hop routing, sequence numbers, and Beacon messages from DSDV.

Both proactive and reactive routing protocols in wireless ad hoc networks are not enough to fully solve the routing problem. Thus, researchers have proposed hybrid routing protocols like the Zone Routing Protocol (ZRP) that aim to combine the benefits of both proactive and reactive protocols. ZRP works by treating all nodes in the network as a center of a virtual zone, with the number of nodes within each zone determined by a predefined radius. Unlike clustering routing, ZRP allows for overlapping zones. Within a zone, ZRP uses a proactive routing algorithm, while the central node utilizes the Intrazone Routing protocol to ensure maintenance within the zone.

The platform that will be utilized in the simulation is Windows XP Professional with the addition of Cygwin and NS2.

NS2 is a simulation platform for network technologies that is open source. It enables researchers to develop and test network technology easily. It offers modules that cover different aspects of network technology. However, starting from version 2.26, NS2 does not support Windows platforms anymore.

If you want to run the latest NS2 on Windows XP, you will need Cygwin, which is

a UNIX emulator designed for Windows.

Typically, NS2 simulation can be classified into the following steps:

1. Generate the necessary components, including adding or removing new components.

2. Testing: Validate the composed component by conducting a simulation. If the component in the library meets the requirements of the simulation, which are based on existing protocols in the library, proceed to the third step of the simulation.

3. The Otcl script file should be composed to configure the topology structure of the simulating network. This involves identifying the basic link features, protocols used by moving nodes, and the number of nodes. Additionally, the terminal device protocol should be bound, the scene and traffic load of the simulation set (either TCP stream or CBR stream), and the simulation start and end time determined. It is important to set trace objects in the script file to record all events of the simulation process. The trace file is used for this purpose and can also be used to set the nam object, which is a tool for demonstrating the network running animation.

4. The NS command is used to execute a script file. When executed, a *.tr file will be generated in the same directory as the script file to record simulation results. If the nam object is set in the script file, a *.nam file will also be generated in the same directory.

5. The trace file needs to be analyzed. Given its large size, a gawk program will be created to process the data after simulation. This program will calculate packet delivery date, routing overload, throughput, etc. Drawing tools will be used to create graphs for direct analysis.

In NS2, the source

code of classic routing protocols such as DSDV, DSR, TAORA, and AODV is already integrated. This code can be found at C:cygwinhomeAdministratorns-allinone-2.34ns-2.34, as shown in figure 1.1.

Within the ADOV folder named "Take AODV as an example" (fig. 1.2), the most important files are aodv.cc and aodv.h. These files define the primary functional features. Typically, there is no need to modify the protocols' source code.

Fig.1.2 The AODV Routing Protocol

Simulation scripting

According to the simulation model, we will compare each routing protocol (DSDV, DSR, AODV, and TORA) in a small (20 nodes) and medium (50 nodes) ad hoc wireless network. The corresponding scripts are dsdv.tcl, dsr.tcl, aodv.tcl, and tora.tcl (see appendix).

The figure below (fig.3.2.1) shows the coding example using aodv.tcl.

Partial code snippets in the file aodv.tcl

Explanation of the most important codes in aodv.tcl

Define the value of val(ifq) as Queue/DropTail/PriQueue.

#Interface queue

set val(nn)50;

The simulation scenario includes the number of nodes.

The value is set to rp as AODV.

#Routing protocol to be simulated

set val(stop)300

#Length of simulation time

set val(x)500;

#The length of the scene

set val(y) to 500;

#The width of the scene

Assign the value of the variable tr to out50.tr.

#Output trace file

set the value of "nam" to out50.nam

#Output nam file

Set the opt(cp) to "cbr50".

#Stream file

Set the value of the opt(sc) attribute to "scen50".

#Scene file

Furthermore, append the subsequent declaration to the script head in order to create a simulation ns_ object:

The tracking file object is used to specify the Trace file (.tr extension) in the recording of simulation data. NS2 supports recording four types of data in different layers: application layer, routing layer, MAC layer, and node movement. The specific data to be recorded can be set in the simulation process settings. Each

layer's specified trace object records its corresponding data in the trace file, with labels added for differentiation. Furthermore, NS2 also supports visualization of the simulation process using the NAM tool, which requires generating the NAM trace file object to specify the recording trace file for simulation data. The following statements generate these two described trace file objects:

#Generate a trace file:

The text enclosed in the remains the same:

$ns_use-newtrace

The tracefd is set to open the out50.tr file for writing.

$ns_trace-all$tracefd

#Instantiate an object to generate the NAM trace file:

The namtracefd variable is set to open the out50.nam file and write to it.

The namtrace-all-wireless command in $ns allows you to trace all events related to wireless networks. The command namtracefd sets the file descriptor for the nam trace file. The commands val(x) and val(y) output the current values of variables x and y.

The cbrgen tool is used to generate traffic loads, including TCP and CBR streams. To use the cbrgen.tcl file (see appendix), follow these steps:

Codes are defined as follows:

-type

#TCP stream or CBR stream

-nn

#Number of nodes

-seed

#Indicate the desired number of random seeds

-mc

#Maximum connection limit for each node

- rate

#Overload of each stream connection

The following format is used:

The code

ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate]

can beas:
The ns cbrgen.tcl code generates a script that can be used for network simulations. It has several arguments such as -type, -nn, -seed, -mc, and -rate that can be used to specify the type of simulation, number of nodes, seed value, number of connections, and rate respectively.

./setdest is a tool that is utilized to create a random movement scenario for wireless networks. This tool has

two versions which can be used in the following manner:


-p -M

-t

-x

-y

or

./setdest -v ;2; -n

-s

-m

-M

-t

-P -p -x

-y

Which “speed” type set to uniform/normalA?A’”pause type” set to constant/uniform.

NAM animation

The NAM function is used to run the animation of specific trace output format, the output file can be based on real or simulated environment. For example, the trace file that is from the output of NS simulator.

The commands to control to control NAM animation in NS2 as following: nam out.nam

1. Node

$node color [color]

Setting the colour of node

$node shape [shape]

Setting shape of node

$node label [label]

Setting name of node

$node label-color [lcolor]

Setting display colour of node name

$node label-at [ldirection]

Setting display location of node name

$node add-mark [name] [color] [shape]

Add annotation

$node delete-mark [name]

Delete annotation

2. Link and Queue

$ns duplex-link



attribute: orientA?a‚¬A?colorA?a‚¬A?queuePosA?a‚¬A?label

3.Agent

Use the following commands to make the agent you wish to display appears as AgentName in the box.

$ns add-agent-trace

$Agent AgentName

The parameters of movement scene and node flow are in the

tables shown below:

Parameter of node movement scene:

Parameter

Number of nodes

Moving range

Resting time

Simulation time

Values set

20, 50

500 x 500 m

1 s

300 s

Parameter of node movement scene:

Parameter

Maximum moving speed

Packet size

Node communication distance

Type of service

Values set

5, 10, 15, 10, 25, 30-50

512 byte

250 m

CBR

Trace file analysis

Performance parameter analysis model

The indicator to measure the performance of ad hoc network routing protocol is commonly including qualitative indicator and quantitative indicator. Qualitative indicator describes the overall performance of a particular aspect of the network, such as the security, distribution operation, provide loop free route and whether to support single channel etc. and quantitative indicators can describe the performance of a certain aspect of the network in more details. The quantitative indicator of packet delivery ratio, average end to end delay and throughput etc are often used to measure the performance of network routing protocols.

a. Packet delivery ratio: is a ratio of the number of packet sent from the source node and the number of packet that have been received by destination node in the application layer, which not only describes the loss rate observed in the application layer, but also reflect the maximum throughput supported by the network. It is the indicator o

Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New