All About NS2

INTRODUCTION TO NETWORK SIMULATION TOOLS

NETWORK

Network is an arrangement of intersecting horizontal and vertical lines. Computer networks allows computers to exchange data.In computer networks, networked computing devices pass data to each other along data connections.The connection between nodes are established using either cabled media or wireless media. The best known computer network is the Internet.

Network computer devices that originate, route and terminate the data are called Network nodes. Nodes can include host such as computers,mobile phones and servers as well as networking hardware. Two such devices are said to be networked together when one device is able to exchange information with the other device, whether or not they have a direct connection to each other. Computer networks support applications such as access to the World Wide Web, shared use of application and storage servers, printers, and fax machines, and use of email and instant messaging applications. Computer networks differ in the physical media used to transmit their signals, the communications protocols to organize network traffic, the network's size, topology and organizational intent.

NETWORK SIMULATION

In network research, network simulation is a technique where a program models the behavior of a network either by calculating the interaction between the different network entities (hosts/packets, etc.) using mathematical formulas, or actually capturing and playing back observations from a production network. The behavior of the network and the various applications and services it supports can then be observed in a test lab; various attributes of the environment can also be modified in a controlled manner to assess how the network would behave under different conditions. When a simulation program is used in conjunction with live applications and services in order to observe end-to-end performance to the user desktop, this technique is also referred to as network emulation.

NETWORK SIMULATOR

A network simulator is software or hardware that predicts the behavior of a computer network without an actual network being present. In simulators, the computer network is typically modeled with devices, traffic etc. and the performance is analysed. Typically, users can then customize the simulator to fulfill their specific analysis needs. Simulators typically come with support for the most popular protocols and networks in use today, such as WLAN, Wi-Max,TCP, WSN, cognitive radio etc.

SIMULATION SCENARIO

Most of the commercial simulators are GUI driven, while some network simulators are CLI driven. The network model / configuration describes the state of the network (nodes,routers, switches, links) and the events (data transmissions, packet error etc.). An important output of simulations are the trace files. Trace files log every packet, every event that occurred in the simulation and are used for analysis. Network simulators can also provide other tools to facilitate visual analysis of trends and potential trouble spots.

Most network simulators use discrete event simulation, in which a list of pending "events" is stored, and those events are processed in order, with some events triggering future events—such as the event of the arrival of a packet at one node triggering the event of the arrival of that packet at a downstream node.

Some network simulation problems, notably those relying on queuing theory, are well suited to Markov chain simulations, in which no list of future events is maintained and the simulation consists of transiting between different system "states" in a memory less fashion. Markov chain simulation is typically faster but less accurate and flexible than detailed discrete event simulation.

Simulation of networks is a very complex task. For example, if congestion is high, then estimation of the average occupancy is challenging because of high variance. To estimate the likelihood of a buffer overflow in a network, the time required for an accurate answer can be extremely large. Specialized techniques such as "control variates" and "importance sampling" have been developed to speed simulation.

USES OF NETWORK SIMULATOR

Network simulators serve a variety of needs. Compared to the cost and time involved in setting up an entire test bed containing multiple networked computers, routers and data links, network simulators are relatively fast and inexpensive. They allow engineers, researchers to test scenarios that might be particularly difficult or expensive to emulate using real hardware - for instance, simulating a scenario with several nodes or experimenting with a new protocol in the network. Network simulators are particularly useful in allowing researchers to test new networking protocols or changes to existing protocols in a controlled and reproducible environment. A typical network simulator encompasses a wide range of networking technologies and can help the users to build complex networks from basic building blocks such as a variety of nodes and links. With the help of simulators, one can design hierarchical networks using various types of nodes like computers, hubs, bridges, routers, switches, links, mobile units etc.

Various types of Wide Area Network (WAN) technologies like TCP, ATM, IP etc. and Local Area Network (LAN) technologies like Ethernet, token rings etc., can all be simulated with a typical simulator and the user can test, analyze various standard results apart from devising some novel protocol or strategy for routing etc. Network simulators are also widely used to simulate battlefield networks in Network-centric warfare

There are a wide variety of network simulators, ranging from the very simple to the very complex. Minimally, a network simulator must enable a user to represent a network topology, specifying the nodes on the network, the links between those nodes and the traffic between the nodes. More complicated systems may allow the user to specify everything about the protocols used to handle traffic in a network. Graphical applications allow users to easily visualize the workings of their simulated environment. Text-based applications may provide a less intuitive interface, but may permit more advanced forms of customization.

SIMULATION TOOLS

1. Traffic

Developed by: E. Software

Available at: http://www.members.iinet.net.au/~clark/

Traffic version 2 is a simulation product designed to solve complex call-centre modelling problems, where traditional Erlang equations fail, but it can also be applied to any other queueing problem. It has an easy to use graphical interface and it runs under Windows.

2. PhySim

Developed by: Tetcos

Available at: http://www.tetcos.com/physim.html

PhySim allows for creation of Baseband, RF, Channel and Receiver chain and comes with inbuilt Oscilloscope, Spectrum Analyzer and Polar Plot. Techniques covered include ASK, FSK, PSK, DPSK, QPSK, PAM, PWM, PPM, TDM - PAM, AM-DSB-SC, SSB - SC , PCM, DM,Transmission Line, IF, RF, Dipole and AWGN. A free download of PhySim demo version is available at www.tetcos.com.

3. NetSim

Developed by: tetcos

Available at: http://www.tetcos.com/software.html

NetSim is developed by Tetcos and it is used for network lab experimentation and research. The protocols covered in simulation are aloha, slotted aloha, Ethernet - CSMA / CD, Fast Ethernet, Gigabit Ethernet, Token Ring, Token Bus, W Lan, X.25 Frame Relay, ATM, TCP, IP -Routing RIP, OSPF, BGP, MPLS, Wi-Max, Wireless Sensor Networks and Zigbee 802.15.4. The standard version features protocol source codes in C which can be modified and linked via the development environment. A free demo version can be downloaded from the website.

4. Shunra Virtual Enterprise

Developed by: Shunra

Available at: http://www.shunra.com/network_simulation_products.aspx

Shunra VE network simulation is a tool for pre-deployment testing and capacity planning and can be used for a wide variety of applications and projects. Shunra VE website claims its use by over 1700 customers within the financial services, retail, manufacturing, energy, technology and telecommunications, healthcare and pharmaceutical, travel, media and hospitality industries as well as government agencies and militaries. Shunra Virtual Enterprise (Shunra VE) is a powerful network simulation solution that creates an exact model of any production environment. This includes the network, remote locations, and the number and distribution of local and remote end-users. With Shunra VE, you can test the functionality, performance, scalability and robustness of any application or network infrastructure under current and future real-world conditions.

5. OPNET

Developed by: O. Technologies

Available at: http://www.opnet.com/

OPNET's suite of products combine predictive modeling and a comprehensive understanding of networking technologies to enable customers to design, deploy, and manage network infrastructure, network equipment, and networked applications. In particular OPNET Modeler is a development environment, allowing you to design and study communication networks,devices, protocols, and applications.

6. GloMoSim

Developed by: UCLA

Available at: http://pcl.cs.ucla.edu/projects/glomosim/

GloMoSim is a scalable simulation environment for wireless and wired network systems. It employs the parallel discrete-event simulation capability provided by Parsec. GloMoSim currently supports protocols for a purely wireless network. In the future, we anticipate adding functionality to simulate a wired as well as a hybrid network with both wired and wireless capabilities. GloMoSim source and binary code can be downloaded only by academic institutions for research purposed. Commercial users must use QualNet, the commercial version of GloMoSim.

7. CNet

Developed by: C. M. U. of Western Australia

Available at: http://www.csse.uwa.edu.au/cnet/

CNET is a simulator of computer networks. This simulator is not really focused on industrial simulation 'per-se', but to an aspect of it. It is a discrete-event network simulator enabling experimentation with various data-link layer, network layer, routingand transport layer networking protocols. It has been specifically developed for, and used in, undergraduate computer networking courses taken by thousands of students worldwide.

8. OptSim

Developed by: R. D. Group

Available at: http://www.rsoftdesign.com/products.php?sub=System+and+Network&itm=OptSim

OptSim 4.7 is the result of the merge between the former OptSim 3.6 sample mode engine, implementing simulation in the time domain sample by sample using a linear convolution algorithm, and the LinkSIM block mode engine, impelenting the Frequency Domain Split Step. It is an intuitive modeling and simulation environment supporting the design and the performance evaluation of the transmission level of optical communication systems.

9. GTNetS

Developed by: GeorgiaTech

Available at: http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/

The Georgia Tech Network Simulator (GTNetS), developed by Dr George Riley, is a full-featured network simulation environment that allows researchers in computer networks to study the behavior of moderate to large scale networks, under a variety of conditions. The design philosophy of GTNetS is to create a simulation environment that is structured much like actual networks are structured. For example, in GTNetS, there is clear and distinct separation of protocol stack layers. It is availabe for download from the website.

10. The Network Simulator - ns2

Developed by: U. of Southern California

Available at: http://www.isi.edu/nsnam/ns/

Ns2 is a discrete event simulator targeted at networking research. Ns provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks. Ns is devloped by ISI, the Information Sciences Institute at the USC school of engineering. The full source code of ns 2 can be downloaded and it can be compiled of multiple platform, including most popular Unix flavours and Windows.

11. JiST / SWANS

Developed by: R. B. C. University

Available at: http://jist.ece.cornell.edu/

SWANS is a scalable wireless network simulator built atop the JiST platorm. SWANS is organized as independent software components that can be composed to form complete wireless network or sensor network configurations. Its capabilities are similar to ns2 and GloMoSim, but is able to simulate much larger networks. SWANS leverages the JiST design to acheive high simulation throughput, save memory, and run standard Java network applications over simulated networks. In addition, SWANS implements a data structure, called hierarchical binning, for efficient computation of signal propagation.

12. OMNeT++

Developed by: O. C. Site

Available at: http://www.omnetpp.org/

OMNeT++ is a component-based, modular and open-architecture simulation environment with strong GUI support and an embeddable simulation kernel. The simulator can be used for modelling: communication protocols, computer networks and traffic modelling, multi-processors and distributed systems, etc. OMNeT++ also supports animation and interactive execution. It is freely distributed under an academic public license.

13. QualNet Developer

Developed by: S. N. Technologies

Available at: http://www.scalable-networks.com/

QualNet is a modelling tool for wireless and wired network,. The QualNet suite is composed of

QualNet Simulator, which claims to be the fastest for real-time traffic modelling. QualNet Animator allows to graphically design the network model (using a wide library of components) and it displays the results of simulation runs. QualNet Designer allos to create Finite State Automata to describe the behaviour of your network, while with QualNet Analyzer and Designer you can interpret and make sense of simulation results. Windows and Linux versions are available. A demo can be downloaded on request.

14. PARSEC

Developed by: U. P. C. Laboratory

Available at: http://pcl.cs.ucla.edu/projects/parsec/

