Search This Blog

Showing posts with label ns-3. Show all posts
Showing posts with label ns-3. Show all posts

[ns-3] Cloning MANET Routing Protocols in ns-3

8

Labels: , , , , , , ,

This post provides a "python script" to clone AODV, DSDV, OLSR or DSR in ns-3. By cloning, we mean that an identical copy of an existing protocol is created in ns-3, but with a different name. 

Once the clone is created, you can modify it for your research work without affecting the original code of existing protocols in ns-3.

Warning: DSR cloning will work only for ns-3.25 and higher versions of ns-3!

Contributed by: Kriti Nagori and Meenakshy Balachandran, Wireless Information Networking Group (WiNG), NITK Surathkal.

Steps to create a clone:

1. Download the python script: clone-manet-routing.py

2. Place it in ns-allinone-3.xx/ns-3.xx/src directory

3. Go to ns-allinone-3.xx/ns-3.xx/src via terminal and give the following command:

chmod 777 clone-manet-routing.py

4. Give the following command to create a clone of AODV:

./clone-manet-routing.py aodv myaodv

5. Go to ns-allinone-3.xx/ns-3.xx/ via terminal and give the following commands:

./waf configure --enable-examples

./waf

You are done with it!

Note: Replace aodv by dsdv, olsr or dsr in Step 4 to clone DSDV, OLSR or DSR respectively.

Verifying the working of a clone:

1. Copy myaodv.cc from ns-allinone-3.xx/ns-3.xx/src/myaodv/examples

2. Paste it in ns-allinone-3.xx/ns-3.xx/scratch

3. Give the following command from ns-3.xx directory to run it:

./waf --run scratch/myaodv

If the command succeeds, you have successfully cloned AODV to MYAODV.

Hope it helps.

Regards,
Mohit P. Tahiliani

[ns-3] Installing ndnSIM on Ubuntu: One Step Procedure

7

Labels: , , , ,

ndnSIM is "ns-3 based Named Data Networking Simulator" [1]. This post provides a "shell script" that automates the installation of ndnSIM on Ubuntu. It has been tested on Ubuntu 14.04, 15.04, 16.04 and 17.04.

Note 1: This post is updated when a new version of ndnSIM or a new version of Ubuntu is released.
Note 2: You must be connected to Internet while executing the shell script.

Contributed by: Kiran Ramesh, Karthik S and Ayush Agarwal, Wireless Information Networking Group (WiNG), NITK Surathkal.

Updated by: Viyom Mittal and Vivek Jain, WiNG, NITK Surathkal.

Steps to install ndnSIM:

1. Download the shell script: ndnSIM-install.sh and place it on Desktop

2. Go to Desktop via terminal and give the following command:

sh ndnSIM-install.sh

3. Give your system password, when asked.

You are done with it!

Verifying the installation of ndnSIM:

1. Go ~/Desktop/ndnSIM/ns-3 and give the following command:

./waf --run=ndn-simple

If you see " 'build' finished successfully " message, ndnSIM is installed correctly.

Hope it helps.

Regards,
Mohit P. Tahiliani

References:

[1] ndnSIM Documentation: http://ndnsim.net/2.3/getting-started.html

[ns-3] Installing ns-3 on Ubuntu 15.04: Simplified

8

Labels: , , , , , , , , , , , , ,

This post describes a simplified approach to install ns-3 and related tools such as NetAnim, PyViz, Wireshark, Gnuplot and TraceMetrics in Ubuntu 15.04. 

Note: This post is updated when a new version of ns-3 or a new version of Ubuntu is released.

First, update the package list by executing this command: sudo apt-get update

Install following packages (command is given below):

For ns-3:
1. gcc
2. g++
3. python
4. python-dev

For NetAnim:
1. qt4-dev-tools

For PyViz:
1. libgtk-3-dev
2. python-pygoocanvas
3. python-pygraphviz

For Wireshark and Gnuplot:
1. wireshark
2. gnuplot

