Installing and Running ns-3|THE NS-3 NETWORK SIMULATOR




Installing and Running ns-3

We here outline the steps for installing ns-3 under Linux from the “allinone” tar file, assuming that all prerequisite packages (such as gcc) are already in place. Much more general installation instructions can be found at www.nsnam.org. In particular, serious users are likely to want to download the current Mercurial repository directly. Information is also available for Windows and Macintosh installation, although perhaps the simplest option for Windows users is to run ns-3 in a Linux virtual machine.

The first step is to unzip the tar file; this should leave a directory named ns-allinone-3.nn, where nn reflects the version number (20 in the author’s installation as of this 2014 writing). This directory is the root of the ns-3 system; it contains a build.py (python) script and the primary ns-3 directory ns-3.nn. All that is necessary is to run the build.py script:

      ./build.py

Considerable configuration and then compiler output should ensue, hopefully terminating with a list of “Modules built” and “Modules not built”.

From this point on, most ns-3 work will take place in the subdirectory ns-3.nn, that is, in ns-allinone-3.nn/ns3.nn. This development directory contains the source directory src, the script directory scratch, and the execution script waf.

The development directory also contains a directory examples containing a rich set of example scripts. The scripts in examples/tutorial are described in depth in the ns-3 tutorial in doc/tutorial.

Running a Script

Let us now run a script, for example, the file first.cc included in the examples/tutorial directory. We first copy this file into the directory “scratch”, and then, in the parent development directory, enter the command

An Introduction to Computer Networks, Release 2.0.4

    ./waf --run first

The program is compiled and, if compilation is successful, is run.

In fact, every uncompiled program in the scratch directory is compiled, meaning that projects in progress that are not yet compilable must be kept elsewhere. One convenient strategy is to maintain multiple project directories, and link them symbolically to scratch as needed.

The ns-3 system includes support for command-line options; the following example illustrates the passing by command line of the value 3 for the variable nCsma:

        ./waf --run "second --nCsma=3"

Compilation Errors

By default, ns-3 enables the -Werror option to the compiler, meaning that all warnings are treated as errors. This is good practice for contributed or published scripts, but can be rather exasperating for beginners. To disable this, edit the file waf-tools/cflags.py (relative to the development directory). Change the line

self.warnings_flags = [['-Wall'], ['-Werror'], ['-Wextra']]

 

to

self.warnings_flags = [['-Wall'], ['-Wextra']]

 

Then, in the development directory, run

./waf configure
./waf build

 

 

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



Frequently Asked Questions

+
Ans: It is now time to turn our attention from the applications and social aspects of networking (the fun stuff) to the technical issues involved in network design (the work stuff). There is no generally accepted taxonomy into which all computer networks fit, but two dimensions stand out as important: transmission technology and scale. view more..
+
Ans: Before we start to examine the technical issues in detail, it is worth devoting some time to pointing out why people are interested in computer networks and what they can be used for. After all, if nobody were interested in computer networks, few of them would be built. We will start with traditional uses at companies view more..
+
Ans: Installing and Running ns-3|THE NS-3 NETWORK SIMULATOR view more..
+
Ans: A Single TCP Sender| The ns-3 Network Simulator view more..
+
Ans: Wireless|The ns-3 Network Simulator view more..
+
Ans: The ns-2 simulator|NETWORK SIMULATIONS: NS-2 view more..
+
Ans: A Single TCP Sender| The ns-3 Network Simulator view more..
+
Ans: Two TCP Senders Competing|THE NS-3 NETWORK SIMULATOR view more..
+
Ans: Wireless Simulation|NETWORK SIMULATIONS: NS-2 view more..
+
Ans: Epilog|NETWORK SIMULATIONS: NS-2 view more..
+
Ans: Installing and Running ns-3|THE NS-3 NETWORK SIMULATOR view more..
+
Ans: Installing Mininet|MININET view more..
+
Ans: A Simple Mininet Example|MININET view more..
+
Ans: Multiple Switches in a Line|Mininet view more..
+
Ans: IP Routers in a Line|Mininet view more..
+
Ans: IP Routers With Simple Distance-Vector Implementation|Mininet view more..
+
Ans: TCP Competition: Reno vs BBR|Mininet view more..




Rating - 3/5
486 views

Advertisements