Parsec is a C-based simulation language, developed by the Parallel Computing Laboratory at UCLA, for sequential and parallel execution of discrete-event simulation models. It can also be used as a parallel programming language. It is available in binary form only for academic institutions. Commercial users are directed to its commercial implementation QualNet, marketed by Scalable Networks technologies (http://www.scalable-networks.com/)

15. NCTuns

Developed by: U. of Twente

Available at: http://nsl10.csie.nctu.edu.tw/

The NCTUns is a high-fidelity and extensible network simulator and emulator capable of simulating various protocols used in both wired and wireless IP networks. Its core technology is based on the novel kernel re-entering methodology. NCTUns can be used as an emulator, it directly uses the Linux TCP/IP protocol stack to generate high-fidelity simulation results, and it has many other interesting qualities. It is commercialised by SimReal Inc.

16. Performance PROPHET

Developed by: U. of Vienna

Available at: http://www.dps.uibk.ac.at/projects/prophet/

The Performance Prophet is a tool for modeling and simulation of high performance computing systems based on CSIM (Mesquite Software). Based on a UML model of an application and a simulator for a target architecture, the tool can predict the execution behavior of the application model on cluster and grid architectures. Performance Prophet has been deveoped at the Distributed and Parallel Systems Group of the University of Innsbruck and it has been supported by the Austrian Science Fund.

INTRODUCTION TO NS2

INTRODUCTION

Network Simulator Version 2, widely known as NS2, is an event driven simulation tool that is useful in studying the dynamic nature of communication networks. Simulation of wired as well as wireless network functions and protocols (e.g., routing algorithms, TCP, UDP) can be done using NS2. In general, NS2 provides users with a way of specifying such network protocols and simulating their corresponding behaviors. Due to its flexibility and modular nature, NS2 has gained constant popularity in the networking research community since its birth in 1989. Ever since, several revolutions and revisions have marked the growing maturity of the tool, thanks to substantial contributions from the players in the field. Among these are the University of California and Cornell University who developed the REAL network simulator,1 the foundation which NS is based on. Since 1995 the Defense Advanced Research Projects Agency (DARPA) supported development of NS through the Virtual InterNetwork Testbed (VINT) project.Currently the National Science Foundation (NSF) has joined the ride in development. Last but not the least, the group of researchers and developers in the community are constantly working to keep NS2 strong and versatile.

BASIC ARCHITECTURE OF NS2

Figure given below shows the basic architecture of NS2. NS2 provides users with an executable command ns which takes on input argument, the name of a Tcl simulation scripting file. Users are feeding the name of a Tcl simulation script (which sets up a simulation) as an input argument of an NS2 executable command ns. In most cases, a simulation trace file is created, and is used to plot graph and/or to create animation.

NS2 consists of two key languages: C++ and Object-oriented Tool Command Language (OTcl). While the C++ defines the internal mechanism (i.e.,a back end) of the simulation objects, the OTcl sets up simulation by assembling and configuring the objects as well as scheduling discrete events (i.e.,a front end). The C++ and the OTcl are linked together using TclCL. Mapped to a C++ object, variables in the OTcl domains are sometimes referred to as handles. Conceptually, a handle (e.g., n as a Node handle) is just a string (e.g.,o10) in the OTcl domain, and does not contain any functionality. Instead, the functionality(e.g., receiving a packet) is defined in the mapped C++ object (e.g., of class Connector). In the OTcl domain, a handle acts as a front end which interacts with users and other OTcl objects. It may defines its own procedures and variables to facilitate the interaction. Note that the member procedures and variables in the OTcl domain are called instance procedures(instprocs) and instance variables(instvars), respectively. Before proceeding further, the readers are encouraged to learn C++ and OTcl languages and we include it on our previous posts.

NS2 provides a large number of built in C++ objects. It is advisable to use these C++ objects to set up a simulation using a Tcl simulation script. However, advance users may find these objects insufficient. They need to develop their own C++ objects, and use a OTcl configuration interface to put together these objects. After simulation, NS2 outputs either text-based or animation-based simulation results. To interpret these results graphically and interactively, tools such as NAM (Network AniMator) and XGraph are used. To analyze a particular behavior of the network, users can extract a relevant subset of text-based data and transform it to a more conceivable presentation.

INSTALLATION

NS2 is a free simulation tool. It runs on various platforms including UNIX (or Linux), Windows, and Mac systems. Being developed in the Unix environment, with no surprise, NS2 has the smoothest ride there, and so does its installation.

NS2 source codes are distributed in two forms: all-in-one suite and the component-wise. With the all-in-one package, users get all the required components along with some optional components. This is basically a recommended choice for the beginners. This package provides an “install” script which configures the NS2 environment and creates NS2 executable file using the “make” utility. The current all-in-one suite consists of the following main components :

    • NS release 2.30,

    • Tcl/Tk release 8.4.13,

    • OTcl release 1.12, and

    • TclCL release 1.18.

and the following are the optional components:

    • NAM release 1.12: NAM is an animation tool for viewing network simulation traces and packet traces.

    • Zlib version 1.2.3: This is the required library for NAM.

    • Xgraph version 12.1: This is a data plotter with interactive buttons for panning, zooming, printing, and selecting display options.

The idea of the component-wise approach is to obtain the above pieces and install them individually. This option save considerable amount of downloading time and memory space. However, it could be troublesome for the beginners, and is therefore recommended only for experienced users.

Click the following links to know more about installation:

NS2 DIRECTORY AND LANGUAGES

NS2 DIRECTORY

Normally NS2 is installed in the directory nsallinone-2.35 and we can see that in the following figure.

Figure given below shows the directory structure under directory nsallinone-2.35.

ns2 directory structure

Here, directory nsallinone-2.35 is on the Level 1.

On the Level 2, directory tclcl-1.18 contains classes in TclCL (e.g., Tcl, TclObject, TclClass). All NS2 simulation modules are in directory ns-2.35 on the Level 2. Here after, we will refer to directories ns-2.30 and tclcl-1.18 as ̃ns/ and ̃tclcl / respectively.

On Level 3, the modules in the interpreted hierarchy are under the directory tcl. Among the directories,the frequently used ones ( ns-lib.tcl,ns-node.tcl,ns-node.tcl) are stored under the directory lib on Level 4.Simulation modules in compiled hierarchy are classified in the directories on level 3.For example,directory tools contains various helper classes such as random variable generators. Directory common contains basic modules related to packet forwarding such as simulator,scheduler,packet and connectors.Directories queue,tcp and trace contain modules for queue, TCP [Transmission Control Protocol and tracing respectively.

Network Simulator is mainly based on two languages. They are;

1) C++.

2) OTCL.

NS2 ARCHITECTURE

NS2 LANGUAGES

The network simulator is a bank of of different network and protocol objects.

Each of these two languages has its own strengths and weaknesses. NS2 beautifully integrates these two languages to draw out their strengths. For most of the time, you would not need to know the integration mechanism. But you need to know the strength and weaknesses of these two languages in order to apply them properly.

OTCL [Object Oriented Tool Command Language]

OTCL is short for MIT Object TCL and it is an extension to the TCL/TK for object oriented programming.An OTcl program can run on the fly without the need for compilation. Upon execution, the interpreter translates OTcl instructions to machine code understandable to the operating system line by line.Therefore, OTcl codes run more slowly than C++ codes do. The upside of OTcl codes is that every change takes effect immediately.

OTcl helps in the following way:

    1. With the help of OTcl, we can describe different network topologies.

    2. It helps us to specify the protocols and their applications.

    3. It allows fast development.

    4. Tcl is compatible with many platforms and it is flexible for integration.

    5. Tcl is very easy to use and it is available in free.

C++

Most important parts and kernal of NS2 is created by using C++. A C++ program needs to be compiled (i.e., translated) into the executable machine code. Since the executable is in the form of machine code, C++ program is very fast to run. However, the compilation process can be quite annoying. Every tiny little change like adding “int x = 0;” will take few seconds.

C++ helps in the following way:

    1. It helps to increase the efficiency of simulation.

    2. Its is used to provide details of the protocols and their operation.

    3. It is used to reduce packet and event processing time.

WHY TWO LANGUAGES???

The main requirement of simulator is;

    • Detailed simulation of Protocol: Run-time speed.

    • Varying parameters or configuration: easy to use.

C++ is fast to run but slower to code and change. Incase of OTCL, it is easy to code but runs slowly.This is the major reason that we are going behind the using of two languages for scripting and for kernal.

AWK Script

AWK is a high level programming language which is used to process text files,named after its three orginal author's name:

A : Alfred Aho

W : Peter Weinberger

K : Brian Kernighan

AWK Scripts are very good in processing the data from the log (trace files) which we get from NS2. If you want to process the trace file manually.

AWK PROGRAM STRUCTURE

Awk program structure contains mainly three parts;

1. Begin

2. Content

3. End

BEGIN {<initialization>}

<pattern1> {<actionSet1>}

<pattern2> {<actionSet2>}

. . .

END {<final finalActionSet>}

BEGIN : Begin deals with what to be executed prior to text file processing,normally which is used to initialize variable values or constants.

CONTENT : Script which process the text file. In this part, AWK moves lines by lines (i.e., records by records) and executes the <actionSet> if the current line match with the pattern. The actions repeats until AWK reaches the end of the file.

END : This part explains what to be executed after the text file processing ie. what to print on the terminal or to show output in terminal.

EXECUTION

Awk has two types of execution;

1) Plain Execution.

2) Match and Execute.

Plain Execution : Simply AWK statements.

Match and execute : The second type of execution is “Match and Execute”, when executes plain execution statements only if the current line (of the input text file) matches with a predefined pattern. The pattern can be either : 1. Logical Expression 2. Regular Expression.

TRACE FILE AND AWK SCRIPT

Here is a sample of trace file from NS2 , to know more about trace file click here

Sample Awk Script

XGrpah

The xgraph program draws a graph on an X display given data read from either data files or from standard input if no files are specified. It can display up to 64 independent data sets using different colors and/or line styles for each set. It annotates the graph with a title, axis labels, grid lines or tick marks, grid labels, and a legend. There are options to control the appearance of most components of the graph.

A data set consists of an ordered list of points of the form “directive X Y”. For directive “draw”, a line will be drawn between the previous point and the current point. Specifying a “move” directive tells xgraph not to draw a line between the points. “draw” is the default directive. The name of a data set can be specified by enclosing the name in double quotes.

The interface used to specify the size and location of this window depends on the window manager currently in use. Once the window has been opened, all of the data sets will be displayed graphically with a legend in the upper right corner of the screen.

Xgraph also presents three control buttons in the upper left corner of each window: Hardcopy, Close and about xgraph accepts a large number of options most of which can be specified either on the command line, in the user’s .Xdefaults or .Xresources file, or in the data files themselves.

The xgraph can be installed to your linux by using the below code on the terminal window;

In Ubuntu 10.10 you can now install ns,nam and xgraph by just a single command in the Terminal:

$ sudo apt-get install ns2 nam xgraph

You will be prompted for the user password. Enter it and watch Ubuntu 10.10 do the things for You!

The following program shows how XGraph can be used to plot the bandwidth of two nodes connected through full duplex wired link.

#Create a simulator object

set ns [new Simulator]

#Open the output trace file

set f0 [open out0.tr w]

#Create 2 nodes

set n0 [$ns node]

set n1 [$ns node]

#Connect the nodes using duplex link

$ns duplex-link $n0 $n1 1Mb 100ms DropTail

#Define a 'finish' procedure

proc finish {} {

global f0

#Close the output files

close $f0

#Call xgraph to display the results

exec xgraph out0.tr -geometry 800x400 &

exit 0

}

#Define a procedure which periodically records the bandwidth received by the

#the traffic sink0 and writes it to the file f0.

proc record {} {

global sink0 f0

#Get an instance of the simulator

set ns [Simulator instance]

#Set the time after which the procedure should be called again

set time 0.5

#How many bytes have been received by the traffic sinks?

set bw0 [$sink0 set bytes_]

#Get the current time

set now [$ns now]

#Calculate the bandwidth (in MBit/s) and write it to the files

puts $f0 "$now [expr $bw0/$time*8/1000000]"

#Reset the bytes_ values on the traffic sinks

$sink0 set bytes_ 0

#Re-schedule the procedure

$ns at [expr $now+$time] "record"

}

#Create three traffic sinks and attach them to the node n4

set sink0 [new Agent/LossMonitor]

#Start logging the received bandwidth

$ns at 0.0 "record"

$ns at 60.0 "finish"

#Run the simulation

$ns run

AWK Scripts are very good in processing the data column wise. For example the first column in the above trace file represents r, s which indicates receive, sent respectively. If we want to trace the entire r and s alone from this trace file we can represent it as $1

So

$1 : Action (r,s,d.f)

$2 Time

$3 Time value

$4 node id

$5 node id value

$6 id of next hop

$7 next hop id value

.

.

.

.

More description of trace file is in above link.

To run awk script, we have to use terminal window.

For that first we have to install gawk in Linux.for that we have to write following code in terminal;

sudo apt-get install gawk

xgraph plot of the above program

====================================================================

More improvements on XGraph

In the above program we can see that the xgraph is called and and the output is plotted by using the finish procedure;

