author | Tom Henderson <tomh@tomh.org> |
Sat, 16 Jan 2016 08:14:40 -0800 | |
changeset 11683 | 9142266fbb25 |
parent 10401 | 6e9d4ceb880b |
permissions | -rw-r--r-- |
6754 | 1 |
.. include:: replace.txt |
2 |
||
3 |
Introduction |
|
4 |
------------ |
|
5 |
||
6 |
The |ns3| simulator is a discrete-event network simulator targeted |
|
7 |
primarily for research and educational use. The |
|
8 |
`ns-3 project |
|
9 |
<http://www.nsnam.org>`_, |
|
10 |
started in 2006, is an open-source project developing |ns3|. |
|
11 |
||
12 |
The purpose of this tutorial is to introduce new |ns3| users to the |
|
13 |
system in a structured way. It is sometimes difficult for new users to |
|
14 |
glean essential information from detailed manuals and to convert this |
|
15 |
information into working simulations. In this tutorial, we will build |
|
16 |
several example simulations, introducing and explaining key concepts and |
|
17 |
features as we go. |
|
18 |
||
19 |
As the tutorial unfolds, we will introduce the full |ns3| documentation |
|
20 |
and provide pointers to source code for those interested in delving deeper |
|
21 |
into the workings of the system. |
|
22 |
||
23 |
A few key points are worth noting at the onset: |
|
24 |
||
10184
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
25 |
* |ns3| is open-source, and the project strives to maintain an |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
26 |
open environment for researchers to contribute and share their software. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
27 |
* |ns3| is not a backwards-compatible extension of `ns-2 |
6754 | 28 |
<http://www.isi.edu/nsnam/ns>`_; |
29 |
it is a new simulator. The two simulators are both written in C++ but |
|
7654 | 30 |
|ns3| is a new simulator that does not support the |ns2| APIs. Some |
31 |
models from |ns2| have already been ported from |ns2| to |ns3|. The |
|
32 |
project will continue to maintain |ns2| while |ns3| is being built, |
|
6754 | 33 |
and will study transition and integration mechanisms. |
10184
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
34 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
35 |
About |ns3| |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
36 |
*********** |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
37 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
38 |
|ns3| has been developed to provide an open, extensible network simulation |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
39 |
platform, for networking research and education. In brief, |ns3| provides |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
40 |
models of how packet data networks work and perform, and provides a |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
41 |
simulation engine for users to conduct simulation experiments. Some of the |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
42 |
reasons to use |ns3| include to perform studies that are more difficult |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
43 |
or not possible to perform with real systems, to study system behavior in |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
44 |
a highly controllled, reproducible environment, and to learn about how |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
45 |
networks work. Users will note that the available model set in |ns3| |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
46 |
focuses on modeling how Internet protocols and networks work, but |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
47 |
|ns3| is not limited to Internet systems; several users are using |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
48 |
|ns3| to model non-Internet-based systems. |
6754 | 49 |
|
10184
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
50 |
Many simulation tools exist for network simulation studies. Below are |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
51 |
a few distinguishing features of |ns3| in contrast to other tools. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
52 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
53 |
* |ns3| is designed as a set of libraries that can be combined together |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
54 |
and also with other external software libraries. While some simulation |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
55 |
platforms provide users with a single, integrated graphical user |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
56 |
interface environment in which all tasks are carried out, |ns3| is |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
57 |
more modular in this regard. Several external animators and |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
58 |
data analysis and visualization tools can be used with |ns3|. However, |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
59 |
users should expect to work at the command line and with C++ and/or |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
60 |
Python software development tools. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
61 |
* |ns3| is primarily used on Linux systems, although support exists |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
62 |
for FreeBSD, Cygwin (for Windows), and native Windows Visual Studio |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
63 |
support is in the process of being developed. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
64 |
* |ns3| is not an officially supported software product of any company. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
65 |
Support for |ns3| is done on a best-effort basis on the |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
66 |
ns-3-users mailing list. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
67 |
|
6754 | 68 |
|
7654 | 69 |
For |ns2| Users |
7663
a39cbfe79fac
clear warning in tutorial build process
Tom Henderson <tomh@tomh.org>
parents:
7654
diff
changeset
|
70 |
*************** |
6754 | 71 |
|
10184
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
72 |
For those familiar with |ns2| (a popular tool that preceded |ns3|), |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
73 |
the most visible outward change when moving to |
7654 | 74 |
|ns3| is the choice of scripting language. Programs in |ns2| are |
6754 | 75 |
scripted in OTcl and results of simulations can be visualized using the |
76 |
Network Animator nam. It is not possible to run a simulation |
|
7654 | 77 |
in |ns2| purely from C++ (i.e., as a main() program without any OTcl). |
78 |
Moreover, some components of |ns2| are written in C++ and others in OTcl. |
|
6754 | 79 |
In |ns3|, the simulator is written entirely in C++, with optional |
80 |
Python bindings. Simulation scripts can therefore be written in C++ |
|
7654 | 81 |
or in Python. New animators and visualizers are available and under |
82 |
current development. Since |ns3| |
|
6754 | 83 |
generates pcap packet trace files, other utilities can be used to |
84 |
analyze traces as well. |
|
85 |
In this tutorial, we will first concentrate on scripting |
|
86 |
directly in C++ and interpreting results via trace files. |
|
87 |
||
88 |
But there are similarities as well (both, for example, are based on C++ |
|
7654 | 89 |
objects, and some code from |ns2| has already been ported to |ns3|). |
90 |
We will try to highlight differences between |ns2| and |ns3| |
|
6754 | 91 |
as we proceed in this tutorial. |
92 |
||
7654 | 93 |
A question that we often hear is "Should I still use |ns2| or move to |
10184
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
94 |
|ns3|?" In this author's opinion, unless the user is somehow vested |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
95 |
in |ns2| (either based on existing personal comfort with and knowledge |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
96 |
of |ns2|, or based on a specific simulation model that is only available |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
97 |
in |ns2|), a user will be more productive with |ns3| for the following |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
98 |
reasons: |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
99 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
100 |
* |ns3| is actively maintained with an active, responsive users mailing |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
101 |
list, while |ns2| is only lightly maintained and has not seen |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
102 |
significant development in its main code tree for over a decade. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
103 |
* |ns3| provides features not available in |ns2|, such as a implementation |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
104 |
code execution environment (allowing users to run real implementation |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
105 |
code in the simulator) |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
106 |
* |ns3| provides a lower base level of abstraction compared with |ns2|, |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
107 |
allowing it to align better with how real systems are put together. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
108 |
Some limitations found in |ns2| (such as supporting multiple types of |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
109 |
interfaces on nodes correctly) have been remedied in |ns3|. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
110 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
111 |
|ns2| has a more diverse set of contributed modules than does |ns3|, owing to |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
112 |
its long history. However, |ns3| has more detailed models in several |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
113 |
popular areas of research (including sophisticated LTE and WiFi models), |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
114 |
and its support of implementation code admits a very wide spectrum |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
115 |
of high-fidelity models. Users may be surprised to learn that the |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
116 |
whole Linux networking stack can be encapsulated in an |ns3| node, |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
117 |
using the Direct Code Execution (DCE) framework. |ns2| |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
118 |
models can sometimes be ported to |ns3|, particularly if they have been |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
119 |
implemented in C++. |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
120 |
|
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
121 |
If in doubt, a good guideline would be to look at both simulators (as |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
122 |
well as other simulators), and in particular the models available |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
123 |
for your research, but keep in mind that your experience may be better |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
124 |
in using the tool that is being actively developed and |
0f7b3b88b438
update introduction of tutorial
Tom Henderson <tomh@tomh.org>
parents:
7663
diff
changeset
|
125 |
maintained (|ns3|). |
6754 | 126 |
|
127 |
Contributing |
|
128 |
************ |
|
129 |
||
130 |
|ns3| is a research and educational simulator, by and for the |
|
131 |
research community. It will rely on the ongoing contributions of the |
|
132 |
community to develop new models, debug or maintain existing ones, and share |
|
133 |
results. There are a few policies that we hope will encourage people to |
|
7654 | 134 |
contribute to |ns3| like they have for |ns2|: |
6754 | 135 |
|
7286 | 136 |
* Open source licensing based on GNU GPLv2 compatibility |
6754 | 137 |
* `wiki |
10401
6e9d4ceb880b
Update ns-3 wiki URL
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10184
diff
changeset
|
138 |
<http://www.nsnam.org/wiki>`_ |
6754 | 139 |
* `Contributed Code |
10401
6e9d4ceb880b
Update ns-3 wiki URL
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10184
diff
changeset
|
140 |
<http://www.nsnam.org/wiki/Contributed_Code>`_ page, similar to |ns2|'s popular Contributed Code |
6754 | 141 |
`page |
7286 | 142 |
<http://nsnam.isi.edu/nsnam/index.php/Contributed_Code>`_ |
6754 | 143 |
* Open `bug tracker |
7286 | 144 |
<http://www.nsnam.org/bugzilla>`_ |
6754 | 145 |
|
146 |
We realize that if you are reading this document, contributing back to |
|
147 |
the project is probably not your foremost concern at this point, but |
|
148 |
we want you to be aware that contributing is in the spirit of the project and |
|
149 |
that even the act of dropping us a note about your early experience |
|
150 |
with |ns3| (e.g. "this tutorial section was not clear..."), |
|
151 |
reports of stale documentation, etc. are much appreciated. |
|
152 |
||
153 |
Tutorial Organization |
|
154 |
********************* |
|
155 |
||
156 |
The tutorial assumes that new users might initially follow a path such as the |
|
157 |
following: |
|
158 |
||
159 |
* Try to download and build a copy; |
|
160 |
* Try to run a few sample programs; |
|
161 |
* Look at simulation output, and try to adjust it. |
|
162 |
||
163 |
As a result, we have tried to organize the tutorial along the above |
|
164 |
broad sequences of events. |
|
165 |