Professional Documents
Culture Documents
Objective:
Performance is evaluated by two network metrics: throughput and delay. We often need more
throughput and less delay. However, these criteria are often contradictory. If we try to send more
data to the network, we may increase the throughput but we increase the delay because of traffic
congestion in the network.
Reliability: in addition to the accuracy of the delivery, network re;liability is measured by the
frequency of failure, the time it take the link to recover from a failure, and the network's
roboustness in a catastrophe.
Simulators an introduction:
Network simulation is an important tool in developing, testing and evaluating network protocols.
Simulation can be used without the target physical hardware, making it economical and practical
for almost any scale of network topology and setup. It is possible to simulate a link of any
bandwidth and delay, even if such a link is currently impossible in the real world. With
simulation, it is possible to set each simulated node to use any desired software. This means that
meaning deploying software is not an issue. Results are also easier to obtain and analyze,
because extracting information from important points in the simulated network is as done by
simply parsing the generated trace files. Different simulators that are available are:
MIT's NETSIM
NIST
CPSIM
INSANE
NEST
REAL
NS
OMNET++
OPNET
NCTUns
Classification of Simulations :
In classical thinking there are three types of simulation; discrete event, continuous, and
MonteCarlo. They were articulated by Nance (1993) as:
a. Discrete event simulation : It utilizes a mathematical/logical model of a
physicalsystem that portrays state changes at precise points in simulated time. Both the
nature of the state change and the time at which the change occurs mandate precise
description. Customers waiting for service, the management of parts inventory or
military combat are typical domains of discrete event simulation.
b. Continuous simulation: It uses equational models, often of physical systems,
which do not portray precise time and state relationships that result in discontinuities.
The objective of studies using such models do not require the explicit representation of
state and time relationships. Examples of such systems are found in ecological
modeling, ballistic reentry, or large scale economic models.
c. Monte Carlo simulation : the name given by John van Neumann and Stanislaw
M. Ulam to reflect its gambling similarity, utilizes models of uncertainty where
representation of time is unnecessary. The term originally attributed to "a situation in
which a difficult non-probabilistic problem is solved through the invention of a stochastic
process that satisfies the relations of the deterministic problem". A more recent
characterization is that Monte Carlo is "the method of repetitive trials. Typical of Monte
Carlo simulation is the approximation of a definite integral by circumscribing the region
with a known geometric shape, then generating random points to estimate the area of
the region through the proportion of points falling within the region boundaries.
Features of Network Simulator NS2
NS (Network Simulator) consists of group of series of distinct occurrence complex simulators,
specifically NS-1, NS-2 and NS-3. All of them are discrete-event network simulator, mainly used
in investigating and training.
NS-2 is a very popular discrete event Network Simulator, which is widely used in the research
field of Wired, Wireless and Satellite Networks across both academia and industry as a way of
designing, testing and evaluating new and existing protocols and architectures, and has also
proven a very useful tool for teaching purposes.
NS-2 comes fully equipped of protocols, models, algorithms and accessory tools. NS-2 is an
open source network simulator which is freely available for academic research purpose.
Therefore, in terms of scientific acceptance, a number of tools/modules and cost, NS-2 would be
a sort of ideal choice.
NS 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-2 started as a variant of the REAL network simulator in 1989 and has since been supported
by the Virtual InterNetwork Testbed (VINT) project that is a DARPA-funded research project
whose aim is to build a network simulator.
WHY NS2?
When the system under research is complex to either follow an analytical approach or implement
it in real time to study its behavior, simulation is the solution that ultimately makes it feasible by
modeling it and closely mimicking the actual process. Network researches wholly depend on the
availability of numerous simulation tools like OPNET, NS2, OMNET++ and so on. Without
these tools it would be difficult to even imagine the advancements we have reached in
networking. Of the numerous tools available, Network Simulator or NS2 (as it is famously
called) stands distinct from the rest of the simulators.
To create an ns-2 simulation, we need to do the following (in addition to a modest amount
of standard housekeeping).
define the network topology, including all nodes, links and router queuing rules
create some TCP (or UDP) connections, called Agents, and attach them to nodes
create some Applications – usually FTP for bulk transfer or telnet for intermittent
random packet generation – and attach them to the agents
Installalation of NS2
Step 1: Setting up the Prerequisites
1. First of all, download Network Simulator (NS-2.35) from here.I assume you have
downloaded it into your '/home/ECE/Local' directory.
2 [Optional]. Now we have to update the Ubuntu with its latest components. Open
up a terminal and run these commands:
3. Before installing the NS we have to install some essential packages required by the
NS. So run the following commands:
1 sudo apt-get install build-essential autoconf automake
2 sudo apt-get install tcl8.5-dev tk8.5-dev
sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-
3
dev
4 sudo apt-get install gcc-4.4
1 cd /home/ ECE/Local
2 tar -xvzf ns-allinone-2.35.tar.gz
2. After extracting the "ns-allinone-2.35" folder, open up the file "/ns-allinone-
2.35/ns-2.35/linkstate/ls.h" in an editor. You can do it either from the terminal or
from the file explorer (Nautilus). We have to make some changes in the ls.h file else
it will show an error while installing the NS. Once you have opened the file move to
the line 137 and replace the erase (image 1) with this—>erase (image 2) and save the
file.
3. Now its time to finally install the NS. Open up a terminal and move to the directory
where you have extracted the package, in our case its '/home/ECE/Local' and install
NS using the following commands (image 4):
1 cd /home/ECE/Local/ns-allinone-2.35
2 sudo ./install
It will some time here so have patience.
NOTE: You may want to create a backup of the .bashrc before editing, the easiest
way is to copy the file to a different location. Later you can replace the edited
.bashrc with the copied one in case something goes sideways or if you want to remove
the NS.
2. Add the following lines AT THE END of the file. Be sure to change "/path_to" to the
path of where you have extracted the NS (e.g. '/home/ECE/Local').
export PATH=$PATH:/home/ece/Public/ns-allinone-2.35/bin:/home/ece/Public/ns-allinone-
2.35/tcl8.5.10/unix:/home/ece/Public/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ece/Public/ns-allinone-2.35/otcl-
1.14:/home/ece/Public/ns-allinone-2.35/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/ece/Public/ns-allinone-2.35/tcl8.5.10/library
And That is it ! You can now run ns from a terminal window by executing: ns
If you received the "%" sign, it means that NS is running (image 5). Congratulations !!
Introduction to TCL Scripts:
Now that the NS2 is installed on your system. You need to know a bit about the
scripting. The scripting interface for ns-2 uses the language Tcl, pronounced “tickle”;
more precisely it is object-Tcl, or OTcl. For simple use, learning the general Tcl syntax
is not necessary; one can proceed quite successfully by modifying standard examples.
However, Tcl is a powerful scripting language that runs under Unix, Linux, VMS,
DOS/Windows, OS/2, and MacOS (at least). It provides all the usual high-level programming
features that we've come to expect from languages like the Unix shell, Awk, Perl, or Rexx, such
as:
Variable-length strings
Associative arrays
Lists
Keyed lists (aka structs, structures or records)
Pattern matching with regular expressions
Ability to define or redefine procedures at run-time
Full file access
Error handling
Use of set, puts, incr, and set n [expr $n + 1] commands in tcl
Arrays in TcL