ie:

#Define a 'finish' procedure

proc finish {} {

global f0

#Close the output files

close $f0

#Call xgraph to display the results

exec xgraph out0.tr -geometry 800x400 &

exit 0

}

The following commands can be used to improve the appearance of xgraph . Add these commands on the end of "exec xgraph out0.tr -geometry 800x400 &" line in the above finish procedure;and observe the change.

1) -geometry WxH+X+Y or /=WxH+X+Y (Geometry)

Specifies the initial size and location of the xgraph window.

2) -bar (BarGraph)

Specifies that vertical bars should be drawn from the data points to a base point which can be specified with -brb. Usually, the -nl flag is used with this option. The point itself is located at the center of the bar.

3) -fitx

Translate and scale the x data from all datasets to fit [0. . . 1].

4) -fity

Translate and scale the y data from all datasets to fit [0. . . 1].

5) -fmtx <printf-format> -fmty <printf-format>

Use the format specified to generate the legends for the x or y axis.

6) -bb (BoundBox)

Draw a bounding box around the data region. This is very useful if you

prefer to see tick marks rather than grid lines (see -tk).

7) -bd <color> (Border)

This specifies the border color of the xgraph window.

8) -bg <color> (Background)

Background color of the xgraph window.

9) -brb <base> (BarBase)

This specifies the base for a bar graph. By default, the base is zero.

10) -brw <width> (BarWidth)

This specifies the width of bars in a bar graph. The amount is specified

in the user’s units. By default, a bar one pixel wide is drawn.

11) -bw <size> (BorderSize)

Border width (in pixels) of the xgraph window.

12) -fg <color> (Foreground)

Foreground color. This color is used to draw all text and the normal grid lines in the window.

13) -gw (GridSize)

Width, in pixels, of normal grid lines.

14) -gs (GridStyle)

Line style pattern of normal grid lines.

15) -lf <fontname> (LabelFont)

Label font. All axis labels and grid labels are drawn using this font. A font name may be specified exactly (e.g. ”9x15” or ”-*-courier-bold-rnormal-*-140-*”) or in an abbreviated form: ¡family¿-¡size¿. The family is the family name (like helvetica) and the size is the font size in points (like 12). The default for this parameter is ”helvetica-12”.

16) -lnx (LogX)

Specifies a logarithmic X axis. Grid labels represent powers of ten.

17) -lny (LogY)

Specifies a logarithmic Y axis. Grid labels represent powers of ten.

18) -lw width (LineWidth)

Specifies the width of the data lines in pixels. The default is zero.

19) -lx <xl,xh> (XLowLimit, XHighLimit)

This option limits the range of the X axis to the specified interval. This (along with -ly) can be used to ”zoom in” on a particularly interesting portion of a larger graph.

20) -ly <yl,yh> (YLowLimit, YHighLimit)

This option limits the range of the Y axis to the specified interval.

21) -m (Markers)

Mark each data point with a distinctive marker. There are eight distinctive markers used by xgraph. These markers are assigned uniquely to each different line style on black and white machines and varies with each color on color machines.

22) -M (StyleMarkers)

Similar to -m but markers are assigned uniquely to each eight consecutive data sets (this corresponds to each different line style on color machines).

23) -nl (NoLines)

Turn off drawing lines. When used with -m, -M, -p, or -P this can be used to produce scatter plots. When used with -bar, it can be used to produce standard bar graphs.

24) ng (NoLegend)

Turn off drawing Legends. Can be used to increase the drawing area.

25) -t <string> (TitleText)

Title of the plot. This string is centered at the top of the graph.

26) -tf <fontname> (TitleFont)

Title font. This is the name of the font to use for the graph title. A font name may be specified exactly (e.g. ”9x15” or ”-*-courier-bold-r-normal-*-140-*”) or in an abbreviated form: ¡family¿-¡size¿. The family is the family name (like helvetica) and the size is the font size in points (like 12). The default for this parameter is ”helvetica-18”.

27) -x <unitname> (XUnitText)

This is the unit name for the X axis. Its default is ”X”.

30) -y <unitname> (YUnitText)

This is the unit name for the Y axis. Its default is ”Y”.

31) -zg <color> (ZeroColor)

This is the color used to draw the zero grid line.

32) -zw <width> (ZeroWidth)

This is the width of the zero grid line in pixels.

example:

#Define a 'finish' procedure

proc finish {} {

global f0

#Close the output files

close $f0

#Call xgraph to display the results

exec xgraph out0.tr -geometry 800x400 & -bar -fitx -fity -bb -bg white

exit 0

}

you can download an example program for plotting xgraph from here

Gnu PLOT

1. INSTALLING AND STARTING GNUPLOT

Gnuplot is a free, command-driven, interactive, function and data plotting program. Pre-compiled executeables and source code for Gnuplot 4.2.4 may be downloaded for OS X, Windows, OS2, DOS, and Linux. The enhancements provided by version 4.2 are described here.

On Windows, unzip gp424win32.zip into an appropriate directory, (e.g. C:\My Programs\Gnuplot, C:\Gnuplot, C:\Apps\gnuplot, etc.). Make a link from ...\gnuplot\bin\wgnuplot.exe to your desktop or some other convenient location.

On Unix, Linux and OS X systems start Gnuplot by simply opening a terminal and typing:

gnuplot

2. FUNCTIONS

after installing gawk, we have to run the awk script using command;

gawk -f <awk file name> <trace file name>

gawk -f file.awk file.tr

The ‘-f’ instructs the awk utility to get the awk program from the source file i.e from .awk file.

After entering command you will get values.

AWK SCRIPTS

1. For calculating Throughput, Click here

2. For calculating End to End Delay,Routing Load and Packet Density Fraction, Click here

3. For calculating Jitter, Click here

4. For calculating energy, Click here

5. For calculating network statistics, Click here

6. For printing congestion window, Click here

7. For calculating all network statistics, Click here

8. For calculating final node position and energy of node, Click here

Note :

1. This awk script is for new trace format files.

2. Copy this awk files to the directory where tcl script is saved.

3. Change initial values as per your need.

PERL Script

Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.

The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). Its major features are that it's easy to use, supports both procedural and object-oriented (OO) programming, has powerful built-in support for text processing, and has one of the world's most impressive collections of third-party modules.

Like awk script, perl script can also be used to perform post analysis of trace files. Perl script are simple any tiny than awk scripts.

To run a Perl program from the Unix command line:

    1. perl progname.pl

Alternatively, put this as the first line of your script:

    1. #!/usr/bin/env perl

...and run the script as /path/to/script.pl. Of course, it'll need to be executable first, so chmod 755 script.pl (under Unix).