For TraceMetrics:
1. openjdk-7-jdk (install openjdk-8-jdk if you're using Ubuntu 16.04 or higher)

Command to install all these packages together:

sudo apt-get install gcc g++ python python-dev qt4-dev-tools libgtk-3-dev python-pygoocanvas python-pygraphviz wireshark gnuplot openjdk-7-jdk

Wireshark and Gnuplot will be ready to use after this command! TraceMetrics does not require installation. Read more about TraceMetrics

Steps to install ns-3:

1. Download ns-allinone-3.27.tar.bz2 and unzip it.

2. Go to ns-allinone-3.27 and give the following command:

./build.py --enable-examples --enable-tests

This command will install ns-3, NetAnim and PyViz.

3. Once the installation completes, go to ns-allinone-3.27/ns-3.27 and give the following command:

./test.py -c core

You are done with it!

Hope it helps.

Regards,
Mohit P. Tahiliani

[ns-3] TraceMetrics: A trace file analyzer for ns-3

4

Labels: , , ,

TraceMetrics, developed in Java, is an open source trace file analyzer for analyzing the trace files (.tr) of ns-3 [1]. TraceMetrics does not require installation! You just need to have Java installed on your machine to use it.

Prerequisites for working with TraceMetrics: JDK 7 must be installed on your machine.

Command to install JDK 7 on Ubuntu OS is:

sudo apt-get install openjdk-7-jdk

Before we proceed to work with TraceMetrics, it is important that we have a ns-3 trace file which we can analyze with TraceMetrics. To get the ns-3 trace file, follow any one of the three options given below:

Option 1: If you have already installed ns-3, follow the steps given below:

1. Copy the file named

tcp-bulk-send.cc 

from this directory: ns-allinone-3.xx/ns-3.xx/examples/tcp

and paste it into the following directory: ns-allinone-3.xx/ns-3.xx/scratch

2. Go to ns-allinone-3.xx/ns-3.xx via terminal and give the following command to run tcp-bulk-send.cc

./waf --run "scratch/tcp-bulk-send --tracing=true"

3. If the above mentioned command is successful, search for a file named "tcp-bulk-send.tr" in your ns-allinone-3.xx/ns-3.xx directory.

If you find "tcp-bulk-send.tr", then your trace file is ready for analysis. "tcp-bulk-send.tr" is the trace file which will be analyzed by TraceMetrics.

You may Skip Option 2 and Option 3 and directly read "How to use TraceMetrics" Section!

Option 2: If you have not yet installed ns-3, follow the steps given below:

1. Install ns-3. I have written a separate post for installation of ns-3. Here is the link:


2. After successfully installing ns-3, follow the steps given in "Option 1" of this post.

Option 3: If you just want to see how TraceMetrics works and would like to generate your trace files at a later point, just download the "tcp-bulk-send.tr" from the link given below:

Download tcp-bulk-send.tr

How to use TraceMetrics

Follow the steps given below to start analyzing "tcp-bulk-send.tr" by using TraceMetrics:

1. Download TraceMetrics from the following link:


2. Unzip the downloaded file i.e., tracemetrics-1.3.0.zip.

3. Go in the extracted folder i.e., tracemetrics and open the file named "tracemetrics.jar". You should see tracemetrics loading like shown in the Image below:

[Click on the Image to enlarge]

and then the following window should open:

[Click on the Image to enlarge]

4. Select File -> Choose File and then navigate to the folder where you stored "tcp-bulk-send.tr". Select "tcp-bulk-send.tr"

5. The next window that appears will look like the Image shown below:

[Click on the Image to enlarge]

6. Click on "Execute analysis" button on the bottom right corner.

You are done with it!

NOTE: A wonderful tutorial on how to analyze the parameters is provided by the developers of TraceMetrics. You can download it from the following link:


References:

[1] TraceMetrics Official Webpage: http://www.tracemetrics.net/

Hope it helps.

Best Regards,
Mohit P. Tahiliani

[ns-3] Installing and Testing ns-3 with NetAnim on Ubuntu 14.04

8

Labels: , , , , , ,

This post describes a step-by-step procedure to download, install and test ns-3 with NetAnim on Ubuntu 14.04 LTS.

ns-3 version considered: ns-allinone-3.20

List of Prerequisite Packages to be installed:
1. gcc
2. g++
3. python
4. python-dev (Optional: If you want to use Python as the main language for network configuration)
5. mercurial (Optional: If you choose Method 2 (explained below) for downloading and installing ns-3)
6. qt4-dev-tools (Optional: If you want to install *NetAnim* (animator for ns-3) along with ns-3)
7. tcpdump (Optional: Required for analyzing packet capture files (.pcap) generated by ns-3)
8. wireshark (Optional: Alternative to tcpdump. You can use anyone of these)
9. gnuplot (Optional: Required for plotting high quality graphs through *.dat* files generated by ns-3)

Installing Prerequisite Packages:
Give the following command to install the above mentioned packages:

sudo apt-get install gcc g++ python python-dev mercurial qt4-dev-tools tcpdump wireshark gnuplot

You may remove the optional package's name from the above command if it is not required!

Downloading ns-3:
ns-3 can be downloaded in at least two different ways [1]:

Method 1 (Recommended for beginners): Downloading a ns-3 tarball i.e., a zipped folder (We follow this method here)

Go to following link to download ns-allinone-3.20 tarball:

https://www.nsnam.org/release/ns-allinone-3.20.tar.bz2

For older versions of ns-3, you can download the tarball from the following link:

http://www.nsnam.org/releases/older/

Method 2: Downloading through *bake*

You need to have packages 4 and 5 from the list shown above to download ns-3 using bake. Once the prerequisite packages are installed, follow the instructions given on [1] to download ns-3:

Installing ns-3 and NetAnim:
ns-3 can be installed in three different ways [2]:

Method 1: by using build.py (We follow this method in this post)
Method 2: by using bake
Method 3: by using Waf

For Method 2 and Method 3 of installation, follow [2].

After you have followed Method 1 for downloading ns-allinone-3.20 tarball, you may keep your downloaded tarball on the Desktop and then follow the steps given below to install it:

NOTE: NetAnim (the animator for ns-3) package comes bundled in ns-allinone-3.xx tarball. So if you want to install *NetAnim* along with ns-allinone-3.20, then install qt4-dev-tools package before you proceed to the next steps because when you try to install ns-allinone-3.xx package, it first tries to install NetAnim. It searches for qt4-dev-tools package and if it is not found - NetAnim installation will be skipped! Alternatively, you can also choose to install NetAnim later via apt-get 

Step 1: Go to Desktop via terminal and unzip the ns-allinone-3.20.tar.bz2 tarball

cd Desktop

tar xjf ns-allinone-3.20.tar.bz2

Step 2: Go in ns-allinone-3.20 folder and give the following command for installation:

./build.py --enable-examples --enable-tests

After a while, you may see the following message

Leaving directory './ns-3.20'

which indicates that ns-3 is installed !!!

Testing ns-3:
To test whether all modules of ns-3 are installed successfully, follow the procedure as given below:

Step 1: Go to ns-allinone-3.20/ns-3.20 folder and give the following directory:

./test.py -c core

Some tests may be skipped while testing but that should not bother you if your module is not among those that were skipped!

Testing NetAnim (only for those users who installed qt4-dev-tools package before ns-3 installation):
To test whether NetAnim is installed successfully, follow the procedure given below:

Step 1: Go to ns-allinone-3.20/netanim-3.105 and give the following command:

./NetAnim

A window as shown below should open:

[Click on the Image to enlarge]

You are done with it!

References:

[1] Downloading ns-3, http://www.nsnam.org/docs/release/3.20/tutorial/singlehtml/index.html#downloading-ns3

[2] Building ns-3, http://www.nsnam.org/docs/release/3.20/tutorial/singlehtml/index.html#building-ns3