(This start line assumes you have the env program. You can also put directly the path to your perl executable, like in #!/usr/bin/perl ).

after running your tcl file copy and paste the perl script to the same directory and then the perl script can be run from your terminal by typing the following command.

perl filename.p tracefilename.tr

1. Perl script for calculating packet sent, packet received, packet dropped, routing overhead, packet delivery ratio and average path length can be downloaded for here. Click here.

2. Perl script to calculate average end to end delay can be downloaded from here. Click here.

Note : Copy and paste this perl script to the directory where tcl script is saved.

PERFORMANCE EVALUATION OF TCP

  • Performance Evaluation of TCP and CBR connections sharing a bottleneck link. Click here to download the program.

  • Performance Evaluation of TCP and CBR connections with random drops. Click here to download the program.

  • TCP connections with delays and initial transmission times created at random. Click here to download the program.

  • Short TCP files with several source nodes, sharing a single bottleneck link. Click here to download the program.

  • A sophisticated tcl programming with extra monitoring features. Click here to download the program.

UNICAST AND MULTICAST ROUTING

  • Unicast routing. Click here to download the program.

  • Multicast routing,CTR. Click here to download the program.

  • Multicast routing,DVMRP. Click here to download the program.

  • Multicast routing,PIMDM. Click here to download the program.

  • Multicast routing,bi-directional shared tree. Click here to download the program.

QUEUING

  • TCP connections with a RED bottleneck buffer. Click here to download the program.

  • TCP connections with a DROP TAIL buffer. Click here to download the program.

  • Short TCP files with several source nodes, sharing a single bottleneck link with a RED buffer. Click here to download the program.

  • Script for RED QUEUE MONITORING. Click here to download the program.

DIFFSERV

  • Short TCP files with several source nodes, sharing a single bottleneck link.It allows to how with proper choice of CIR, marking decreases losses of vulnerable packets (syns etc). Click here to download the program.

LOCAL AREA NETWORKS

  • IEEE 802 wireless. Click here to download the program.

  • CSMA protocol. Click here to download the program.

CLASSICAL QUEUING MODELS

  • An M/M/1 queue. Click here to download the program.

  • An M/M/1 queue with finite capacity. Click here to download the program.

MOBILE NETWORKS-MANET

  • TCP/FTP over a 3 nodes Ad-hoc network with DSDV routing protocol. Click here to download the program.

  • TCP/FTP over a 3 nodes Ad-hoc network with DSR routing protocol. Click here to download the program.

  • TCP/FTP over a 3 nodes Ad-hoc network with AODV routing protocol. Click here to download the program.

  • TCP/FTP over a 3 nodes Ad-hoc network with TORA routing protocol. Click here to download the program.

  • TCP/FTP over a 4 nodes Ad-hoc network with TORA routing protocol. Click here to download the program.

  • TCP/FTP over a 30 node Ad-hoc network with AODV routing protocol. Click here to download the program.

  • UDP/CBR over 5 node,10 node,50 node Ad-hoc network with AOMDV routing protocol. Click links to download the program. 1. 5 node 2. 10 node 3. 50 node

  • UDP/CBR over 30 nodes with attacker node with AODV routing protocol. Click here to download the program.

WEB SERVER SIMULATION

  • Script for Web Server Simulation. Click here to download programs.

In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC may be plotted. The precedence of operators is determined by the specifications of the C programming language.

The supported functions include:

__________________________________________________________ Function Returns ----------- ------------------------------------------ abs(x) absolute value of x, |x| acos(x) arc-cosine of x asin(x) arc-sine of x atan(x) arc-tangent of x cos(x) cosine of x, x is in radians. cosh(x) hyperbolic cosine of x, x is in radians erf(x) error function of x exp(x) exponential function of x, base e inverf(x) inverse error function of x invnorm(x) inverse normal distribution of x log(x) log of x, base e log10(x) log of x, base 10 norm(x) normal Gaussian distribution function rand(x) pseudo-random number generator sgn(x) 1 if x > 0, -1 if x < 0, 0 if x=0 sin(x) sine of x, x is in radians sinh(x) hyperbolic sine of x, x is in radians sqrt(x) the square root of x tan(x) tangent of x, x is in radians tanh(x) hyperbolic tangent of x, x is in radians ___________________________________________________________ Bessel, gamma, ibeta, igamma, and lgamma functions are also supported. Many functions can take complex arguments. Binary and unary operators are also supported.

The supported operators in Gnuplot are the same as the corresponding operators in the C programming language, except that most operators accept integer, real, and complex arguments. The ** operator (exponentiation) is supported as in FORTRAN. Parentheses may be used to change the order of evaluation. The variable names x, y, and z are used as the default independent variables.

3. THE plot AND splot COMMANDS

plot and splot are the primary commands in Gnuplot. They plot functions and data in many many ways. plot is used to plot 2-d functions and data, while splot plots 3-d surfaces and data.

Syntax: plot {[ranges]} {[function] | {"[datafile]" {datafile-modifiers}}} {axes [axes] } { [title-spec] } {with [style] } {, {definitions,} [function] ...}

where either a [function] or the name of a data file enclosed in quotes is supplied. For more complete descriptions, type: help plot help plot with help plot using or help plot smooth .

3.1 Plotting Functions

To plot functions simply type: plot [function] at the gnuplot> prompt.

For example, try:

gnuplot> plot sin(x)/x gnuplot> splot sin(x*y/20) gnuplot> plot sin(x) title 'Sine Function', tan(x) title 'Tangent'

3.2 Plotting Data

Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers. Columns should be separated by white space (tabs or spaces) only, (no commas). Lines beginning with a # character are treated as comments and are ignored by Gnuplot. A blank line in the data file results in a break in the line connecting data points.

For example your data file, force.dat , might look like:

# This file is called force.dat # Force-Deflection data for a beam and a bar # Deflection Col-Force Beam-Force 0.000 0 0 0.001 104 51 0.002 202 101 0.003 298 148 0.0031 290 149 0.004 289 201 0.0041 291 209 0.005 310 250 0.010 311 260 0.020 280 240

          • Simulated Network topology.

WIRED CUM WIRELESS NETWORKS

  • wired network nodes connected to wireless network nodes through base station Click here to download program

WPAN-WIRELESS PERSONAL AREA NETWORK

You can display your data by typing:

gnuplot> plot "force.dat" using 1:2 title 'Column', \ "force.dat" using 1:3 title 'Beam'

Do not type blank space after the line continuation character, "\" .

Your data may be in multiple data files. In this case you may make your plot by using a command like:

gnuplot> plot "fileA.dat" using 1:2 title 'data A', \ "fileB.dat" using 1:3 title 'data B'

    • WPAN TCL Script.Click here to download program

WORM HOLE ATTACK

Example network of 2 worm holes and 14 nodes. Click here to download program

For information on plotting 3-D data, type:

gnuplot> help splot datafile

4. CUSTOMIZING YOUR PLOT

Many items may be customized on the plot, such as the ranges of the axes, the labels of the x and y axes, the style of data point, the style of the lines connecting the data points, and the title of the entire plot.

4.1 plot command customization

Customization of the data columns, line titles, and line/point style are specified when the plot command is issued. Customization of the data columns and line titles were discussed in section 3.

Plots may be displayed in one of eight styles: lines, points, linespoints, impulses, dots, steps, fsteps, histeps, errorbars, xerrorbars, yerrorbars, xyerrorbars, boxes, boxerrorbars, boxxyerrorbars, financebars, candlesticks or vector To specify the line/point style use the plot command as follows:

gnuplot> plot "force.dat" using 1:2 title 'Column' with lines, \ "force.dat" u 1:3 t 'Beam' w linespoints

Note that the words: using , title , and with can be abbreviated as: u , t , and w . Also, each line and point style has an associated number.

4.2 set command customization

Customization of the axis ranges, axis labels, and plot title, as well as many other features, are specified using the set command. Specific examples of the set command follow. (The numerical values used in these examples are arbitrary.) To view your changes type: replot at the gnuplot> prompt at any time.

Create a title: > set title "Force-Deflection Data" Put a label on the x-axis: > set xlabel "Deflection (meters)" Put a label on the y-axis: > set ylabel "Force (kN)" Change the x-axis range: > set xrange [0.001:0.005] Change the y-axis range: > set yrange [20:500] Have Gnuplot determine ranges: > set autoscale Move the key: > set key 0.01,100 Delete the key: > unset key Put a label on the plot: > set label "yield point" at 0.003, 260 Remove all labels: > unset label Plot using log-axes: > set logscale Plot using log-axes on y-axis: > unset logscale; set logscale y Change the tic-marks: > set xtics (0.002,0.004,0.006,0.008) Return to the default tics: > unset xtics; set xtics auto

Other features which may be customized using the set command are: arrow, border, clip, contour, grid, mapping, polar, surface, time, view, and many more. The best way to learn is by reading the on-line help information, trying the command, and reading the Gnuplot manual.

5. PLOTTING DATA FILES WITH OTHER COMMENT CHARACTERS

If your data file has a comment character other than # you can tell Gnuplot about it. For example, if your data file has "%" comment characters (for Matlab compatability), typing

gnuplot> set datafile commentschars "#%"

indicates that either a "#" or a "%" character starts a comment.

6. GNUPLOT SCRIPTS

Sometimes, several commands are typed to create a particular plot, and it is easy to make a typographical error when entering a command. To stream- line your plotting operations, several Gnuplot commands may be combined into a single script file. For example, the following file will create a customized display of the force-deflection data:

# Gnuplot script file for plotting data in file "force.dat" # This file is called force.p set autoscale # scale axes automatically unset log # remove any log-scaling unset label # remove any previous labels set xtic auto # set xtics automatically set ytic auto # set ytics automatically set title "Force Deflection Data for a Beam and a Column" set xlabel "Deflection (meters)" set ylabel "Force (kN)" set key 0.01,100 set label "Yield Point" at 0.003,260 set arrow from 0.0028,250 to 0.003,280 set xr [0.0:0.022] set yr [0:325] plot "force.dat" using 1:2 title 'Column' with linespoints , \ "force.dat" using 1:3 title 'Beam' with points

Then the total plot can be generated with the command: gnuplot> load 'force.p'

7. CURVE-FITTING WITH GNUPLOT

To fit the data in force.dat with a function use the commands:

f1(x) = a1*tanh(x/b1) # define the function to be fit a1 = 300; b1 = 0.005; # initial guess for a1 and b1 fit f1(x) 'force.dat' using 1:2 via a1, b1 Final set of parameters Asymptotic Standard Error ======================= ========================== a1 = 308.687 +/- 10.62 (3.442%) b1 = 0.00226668 +/- 0.0002619 (11.55%)

and the commands:

f2(x) = a2 * tanh(x/b2) # define the function to be fit a2 = 300; b2 = 0.005; # initial guess for a and b fit f2(x) 'force.dat' using 1:3 via a2, b2 Final set of parameters Asymptotic Standard Error ======================= ========================== a2 = 259.891 +/- 12.82 (4.933%) b2 = 0.00415497 +/- 0.0004297 (10.34%)

The curve-fit and data may now be plotted with the commands:

set key 0.018,150 title "F(x) = A tanh (x/B)" # title to key! set title "Force Deflection Data \n and curve fit" # note newline! set pointsize 1.5 # larger point! set xlabel 'Deflection, {/Symbol D}_x (m)' # Greek symbols! set ylabel 'Force, {/Times-Italic F}_A, (kN)' # italics! plot "force.dat" using 1:2 title 'Column data' with points 3, \ "force.dat" using 1:3 title 'Beam data' with points 4, \ a1 * tanh( x / b1 ) title 'Column-fit: A=309, B=0.00227', \ a2 * tanh( x / b2 ) title 'Beam-fit: A=260, B=0.00415'

8. SPREAD-SHEET LIKE CALCULATIONS ON DATA

Gnuplot can mathematically modify your data column by column:

to plot sin( col.3 + col.1 ) vs. 3 * col.2 type:

plot 'force.dat' using (3*$2):(sin($3+$1))

9. MULTI-PLOT

Gnuplot can plot more than one figure in a frame ( like subplot in matlab ) i.e., try:

set multiplot; # get into multiplot mode set size 1,0.5; set origin 0.0,0.5; plot sin(x); set origin 0.0,0.0; plot cos(x) unset multiplot # exit multiplot mode

10. GNUPLOT DEMO FILES AND THE GNUPLOT FAQ

Most of Gnuplot's current features are illustrated in one or more of the Gnuplot demonstration files. To run the demo's yourself, download and unzip demo.zip, start Gnuplot from the resulting demo directory, and type

load "all.dem"

The Gnuplot feature you are looking for will probably be illustrated in one of the demo files. Gnuplot 4.2 also has an extensive FAQ.

11. HARD-COPY (PLOTTING ON PAPER)

You can create a PostScript file of your plot by using the following files and commands. First, download and save the following general-purpose Gnuplot script: save.plt

# File name: save.plt - saves a Gnuplot plot as a PostScript file # to save the current plot as a postscript file issue the commands: # gnuplot> load 'saveplot' # gnuplot> !mv my-plot.ps another-file.ps set size 1.0, 0.6 set terminal postscript portrait enhanced mono dashed lw 1 "Helvetica" 14 set output "my-plot.ps" replot set terminal x11 set size 1,1

Then simply type the following commands to create and print the plot

gnuplot> load 'save.plt' gnuplot> !mv my-plot.ps force.ps gnuplot> !lpr force.ps

The PostScript files produced by Gnuplot may be read and edited with a text editor.

12. ADVANCED COMPUTATION AND VISUALIZATION

Gnuplot is used for plotting in a free and open Matlab-like programming environment called Octave.

13. PRINTING TWO FIGURES ON ONE PAGE

If you would like two figures to be laser-printed on the same page, you may use the following shell script. Create file cat2 , below, and make the file executable by typing: unix% chmod +x cat2

# cat2: Shell script for putting two Gnuplot plots on one page echo %! > g.ps echo gsave >> g.ps echo 0 400 translate >> g.ps # for Gnuplot plots cat $1 | sed -e "s/showpage//" >> g.ps echo grestore >> g.ps echo gsave >> g.ps echo 0 090 translate >> g.ps # for Gnuplot plots cat $2 >> g.ps lpr -Phudsonlp1 g.ps

To combine two PostScript figures (plot1.ps and plot2.ps) on one page:

cat2 plot1.ps plot2.ps

14. USING GNU PLOT WITH NS 2

Use gnuplot to visualize the trace file. For this example,

I use the trace file which is generated from this code click here to down load tcl script.

The first step is using awk to get throughput of cbr and tcp packets from node 2 to node 3. click here to down load the awk script; myflowcalcall.awk.

Run at the terminal :

$ awk -f myflowcalcall.awk -v graphgran=0 -v fidfrom=2 -v fidto=3 -v fid=1 -v flowtype=”tcp” -v outdata_file=”nothing” out_example4.tr > thr1

$ awk -f myflowcalcall.awk -v graphgran=0 -v fidfrom=2 -v fidto=3 -v fid=2 -v flowtype=”cbr” -v outdata_file=”nothing” out_example4.tr > thr2

Result : thr1

0.5 0

1 0.00032

1.5 0.20544

2 0.29968

2.5 0.349568

3 0.413333

3.5 0.430354

4 0.47224

4.5 0.43456

the above data comes from :

r 1.034894 2 3 tcp 40 ——- 1 0.0 3.0 0 113

r 1.104296 2 3 tcp 1040 ——- 1 0.0 3.0 1 123

r 1.502847 2 3 tcp 1040 ——- 1 0.0 3.0 44 238

r 2.006188 2 3 tcp 1040 ——- 1 0.0 3.0 61 375

r 2.500588 2 3 tcp 1040 ——- 1 0.0 3.0 91 511

r 3.008447 2 3 tcp 1040 ——- 1 0.0 3.0 135 658

r 3.5068 2 3 tcp 1040 ——- 1 0.0 3.0 167 793

r 4.005153 2 3 tcp 1040 ——- 1 0.0 3.0 213 939

Result : thr2

0.5 0.736

1 0.864

1.5 0.858667

2 0.892

2.5 0.9216

3 0.928

3.5 0.944

4 0.942

4.5 0.956444

5 0.8672

the above data comes from :

r 0.506706 2 3 cbr 1000 ——- 2 1.0 3.1 46 46

r 1.002706 2 3 cbr 1000 ——- 2 1.0 3.1 108 108

r 1.507553 2 3 cbr 1000 ——- 2 1.0 3.1 166 239

r 2.001294 2 3 cbr 1000 ——- 2 1.0 3.1 228 373

r 2.505294 2 3 cbr 1000 ——- 2 1.0 3.1 294 512

r 3.003553 2 3 cbr 1000 ——- 2 1.0 3.1 354 657

r 3.501906 2 3 cbr 1000 ——- 2 1.0 3.1 420 792

r 4.000259 2 3 cbr 1000 ——- 2 1.0 3.1 478 937

r 4.506706 2 3 cbr 1000 ——- 2 1.0 3.1 546 1028

Visualize thr1 and thr2 with gnuplot :

$ gnuplot

gnuplot> set title “One CBR Competes with One FTP”

gnuplot> set xlabel “Time in second”

gnuplot> set ylabel “Throughput in Mbps”

gnuplot> set key 3,1.8

gnuplot> set label “Yield Point” at 0.003,260

gnuplot> set arrow from 0.002,250 to 0.003,280

gnuplot> set xr[0:5]

gnuplot> set yr[0:2]

gnuplot> plot “thr1″ using 1:2 title ‘CBR Flow’ with lines,\

> “thr2″ using 1:2 title ‘TCP Flow’ with lines

Final Result :

PROTOCOLS AND MODELS SUPPORT BY NS2 IN WIRELESS NETWORKS

A wireless network is any type of computer network that uses wireless data connections for connecting network nodes.

Wireless networking is a method by which homes, telecommunications networks and enterprise (business) installations avoid the costly process of introducing cables into a building, or as a connection between various equipment locations. Wireless telecommunications networks are generally implemented and administered using radio communication. This implementation takes place at the physical level (layer) of the OSI model network structure.

Examples of wireless networks include cell phone networks, Wi-Fi local networks and terrestrial microwave networks.

For more click here

Types of Adhoc Networks / Mobile IP:

1. WIRELESS ADHOC NETWORK

A wireless ad hoc network is a decentralized type of wireless network.The network is ad hoc because it does not rely on a pre existing infrastructure, such as routers in wired networks or access points in managed (infrastructure) wireless networks. Instead, each node participates in routing by forwarding data for other nodes, so the determination of which nodes forward data is made dynamically on the basis of network connectivity. In addition to the classic routing, ad hoc networks can use flooding for forwarding data.

An ad hoc network typically refers to any set of networks where all devices have equal status on a network and are free to associate with any other ad hoc network device in link range. Ad hoc network often refers to a mode of operation of IEEE 802.11 wireless networks.

It also refers to a network device's ability to maintain link status information for any number of devices in a 1-link (aka "hop") range, and thus, this is most often a Layer 2 activity. Because this is only a Layer 2 activity, ad hoc networks alone may not support a routeable IP network environment without additional Layer 2 or Layer 3 capabilities.

The earliest wireless ad hoc networks were the "packet radio" (PRNETs) from the 1970s, sponsored by DARPA after the ALOHAnet project.

For more click here link 2

2. MOBILE ADHOC NETWORKS

A mobile ad hoc network (MANET) is a self-configuring infrastructure less network of mobile devices connected by wireless. Ad hoc is Latin and means "for this purpose".

Each device in a MANET is free to move independently in any direction, and will therefore change its links to other devices frequently. Each must forward traffic unrelated to its own use, and therefore be a router. The primary challenge in building a MANET is equipping each device to continuously maintain the information required to properly route traffic. Such networks may operate by themselves or may be connected to the larger Internet.

MANETs are a kind of Wireless ad hoc network that usually has a routable networking environment on top of a Link Layer ad hoc network.

The growth of laptops and 802.11/Wi-Fi wireless networking have made MANETs a popular research topic since the mid-1990s. Many academic papers evaluate protocols and their abilities, assuming varying degrees of mobility within a bounded space, usually with all nodes within a few hops of each other. Different protocols are then evaluated based on measures such as the packet drop rate, the overhead introduced by the routing protocol, end-to-end packet delays, network throughput etc.

For more click 1 click 2

3. VEHICULAR ADHOC NETWORKS

A vehicular ad hoc network (VANET) uses cars as mobile nodes in a MANET to create a mobile network. A VANET turns every participating car into a wireless router or node, allowing cars approximately 100 to 300 metres of each other to connect and, in turn, create a network with a wide range. As cars fall out of the signal range and drop out of the network, other cars can join in, connecting vehicles to one another so that a mobile Internet is created. It is estimated that the first systems that will integrate this technology are police and fire vehicles to communicate with each other for safety purposes. Automotive companies like General Motors, Toyota, Nissan, Daimler Chrysler, BMW and Ford promote this term.

Most of the concerns of interest to mobile ad hoc networks (MANETs) are of interest in VANETs, but the details differ. Rather than moving at random, vehicles tend to move in an organized fashion. The interactions with roadside equipment can likewise be characterized fairly accurately. And finally, most vehicles are restricted in their range of motion, for example by being constrained to follow a paved highway.

In addition, in 2006 the term MANET mostly described an academic area of research, and the term VANET an application. GPS and navigation systems might benefit, as they could be integrated with traffic reports to provide the fastest route to work. It was also promoted for free, VoIP services such as Google Talk or Skype between employees, lowering telecommunications costs.

For more click 1 click 2

PROTOCOLS AND MODELS SUPPORTED BY NS2 IN WIRED NETWORKS

NS2 MAINLY SUPPORT THREE MODES ON NETWORKING

1. WIRED NETWORKS

2. ADHOC/MOBILE IP

3. WIRELESS SENSOR NETWORKS

WIRED NETWORKS

A wired network connects devices to the Internet or other network using cables. The most common wired networks use cables connected to Ethernet ports on the network router on one end and to a computer or other device on the cable's opposite end.

Ethernet and wireless networks each have advantages and disadvantages; depending on your needs, one may serve you better than the other. Wired networks provide users with plenty of security and the ability to move lots of data very quickly. Wired networks are typically faster than wireless networks, and they can be very affordable. However, the cost of Ethernet cable can add up - the more computers on your network and the farther apart they are, the more expensive your network will be. In addition, unless you're building a new house and installing Ethernet cable in the walls, you'll be able to see the cables running from place to place around your home, and wires can greatly limit your mobility.

For more click here : WIRED VS WIRELESS

The following list shows the models and protocols supported by ns2 in wired configuration;

  • ROUTING IN WIRED NETWORKS

1. UNICAST ROUTING

In computer networking, Unicast transmission is the sending of messages to a single network destination identified by a unique address.Unicast routing is the process of forwarding unicasted traffic from a source to a destination on an internetwork. Unicasted traffic is destined for a unique address.

If an IP Unicast packet passes through a switch that does not know the location of the associated MAC Address, the packet will be broadcast to all ports on the switch. This failure of Unicast to 'cast to a single device' is called a Unicast flood.

Unicast messaging is used for all network processes in which a private or unique resource is requested.

Certain network applications which are mass-distributed are too costly to be conducted with unicast transmission since each network connection consumes computing resources on the sending host and requires its own separate network bandwidth for transmission. Such applications include streaming media of many forms. Internet radio stations using unicast connections may have high bandwidth costs.

    • ROUTING PROTOCOLS

UNICAST ROUTING

For more click here: >> URP SECTION 1

>> URP SECTION 2

2. MULTICAST ROUTING

In computer networking, multicast is the delivery of a message or information to a group of destination computers simultaneously in a single transmission from the source. Copies are automatically created in other network elements, such as routers, but only when the topology of the network requires it.

Multicast is most commonly implemented in IP multicast, which is often employed in Internet Protocol (IP) applications of streaming media and Internet television. In IP multicast the implementation of the multicast concept occurs at the IP routing level, where routers create optimal distribution paths for datagrams sent to a multicast destination address.

At the Data Link Layer, multicast describes one-to-many distribution such as Ethernet multicast addressing, Asynchronous Transfer Mode (ATM) point-to-multipoint virtual circuits (P2MP) or Infiniband multicast.

Wireless networks is an emerging new technology that will allow users to access information and services electronically, regardless of their geographic position. Wireless networks can be classified in two types:-

- infra structured network and

- infrastructure less (ad hoc) networks.

Infra structured network consists of a network with fixed and wired gateways. A mobile host communicates with a bridge in the network (called base station) within its communication radius. The mobile unit can move geographically while it is communicating. When it goes out of range of one base station, it connects with new base station and starts communicating through it. This is called hand off. In this approach the base stations are fixed.

In contrast to infrastructure based networks, in ad hoc networks all nodes are mobile and can be connected dynamically in an arbitrary manner. All nodes of these networks behave as routers and take part in discovery and maintenance of routes to other nodes in the network. Ad hoc networks are very useful in emergency search-and-rescue operations, meetings or conventions in which persons wish to quickly share information, and data acquisition operations in inhospitable terrain [Royer99].

Now we discusses proposed routing protocols for these ad hoc networks. These routing protocols can be divided into two categories:

- table-driven and

- on-demand routing

based on when and how the routes are discovered. In table driven routing protocols consistent and up-to-date routing information to all nodes is maintained at each node whereas in on-demand routing the routes are created only when desired by the source host.

TABLE DRIVEN ROUTING PROTOCOLS

In Table-driven routing protocols each node maintains one or more tables containing routing information to every other node in the network. All nodes update these tables so as to maintain a consistent and up-to-date view of the network. When the network topology changes the nodes propagate update messages throughout the network in order to maintain a consistent and up-to-date routing information about the whole network. These routing protocols differ in the method by which the topology change information is distributed across the network and the number of necessary routing-related tables. Now we are going to discuss some existing table-driven ad hoc routing protocols.

Dynamic Destination-Sequenced Distance-Vector Routing Protocol [DSDV]

The Destination-Sequenced Distance-Vector (DSDV) Routing Algorithm is based on the idea of the classical Bellman-Ford Routing Algorithm with certain improvements.

Every mobile station maintains a routing table that lists all available destinations, the number of hops to reach the destination and the sequence number assigned by the destination node. The sequence number is used to distinguish stale routes from new ones and thus avoid the formation of loops. The stations periodically transmit their routing tables to their immediate neighbors. A station also transmits its routing table if a significant change has occurred in its table from the last update sent. So, the update is both time-driven and event-driven. The routing table updates can be sent in two ways:- a "full dump" or an incremental update. A full dump sends the full routing table to the neighbors and could span many packets whereas in an incremental update only those entries from the routing table are sent that has a metric change since the last update and it must fit in a packet. If there is space in the incremental update packet then those entries may be included whose sequence number has changed. When the network is relatively stable, incremental updates are sent to avoid extra traffic and full dump are relatively infrequent. In a fast-changing network, incremental packets can grow big so full dumps will be more frequent. Each route update packet, in addition to the routing table information, also contains a unique sequence number assigned by the transmitter. The route labeled with the highest (i.e. most recent) sequence number is used. If two routes have the same sequence number then the route with the best metric (i.e. shortest route) is used. Based on the past history, the stations estimate the settling time of routes. The stations delay the transmission of a routing update by settling time so as to eliminate those updates that would occur if a better route were found very soon.

MULTICAST ROUTING

- IP MULTICAST

IP multicast is a technique for one-to-many and many-to-many real-time communication over an IP infrastructure in a network. It scales to a larger receiver population by requiring neither prior knowledge of a receiver's identity nor prior knowledge of the number of receivers. Multicast uses network infrastructure efficiently by requiring the source to send a packet only once, even if it needs to be delivered to a large number of receivers. The nodes in the network (typically network switches and routers) take care of replicating the packet to reach multiple receivers such that messages are sent over each link of the network only once. The most common low-level protocol to use multicast addressing is User Datagram Protocol (UDP). By its nature, UDP is not reliable—messages may be lost or delivered out of order. Reliable multicast protocols such as Pragmatic General Multicast (PGM) have been developed to add loss detection and retransmission on top of IP multicast.

Key concepts in IP multicast include an IP multicast group address, a multicast distribution tree and receiver driven tree creation.

An IP multicast group address is used by sources and the receivers to send and receive multicast messages. Sources use the group address as the IP destination address in their data packets. Receivers use this group address to inform the network that they are interested in receiving packets sent to that group. For example, if some content is associated with group 239.1.1.1, the source will send data packets destined to 239.1.1.1. Receivers for that content will inform the network that they are interested in receiving data packets sent to the group 239.1.1.1. The receiver joins 239.1.1.1. The protocol typically used by receivers to join a group is called the Internet Group Management Protocol (IGMP).

With routing protocols based on shared trees, once the receivers join a particular IP multicast group, a multicast distribution tree is constructed for that group. The protocol most widely used for this is Protocol Independent Multicast (PIM). It sets up multicast distribution trees such that data packets from senders to a multicast group reach all receivers which have joined the group. For example, all data packets sent to the group 239.1.1.1 are received by receivers who joined 239.1.1.1. There are variations of PIM implementations: Sparse Mode (SM), Dense Mode (DM), Source Specific Mode (SSM) and Bidirectional Mode (Bidir, or Sparse-Dense Mode, SDM). Of these, PIM-SM is the most widely deployed as of 2006;[citation needed] SSM and Bidir are simpler and scalable variations developed more recently and are gaining in popularity.

IP multicast operation does not require an active source to know about the receivers of the group. The multicast tree construction is receiver driven and is initiated by network nodes which are close to the receivers. IP multicast scales to a large receiver population. The IP multicast model has been described by Internet architect Dave Clark as, "You put packets in at one end, and the network conspires to deliver them to anyone who asks."

IP multicast creates state information per multicast distribution tree in the network. If a router is part of 1000 multicast trees, it has 1000 multicast routing and forwarding entries. On the other hand, a multicast router does not need to know how to reach all other multicast trees in the Internet. It only needs to know about multicast trees for which it has downstream receivers. This is key to scaling multicast-addressed services. It is very unlikely that core Internet routers would need to keep state for all multicast distribution trees,[citation needed] they only need to keep state for trees with downstream membership. In contrast, a unicast router needs to know how to reach all other unicast addresses in the Internet, even if it does this using just a default route. For this reason, aggregation is key to scaling unicast routing. Also, there are core routers that carry routes in the hundreds of thousands because they contain the Internet routing table.

- ROUTING

Each host (and in fact each application on the host) that wants to be a receiving member of a multicast group (i.e. receive data corresponding to a particular multicast address) must use the Internet Group Management Protocol (IGMP) to join. Adjacent routers also use this protocol to communicate.

In unicast routing, each router examines the destination address of an incoming packet and looks up the destination in a table to determine which interface to use in order for that packet to get closer to its destination. The source address is irrelevant to the router. However, in multicast routing, the source address (which is a simple unicast address) is used to determine data stream direction. The source of the multicast traffic is considered upstream. The router determines which downstream interfaces are destinations for this multicast group (the destination address), and sends the packet out through the appropriate interfaces. The term reverse path forwarding is used to describe this concept of routing packets away from the source, rather than towards the destination.

A number of errors can happen if packets intended for unicast are accidentally sent to a multicast address; in particular, sending ICMP packets to a multicast address has been used in the context of DoS attacks as a way of achieving packet amplification.

On the local network, multicast delivery is controlled by IGMP (on IPv4 network) and MLD (on IPv6 network); inside a routing domain, PIM or MOSPF are used; between routing domains, one uses inter-domain multicast routing protocols, such as MBGP.

The following are some common delivery and routing protocols used for multicast distribution:

    1. Internet Group Management Protocol (IGMP)

    2. Protocol Independent Multicast (PIM)

    3. Distance Vector Multicast Routing Protocol (DVMRP)

    4. Multicast Open Shortest Path First (MOSPF)

    5. Multicast BGP (MBGP)

    6. Multicast Source Discovery Protocol (MSDP)

    7. Multicast Listener Discovery (MLD)

    8. GARP Multicast Registration Protocol (GMRP)

For more click here: >> MULTICAST ROUTING

>> INTRODUCTION TO IP MULTICAST

>> MULTICAST ROUTING PROTOCOLS

3. HIERARCHICAL ROUTING

Hierarchical routing is a method of routing in networks that is based on hierarchical addressing. Hierarchical routing is the procedure of arranging routers in a hierarchical manner. A good example would be to consider a corporate intranet. Most corporate intranets consist of a high speed backbone network. Connected to this backbone are routers which are in turn connected to a particular work group. These work groups occupy a unique LAN. The reason this is a good arrangement is because even though there might be dozens of different work groups, the span (maximum hop count to get from one host to any other host on the network) is 2. Even if the work groups divided their LAN network into smaller partitions, the span could only increase to 4 in this particular example.

Considering alternative solutions with every router connected to every other router, or if every router was connected to 2 routers, shows the convenience of hierarchical routing. It decreases the complexity of network topology, increases routing efficiency, and causes much less congestion because of fewer routing advertisements. With hierarchical routing, only core routers connected to the backbone are aware of all routes. Routers that lie within a LAN only know about routes in the LAN. Unrecognized destinations are passed to the default route.

Most Transmission Control Protocol/Internet Protocol (TCP/IP) routing is based on a two-level hierarchical routing in which an IP address is divided into a network portion and a host portion. Gateways use only the network portion until an IP datagram reaches a gateway that can deliver it directly. Additional levels of hierarchical routing are introduced by the addition of subnetworks.

In hierarchical routing, routers are classified in groups known as regions. Each router has only the information about the routers in its own region and has no information about routers in other regions. So routers just save one record in their table for every other region. In this example, we have classified our network into five regions (see below).

DSDV ROUTING PROTOCOL

For more click here

Wireless Routing Protocol (WRP)

The Wireless Routing Protocol (WRP) is a table-based distance-vector routing protocol. Each node in the network maintains a Distance table, a Routing table, a Link-Cost table and a Message Re transmission list.

The Distance table of a node x contains the distance of each destination node y via each neighbor z of x. It also contains the downstream neighbor of z through which this path is realized. The Routing table of node x contains the distance of each destination node y from node x, the predecessor and the successor of node x on this path. It also contains a tag to identify if the entry is a simple path, a loop or invalid. Storing predecessor and successor in the table is beneficial in detecting loops and avoiding counting-to-infinity problems. The Link-Cost table contains cost of link to each neighbor of the node and the number of timeouts since an error-free message was received from that neighbor. The Message Re transmission list (MRL) contains information to let a node know which of its neighbor has not acknowledged its update message and to re transmit update message to that neighbor.

Node exchange routing tables with their neighbors using update messages periodically as well as on link changes. The nodes present on the response list of update message (formed using MRL) are required to acknowledge the receipt of update message. If there is no change in routing table since last update, the node is required to send an idle Hello message to ensure connectivity. On receiving an update message, the node modifies its distance table and looks for better paths using new information. Any new path so found is relayed back to the original nodes so that they can update their tables. The node also updates its routing table if the new path is better than the existing path. On receiving an ACK, the mode updates its MRL. A unique feature of this algorithm is that it checks the consistency of all its neighbors every time it detects a change in link of any of its neighbors. Consistency check in this manner helps eliminate looping situations in a better way and also has fast convergence.

Global State Routing [GSR]

Global State Routing (GSR) is similar to DSDV. It takes the idea of link state routing but improves it by avoiding flooding of routing messages.

In this algorithm, each node maintains a Neighbor list, a Topology table, a Next Hop table and a Distance table. Neighbor list of a node contains the list of its neighbors (here all nodes that can be heard by a node are assumed to be its neighbors.). For each destination node, the Topology table contains the link state information as reported by the destination and the timestamp of the information. For each destination, the Next Hop table contains the next hop to which the packets for this destination must be forwarded. The Distance table contains the shortest distance to each destination node.

The routing messages are generated on a link change as in link state protocols. On receiving a routing message, the node updates its Topology table if the sequence number of the message is newer than the sequence number stored in the table. After this the node reconstructs its routing table and broadcasts the information to its neighbors.

Fisheye State Routing [FSR]

Fisheye State Routing (FSR) is an improvement of GSR. The large size of update messages in GSR wastes a considerable amount of network bandwidth. In FSR, each update message does not contain information about all nodes. Instead, it exchanges information about closer nodes more frequently than it does about farther nodes thus reducing the update message size. So each node gets accurate information about neighbors and the detail and accuracy of information decreases as the distance from node increases. Figure defines the scope of fisheye for the center (red) node. The scope is defined in terms of the nodes that can be reached in a certain number of hops. The center node has most accurate information about all nodes in the white circle and so on. Even though a node does not have accurate information about distant nodes, the packets are routed correctly because the route information becomes more and more accurate as the packet moves closer to the destination. FSR scales well to large networks as the overhead is controlled in this scheme.

Accuracy of information in FSR

For more click here

Hierarchical State Routing [HSR]

The characteristic feature of Hierarchical State Routing (HSR) [Iwata99]is multilevel clustering and logical partitioning of mobile nodes. The network is partitioned into clusters and a cluster-head elected as in a cluster-based algorithm. In HSR, the cluster-heads again organize themselves into clusters and so on. The nodes of a physical cluster broadcast their link information to each other. The cluster-head summarizes its cluster's information and sends it to neighboring cluster-heads via gateway. As shown in the figure below, these cluster-heads are member of the cluster on a level higher and they exchange their link information as well as the summarized lower-level information among each other and so on. A node at each level floods to its lower level the information that it obtains after the algorithm has run at that level. So the lower level has a hierarchical topology information. Each node has a hierarchical address. One way to assign hierarchical address is the cluster numbers on the way from root to the node as shown in figure. A gateway can be reached from the root via more than one path, so gateway can have more than one hierarchical address. A hierarchical address is enough to ensure delivery from anywhere in the network to the host.

If A wants to send packets to any router in region 2 (D, E, F or G), it sends them to B, and so on. As you can see, in this type of routing, the tables can be summarized, so network efficiency improves. The above example shows two-level hierarchical routing. We can also use three- or four-level hierarchical routing.

In three-level hierarchical routing, the network is classified into a number of clusters. Each cluster is made up of a number of regions, and each region contains a number or routers. Hierarchical routing is widely used in Internet routing and makes use of several routing protocols.

In here, DV algorithms are used to find best routes between nodes. In the situation depicted below, every node of the network has to save a routing table with 17 records. Here is a typical graph and routing table for A:

Clustering in HSR

In addition, nodes are also partitioned into logical subnetworks and each node is assigned a logical address <subnet, host>. Each subnetwork has a location management server (LMS). All the nodes of that subnet register their logical address with the LMS. The LMS advertise their hierarchical address to the top levels and the information is sent down to all LMS too. The transport layer sends a packet to the network layer with the logical address of the destination. The network layer finds the hierarchical address of the hierarchical address of the destinationÆs LMS from its LMS and then sends the packet to it. The destinationÆs LMS forwards the packet to the destination. Once the source and destination know each otherÆs hierarchical addresses, they can bypass the LMS and communicate directly. Since logical address/hierarchical address is used for routing, it is adaptable to network changes.

Zone-based Hierarchical Link State Routing Protocol [ZHLS]

In Zone-based Hierarchical Link State Routing Protocol (ZHLS), the network is divided into non-overlapping zones. Unlike other hierarchical protocols, there is no zone-head. ZHLS defines two levels of topologies - node level and zone level. A node level topology tells how nodes of a zone are connected to each other physically. A virtual link between two zones exists if at least one node of a zone is physically connected to some node of the other zone. Zone level topology tells how zones are connected together. There are two types of Link State Packets (LSP) as well - node LSP and zone LSP. A node LSP of a node contains its neighbor node information and is propagated with the zone where as a zone LSP contains the zone information and is propagated globally. So each node has full node connectivity knowledge about the nodes in its zone and only zone connectivity information about other zones in the network. So given the zone id and the node id of a destination, the packet is routed based on the zone id till it reaches the correct zone. Then in that zone, it is routed based on node id. A <zone id, node id@gt; of the destination is sufficient for routing so it is adaptable to changing topologies.

Clusterhead Gateway Switch Routing Protocol [CGSR]

Clusterhead Gateway Switch Routing (CGSR) uses as basis the DSDV Routing algorithm described in the previous section.

The mobile nodes are aggregated into clusters and a cluster-head is elected. All nodes that are in the communication range of the cluster-head belong to its cluster. A gateway node is a node that is in the communication range of two or more cluster-heads. In a dynamic network cluster head scheme can cause performance degradation due to frequent cluster-head elections, so CGSR uses a Least Cluster Change (LCC) algorithm. In LCC, cluster-head change occurs only if a change in network causes two cluster-heads to come into one cluster or one of the nodes moves out of the range of all the cluster-heads.

The general algorithm works in the following manner. The source of the packet transmits the packet to its cluster-head. From this cluster-head, the packet is sent to the gateway node that connects this cluster-head and the next cluster-head along the route to the destination. The gateway sends it to that cluster-head and so on till the destination cluster-head is reached in this way. The destination cluster-head then transmits the packet to the destination. Figure shows an example of CGSR routing scheme.

Network Graph and Routing Table of A

For more click here: HIERARCHIAL ROUTING

  • TRANSPORTATION

1. TRANSMISSION CONTROL PROTOCOL (TCP)

The Transmission Control Protocol (TCP) is one of the core protocols of the Internet protocol suite (IP), and is so common that the entire suite is often called TCP/IP. TCP provides reliable, ordered and error-checked delivery of a stream of octets between programs running on computers connected to a local area network, intranet or the public Internet. It resides at the transport layer.

Web browsers use TCP when they connect to servers on the World Wide Web, and it is used to deliver email and transfer files from one location to another. HTTP, HTTPS, SMTP, POP3, IMAP, SSH, FTP, Telnet and a variety of other protocols are typically encapsulated in TCP.

While IP takes care of handling the actual delivery of the data, TCP takes care of keeping track of the individual units of data (called packets) that a message is divided into for efficient routing through the Internet.

For example, when an HTML file is sent to you from a Web server, the Transmission Control Protocol (TCP) program layer in that server divides the file into one or more packets, numbers the packets, and then forwards them individually to the IP program layer. Although each packet has the same destination IP address, it may get routed differently through the network. At the other end (the client program in your computer), TCP reassembles the individual packets and waits until they have arrived to forward them to you as a single file.

TCP is known as a connection-oriented protocol, which means that a connection is established and maintained until such time as the message or messages to be exchanged by the application programs at each end have been exchanged. TCP is responsible for ensuring that a message is divided into the packets that IP manages and for reassembling the packets back into the complete message at the other end. In the Open Systems Interconnection (OSI) communication model, TCP is in layer 4, the Transport Layer.

For more click here: TCP OVERVIEW

2. USER DATAGRAM PROTOCOL (UDP)

The User Datagram Protocol (UDP) is a transport layer protocol defined for use with the IP network layer protocol. It is defined by RFC 768 written by John Postel. It provides a best-effort datagram service to an End System (IP host).

The service provided by UDP is an unreliable service that provides no guarantees for delivery and no protection from duplication (e.g. if this arises due to software errors within an Intermediate System (IS)). The simplicity of UDP reduces the overhead from using the protocol and the services may be adequate in many cases.

UDP provides a minimal, unreliable, best-effort, message-passing transport to applications and upper-layer protocols. Compared to other transport protocols, UDP and its UDP-Lite variant are unique in that they do not establish end-to-end connections between communicating end systems. UDP communication consequently does not incur connection establishment and teardown overheads and there is minimal associated end system state. Because of these characteristics, UDP can offer a very efficient communication transport to some applications, but has no inherent congestion control or reliability. A second unique characteristic of UDP is that it provides no inherent On many platforms, applications can send UDP datagrams at the line rate of the link interface, which is often much greater than the available path capacity, and doing so would contribute to congestion along the path, applications therefore need to be designed responsibly [RFC 4505].

One increasingly popular use of UDP is as a tunneling protocol, where a tunnel endpoint encapsulates the packets of another protocol inside UDP datagrams and transmits them to another tunnel endpoint, which decapsulates the UDP datagrams and forwards the original packets contained in the payload. Tunnels establish virtual links that appear to directly connect locations that are distant in the physical Internet topology, and can be used to create virtual (private) networks. Using UDP as a tunneling protocol is attractive when the payload protocol is not supported by middleboxes that may exist along the path, because many middleboxes support UDP transmissions.

UDP does not provide any communications security. Applications that need to protect their communications against eavesdropping, tampering, or message forgery therefore need to separately provide security services using additional protocol mechanisms.

For more click here: >> PART 1

>> PART 2

  • TRAFFIC SOURCES

1. FILE TRANSFER PROTOCOL (FTP)

File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet. Like the Hypertext Transfer Protocol (HTTP), which transfers displayable Web pages and related files, and the Simple Mail Transfer Protocol (SMTP), which transfers e-mail, FTP is an application protocol that uses the Internet's TCP/IP protocols. FTP is commonly used to transfer Web page files from their creator to the computer that acts as their server for everyone on the Internet. It's also commonly used to download programs and other files to your computer from other servers.

As a user, you can use FTP with a simple command line interface (for example, from the Windows MS-DOS Prompt window) or with a commercial program that offers a graphical user interface. Your Web browser can also make FTP requests to download programs you select from a Web page. Using FTP, you can also update (delete, rename, move, and copy) files at a server. You need to logon to an FTP server. However, publicly available files are easily accessed using anonymous FTP.

Basic FTP support is usually provided as part of a suite of programs that come with TCP/IP. However, any FTP client program with a graphical user interface usually must be downloaded from the company that makes it.

For more click here: FTP

2. TELNET

Telnet is a user command and an underlying TCP/IP protocol for accessing remote computers. Through Telnet, an administrator or another user can access someone else's computer remotely. On the Web, HTTP and FTP protocols allow you to request specific files from remote computers, but not to actually be logged on as a user of that computer. With Telnet, you log on as a regular user with whatever privileges you may have been granted to the specific application and data on that computer.

A Telnet command request looks like this (the computer name is made-up):

telnet the.libraryat.whatis.edu

The result of this request would be an invitation to log on with a userid and a prompt for a password. If accepted, you would be logged on like any user who used this computer every day.

Telnet is most likely to be used by program developers and anyone who has a need to use specific applications or data located at a particular host computer.

For more click here: TELNET

3. CONSTANT BIT RATE (CBR)

Constant bitrate (CBR) is a term used in telecommunications, relating to the quality of service. Compare with variable bitrate. When referring to codecs, constant bit rate encoding means that the rate at which a codec's output data should be consumed is constant. CBR is useful for streaming multimedia content on limited capacity channels since it is the maximum bit rate that matters, not the average, so CBR would be used to take advantage of all of the capacity. CBR would not be the optimal choice for storage as it would not allocate enough data for complex sections (resulting in degraded quality) while wasting data on simple sections.

The problem of not allocating enough data for complex sections could be solved by choosing a high bitrate (e.g., 256 kbit/s or 320 kbit/s) to ensure that there will be enough bits for the entire encoding process, though the size of the file at the end would be proportionally larger.

Most coding schemes such as Huffman coding or run-length encoding produce variable-length codes, making perfect CBR difficult to achieve. This is partly solved by varying the quantization (quality), and fully solved by the use of padding. (However, CBR is implied in a simple scheme like reducing all 16-bit audio samples to 8 bits.)

In the case of streaming video as a CBR, the source could be under the CBR data rate target. So in order to complete the stream, it's necessary to add stuffing packets in the stream to reach the data rate wanted. These packets are totally neutral and don't affect the stream.

For more click here: CBR

  • QUEUING DISCIPLINES

1. DROP TAIL

It is a simple queue mechanism that is used by the routers that when packets should to be drop. In this mechanism each packet is treated identically and when queue filled to its maximum capacity the newly incoming packets are dropped until queue have sufficient space to accept incoming traffic.

When a queue is filled the router start to discard all extra packets thus dropping the tail of mechanism. The loss of packets (datagram’s) causes the sender to enter slow start which decreases the throughput and thus increases its congestion window.

2. FAIR QUEUING

It is a queuing mechanism that is used to allow multiple packets flow to comparatively share the link capacity. Routers have multiple queues for each output line for every user. When a line as available as idle routers scans the queues through round robin and takes first packet to next queue. FQ also ensure about the maximum throughput of the network. For more efficiency weighted queue mechanism is also used.

3. DEFICIT ROUND ROBIN

It is a modified weighted round robin scheduling mechanism. It can handle packets of different size without having knowledge of their mean size. Deficit Round Robin keeps track of credits for each flow. It derives ideas from Fair Queuing and Stochastic FQ. It uses hashing to determine the queue to which a flow has to be assigned and collisions automatically reduce the bandwidth guaranteed to the flow. Each queue is assigned a quantum and can send a packet of size that can fit in the available quantum. If not, the idle quantum gets added to this meticulous queue’s deficit and the packet can be sent in the next round. The quantum size is a very vital parameter in the DRR scheme, determining the upper bound on the latency as well as the throughput.

This queue mechanism used a well-designed idea to get better performance and can also be implemented in a cost effectiveness manner. It provides a generic framework to implement fair queuing efficiently.

Although DRR serves fine for throughput fairness, but when it comes to Latency bounds it performs rather poorly. Also it does not operate well for real time traffic. The queuing delays introduced by DRR can have exciting results on the congestion window sizes.

4. RANDOM EARLY DETECTION

Random Early Detection (RED) is a congestion avoidance queuing mechanism (as opposed to a congestion administration mechanism) that is potentially useful, particularly in high-speed transit networks. Sally Floyd and Van Jacobson projected it in various papers in the early 1990s.It is active queue management mechanism. It operates on the average queue size and drop packets on the basis of statistics information. If the buffer is empty all incoming packets are acknowledged. As the queue size increase the probability for discarding a packet also increase. When buffer is full probability becomes equal to 1 and all incoming packets are dropped.

RED is capable to evade global synchronization of TCP flows, preserve high throughput as well as a low delay and attains fairness over multiple TCP connections, etc. It is the most common mechanism to stop congestive collapses.

When the queue in the router starts to fill then a small percentage of packets are discarded. This is deliberate to start TCP sources to decrease their window sizes and hence suffocate back the data rate. This can cause low rates of packet loss in Voice over IP streams. There have been reported incidences in which a series of routers apply RED at the same time, resulting in bursts of packet loss.

5. STOCHASTIC FAIR QUEUING

This queuing mechanism is based on fair queuing algorithm and proposed by John Nagle in 1987. Because it is impractical to have one queue for each conversation SFQ uses a hashing algorithm which divides the traffic over a limited number of queues. It is not so efficient than other queues mechanisms but it also requires less calculation while being almost perfectly fair. It is called "Stochastic" due to the reason that it does not actually assign a queue for every session; it has an algorithm which divides traffic over a restricted number of queues using a hashing algorithm. SFQ assigns a pretty large number of FIFO queues.

CGSR routing scheme

Each node maintains a cluster member table that has mapping from each node to its respective cluster-head. Each node broadcasts its cluster member table periodically and updates its table after receiving other nodeÆs broadcasts using the DSDV algorithm. In addition, each node also maintains a routing table that determines the next hop to reach the destination cluster.

On receiving a packet, a node finds the nearest cluster-head along the route to the destination according to the cluster member table and the routing table. Then it consults its routing table to find the next hop in order to reach the cluster-head selected in step one and transmits the packet to that node.

ON-DEMAND ROUTING PROTOCOLS

These protocols take a lazy approach to routing. In contrast to table-driven routing protocols all up-to-date routes are not maintained at every node, instead the routes are created as and when required. When a source wants to send to a destination, it invokes the route discovery mechanisms to find the path to the destination. The route remains valid till the destination is reachable or until the route is no longer needed.

Cluster based Routing Protocols [CBRP]

In Cluster Based Routing protocol (CBRP), the nodes are divided into clusters. To form the cluster the following algorithm is used. When a node comes up, it enters the "undecided" state, starts a timer and broadcasts a Hello message. When a cluster-head gets this hello message it responds with a triggered hello message immediately. When the undecided node gets this message it sets its state to "member". If the undecided node times out, then it makes itself the cluster-head if it has bi-directional link to some neighbor otherwise it remains in undecided state and repeats the procedure again. Cluster heads are changed as infrequently as possible.

Each node maintains a neighbor table. For each neighbor, the neighbor table of a node contains the status of the link (uni- or bi-directional) and the state of the neighbor (cluster-head or member). A cluster-head keeps information about the members of its cluster and also maintains a cluster adjacency table that contains information about the neighboring clusters. For each neighbor cluster, the table has entry that contains the gateway through which the cluster can be reached and the cluster-head of the cluster.

When a source has to send data to destination, it floods route request packets (but only to the neighboring cluster-heads). On receiving the request a cluster-head checks to see if the destination is in its cluster. If yes, then it sends the request directly to the destination else it sends it to all its adjacent cluster-heads. The cluster-heads address is recorded in the packet so a cluster-head discards a request packet that it has already seen. When the destination receives the request packet, it replies back with the route that had been recorded in the request packet. If the source does not receive a reply within a time period, it backs off exponentially before trying to send route request again.

In CBRP, routing is done using source routing. It also uses route shortening that is on receiving a source route packet, the node tries to find the farthest node in the route that is its neighbor (this could have happened due to a topology change) and sends the packet to that node thus reducing the route. While forwarding the packet if a node detects a broken link it sends back an error message to the source and then uses local repair mechanism. In local repair mechanism, when a node finds the next hop is unreachable, it checks to see if the next hop can be reached through any of its neighbor or if hop after next hop can be reached through any other neighbor. If any of the two works, the packet can be sent out over the repaired path.

Ad hoc On-demand Distance Vector Routing [AODV]

Ad hoc On-demand Distance Vector Routing (AODV) [Perkins99]is an improvement on the DSDV algorithm discussed in section 2.1. AODV minimizes the number of broadcasts by creating routes on-demand as opposed to DSDV that maintains the list of all the routes.

To find a path to the destination, the source broadcasts a route request packet. The neighbors in turn broadcast the packet to their neighbors till it reaches an intermediate node that has a recent route information about the destination or till it reaches the destination (Figure a). A node discards a route request packet that it has already seen. The route request packet uses sequence numbers to ensure that the routes are loop free and to make sure that if the intermediate nodes reply to route requests, they reply with the latest information only.

When a node forwards a route request packet to its neighbors, it also records in its tables the node from which the first copy of the request came. This information is used to construct the reverse path for the route reply packet. AODV uses only symmetric links because the route reply packet follows the reverse path of route request packet. As the route reply packet traverses back to the source (Figure b), the nodes along the path enter the forward route into their tables.

Route discovery on AODV

If the source moves then it can reinitiate route discovery to the destination. If one of the intermediate nodes move then the moved nodes neighbor realizes the link failure and sends a link failure notification to its upstream neighbors and so on till it reaches the source upon which the source can reinitiate route discovery if needed.

For more click here

Dynamic Source Routing Protocol [DSR]

The Dynamic Source Routing Protocol is a source-routed on-demand routing protocol. A node maintains route caches containing the source routes that it is aware of. The node updates entries in the route cache as and when it learns about new routes.

The two major phases of the protocol are: route discovery and route maintenance. When the source node wants to send a packet to a destination, it looks up its route cache to determine if it already contains a route to the destination. If it finds that an unexpired route to the destination exists, then it uses this route to send the packet. But if the node does not have such a route, then it initiates the route discovery process by broadcasting a route request packet. The route request packet contains the address of the source and the destination, and a unique identification number. Each intermediate node checks whether it knows of a route to the destination. If it does not, it appends its address to the route record of the packet and forwards the packet to its neighbors. To limit the number of route requests propagated, a node processes the route request packet only if it has not already seen the packet and it's address is not present in the route record of the packet.

A route reply is generated when either the destination or an intermediate node with current information about the destination receives the route request packet. A route request packet reaching such a node already contains, in its route record, the sequence of hops taken from the source to this node.

Record route in DSR

As the route request packet propagates through the network, the route record is formed as shown in figure a. If the route reply is generated by the destination then it places the route record from route request packet into the route reply packet. On the other hand, if the node generating the route reply is an intermediate node then it appends its cached route to destination to the route record of route request packet and puts that into the route reply packet. Figure b shows the route reply packet being sent by the destination itself. To send the route reply packet, the responding node must have a route to the source. If it has a route to the source in its route cache, it can use that route. The reverse of route record can be used if symmetric links are supported. In case symmetric links are not supported, the node can initiate route discovery to source and piggyback the route reply on this new route request.

DSRP uses two types of packets for route maintenance:- Route Error packet and Acknowledgements. When a node encounters a fatal transmission problem at its data link layer, it generates a Route Error packet. When a node receives a route error packet, it removes the hop in error from it's route cache. All routes that contain the hop in error are are truncated at that point. Acknowledgment packets are used to verify the correct operation of the route links. This also includes passive acknowledgments in which a node hears the next hop forwarding the packet along the route.

For more click 1 click 2

Temporally Ordered Routing Algorithm [TORA]

The Temporally Ordered Routing Algorithm (TORA) is a highly adaptive, efficient and scalable distributed routing algorithm based on the concept of link reversal. TORA is proposed for highly dynamic mobile, multihop wireless networks. It is a source-initiated on-demand routing protocol. It finds multiple routes from a source node to a destination node. The main feature of TORA is that the control messages are localized to a very small set of nodes near the occurrence of a topological change. To achieve this, the nodes maintain routing information about adjacent nodes. The protocol has three basic functions: Route creation, Route maintenance, and Route erasure.

Each node has a quintuple associated with it -

    • Logical time of a link failure

    • The unique ID of the node that defined the new reference level

    • A reflection indicator bit

    • A propagation ordering parameter

    • The unique ID of the node

The first three elements collectively represent the reference level. A new reference level is defined each time a node loses its last downstream link due to a link failure. The last two values define a delta with respect to the reference level.

Route Creation is done using QRY and UPD packets. The route creation algorithm starts with the height (propagation ordering parameter in the quintuple) of destination set to 0 and all other node's height set to NULL (i.e. undefined). The source broadcasts a QRY packet with the destination node's id in it. A node with a non-NULL height responds with a UPD packet that has its height in it. A node receiving a UPD packet sets its height to one more than that of the node that generated the UPD. A node with higher height is considered upstream and a node with lower height downstream. In this way a directed acyclic graph is constructed from source to the destination. Figure illustrates a route creation process in TORA. As shown in figure 6a, node 5 does not propagate QRY from node 3 as it has already seen and propagated QRY message from node 2. In figure 6b, the source (i.e. node 1) may have received a UPD each from node 2 or node 3 but since node 4 gives it lesser height, it retains that height.

Route creation in TORA

When a node moves the DAG route is broken, and route maintenance is needed to reestablish a DAG for the same destination. When the last downstream link of a node fails, it generates a new reference level. This results in the propagation of that reference level by neighboring nodes as shown in figure below. Links are reversed to reflect the change in adapting to the new reference level. This has the same effect as reversing the direction of one or more links when a node has no downstream links.

Re establishing route on failure of link 5-7.The new reference node level is 5

In the route erasure phase, TORA floods a broadcast clear packet (CLR) throughout the network to erase invalid routes.

In TORA there is a potential for oscillations to occur, especially when multiple sets of coordinating nodes are concurrently detecting partitions, erasing routes, and building new routes based on each other. Because TORA uses internodal coordination, its instability problem is similar to the "count-to-infinity" problem in distance-vector routing protocols, except that such oscillations are temporary and route convergence will ultimately occur.

Associativity Based Routing [ABR]

The Associativity Based Routing (ABR) protocol is a new approach for routing. ABR defines a new metric for routing known as the degree of association stability. It is free from loops, deadlock, and packet duplicates. In ABR, a route is selected based on associativity states of nodes. The routes thus selected are liked to be long-lived. All node generate periodic beacons to signify its existence. When a neighbor node receives a beacon, it updates its associativity tables. For every beacon received, a node increments its associativity tick with respect to the node from which it received the beacon. Association stability means connection stability of one node with respect to another node over time and space. A high value of associativity tick with respect to a node indicates a low state of node mobility, while a low value of associativity tick may indicate a high state of node mobility. Associativity ticks are reset when the neighbors of a node or the node itself move out of proximity. The fundamental objective of ABR is to find longer-lived routes for ad hoc mobile networks. The three phases of ABR are Route discovery, Route reconstruction (RRC) and Route deletion.

The route discovery phase is a broadcast query and await-reply (BQ-REPLY) cycle. The source node broadcasts a BQ message in search of nodes that have a route to the destination. A node does not forward a BQ request more than once. On receiving a BQ message, an intermediate node appends its address and its associativity ticks to the query packet. The next succeeding node erases its upstream node neighbors' associativity tick entries and retains only the entry concerned with itself and its upstream node. Each packet arriving at the destination will contain the associativity ticks of the nodes along the route from source to the destination. The destination can now select the best route by examining the associativity ticks along each of the paths. If multiple paths have the same overall degree of association stability, the route with the minimum number of hops is selected. Once a path has been chosen, the destination sends a REPLY packet back to the source along this path. The nodes on the path that the REPLY packet follows mark their routes as valid. All other routes remain inactive, thus avoiding the chance of duplicate packets arriving at the destination.

RRC phase consists of partial route discovery, invalid route erasure, valid route updates, and new route discovery, depending on which node(s) along the route move. Source node movement results in a new BQ-REPLY process because the routing protocol is source-initiated. The route notification (RN) message is used to erase the route entries associated with downstream nodes. When the destination moves, the destination's immediate upstream node erases its route. A localized query (LQ [H]) process, where H refers to the hop count from the upstream node to the destination, is initiated to determine if the node is still reachable. If the destination receives the LQ packet, it selects the best partial route and REPLYs; otherwise, the initiating node times out and backtracks to the next upstream node. An RN message is sent to the next upstream node to erase the invalid route and inform this node that it should invoke the LQ [H] process. If this process results in backtracking more than halfway to the source, the LQ process is discontinued and the source initiates a new BQ process.

When a discovered route is no longer needed, the source node initiates a route delete (RD) broadcast. All nodes along the route delete the route entry from their routing tables. The RD message is propagated by a full broadcast, as opposed to a directed broadcast, because the source node may not be aware of any route node changes that occurred during RRCs.

Signal Stability Routing [SSR]

Signal Stability-Based Adaptive Routing protocol (SSR) is an on-demand routing protocol that selects routes based on the signal strength between nodes and a node's location stability. This route selection criterion has the effect of choosing routes that have "stronger" connectivity. SSR comprises of two cooperative protocols: the Dynamic Routing Protocol (DRP) and the Static Routing Protocol (SRP).

The DRP maintains the Signal Stability Table (SST) and Routing Table (RT). The SST stores the signal strength of neighboring nodes obtained by periodic beacons from the link layer of each neighboring node. Signal strength is either recorded as a strong or weak channel. All transmissions are received by DRP and processed. After updating the appropriate table entries, the DRP passes the packet to the SRP.

The SRP passes the packet up the stack if it is the intended receiver. If not, it looks up the destination in the RT and forwards the packet. If there is no entry for the destination in the RT, it initiates a route-search process to find a route. Route-request packets are forwarded to the next hop only if they are received over strong channels and have not been previously processed (to avoid looping). The destination chooses the first arriving route-search packet to send back as it is highly likely that the packet arrived over the shortest and/or least congested path. The DRP reverses the selected route and sends a route-reply message back to the initiator of route-request. The DRP of the nodes along the path update their RTs accordingly.

Route-search packets arriving at the destination have necessarily arrived on the path of strongest signal stability because the packets arriving over a weak channel are dropped at intermediate nodes. If the source times out before receiving a reply then it changes the PREF field in the header to indicate that weak channels are acceptable, since these may be the only links over which the packet can be propagated.

When a link failure is detected within the network, the intermediate nodes send an error message to the source indicating which channel has failed. The source then sends an erase message to notify all nodes of the broken link and initiates a new route-search process to find a new path to the destination.

CONCLUSION

In here, several existing routing protocols for ad hoc Wireless Networks were described. Two categories of routing protocols were discussed. Table-driven and on-demand routing protocols. In table-driven protocols, each node maintain up-to-date routing information to all the nodes in the network where in on-demand protocols a node finds the route to a destination when it desires to send packets to the destination.

Several table-driven protocols were discussed. DSDV and GSR are table-driven protocols that use destination sequence numbers to keep routes loop-free and up-to-date. HSR and ZHLS are hierarchical routing. FSR reduces the size of tables to be exchanged by maintaining less accurate information about nodes farther away. CGSR is a cluster-based routing protocol where nodes are grouped into clusters.

On-demand routing protocols were also discussed. In on-demand protocols, a route creation is initiated by the source when the source wants to communicate to the destination. CBRP is a cluster based routing algorithm like CGSR except that it is an on-demand routing mechanism as opposed to CGSR that is table-driven. AODV on-demand version of DSDV routing protocol. DSRP is a source routing mechanism where the route is in each packet. ABR uses the degree of associativity to select routes. Similarly, SSR selects routes based on signal strength.

For more link 1 link 2