Search This Blog

[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] Blackhole Attack Simulation in ns-3

52

Labels: , , , , , , , ,

The patch provided in this post enables a ns-3 user to simulate "Blackhole Attack in ns-3" for Mobile Ad hoc Network (MANET) Simulations. Blackhole attack has been implemented using Ad hoc On demand Distance Vector (AODV) routing protocol.

This patch is available for:
1. ns-allinone-3.25    -  Blackhole-ns-3.25.patch
2. ns-allinone-3.24.1 -  Blackhole-ns-3.24.1.patch
2. ns-allinone-3.24    -  Blackhole-ns-3.24.patch
3. ns-allinone-3.23    -  Blackhole-ns-3.23.patch
4. ns-allinone-3.22    -  Blackhole-ns-3.22.patch
5. ns-allinone-3.21    -  Blackhole-ns-3.21.patch
6. ns-allinone-3.20    -  Blackhole-ns-3.20.patch

Patch for ns-3.20 Contributed by: Shalini Satre, Wireless Information Networking Group (WiNG), NITK Surathkal.

Material provided with this post:
1. A patch to simulate Blackhole attack in ns-3 and steps to apply that patch.
2. Sample C++ Program to ensure that the patch is applied correctly!

Follow the steps given below to apply Blackhole patch to ns-3.25:

Note: (i) Steps remain same for applying the patch to other versions of ns-3, except that you should use ns-3.xx instead of ns-3.25 wherever applicable. (ii) This blog post is updated whenever a new version of ns-3 is released.

If ns-3 is "not installed" in your machine:

1. Download ns-allinone-3.25.tar.bz2

2. Download Blackhole-ns-3.25.patch

3. Unzip ns-allinone-3.25.tar.bz2. You will get a folder named ns-allinone-3.25

4. Paste the downloaded Blackhole-ns3 patch in the above mentioned folder.

5. Give the following command:

patch -p1 < Blackhole-ns-3.25.patch

6. Go in ns-allinone-3.25 via terminal and give the following command to install ns-3.25

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

You are done with it!

If ns-3 is "already installed" on your machine:

1. Paste the downloaded Blackhole-ns-3.25 patch in ns-allinone-3.25 directory.

2. Give the following command:

patch -p1 < Blackhole-ns-3.25.patch

3. Go in ns-allinone-3.25/ns-3.25 directory and give the following commands:

./waf

You are done with it!

Sample C++ Program to verify the working of Blackhole Patch:

Download the zipped folder from the link given below and extract the files from it:

sample-program-blackhole-ns3.zip

Put both the extracted files in the following folder:

ns-allinone-3.25/ns-3.25/scratch

How to use these files for verification?

I. Go to ns-allinone-3.25/ns-3.25 via terminal and give the following command:

./waf --run scratch/blackhole

You will get an output as shown below:

[Click on the Image to enlarge]

Acknowledgements: 

1. Thanks to Shalini Satre for developing this patch and providing a sample C++ Program to verify its working.

2. Thanks to ns-3 mailing list on Google Groups for their wonderful support and encouragement!

Hope it helps.

Regards,
Mohit P. Tahiliani

Automated Post Processing (APP) Tool for ns-2 trace files

13

Labels: , , , , , , , , ,

Automated Post Processing (APP) Tool has been designed and developed by Wireless Information Networking Group (WiNG) at NITK, Surathkal with an aim to help the ns-2 users in processing the trace files and plotting graphs. 

Although several such tools already exist, APP has been designed with a few unique features that are distinct from other tools:

1. APP Tool does not require installation! Just download the APP folder and run the tool.

2. APP Tool helps you to obtain values / graphs for at least 20 parameters!

3. APP Tool uses AWK Scripts in the back end!

4. APP Tool's source code is free and flexible! i.e., you can also add your own AWK Script in APP Tool and use it for plotting a graph.

5. Front end of APP Tool is designed in Python! You can customize it as per your requirements.

6. You need only two packages installed on your machine to run APP Tool: python-gi and python-matplotlib.

A total of 20 AWK Scripts are provided in the APP Tool, one for each of the parameter shown in the image below:

[Click to enlarge the image]

Note: You may have to modify some of the AWK Scripts to meet your requirements. As mentioned before, you can also add your own AWK Script to APP with ease, in case you want to analyze a different parameter. Moreover, not every parameter among the 20 mentioned above need graphs. Hence, APP plots graphs only for the parameter for which graphs are required. 


Instructions on "How to run APP Tool" have been provided in the Readme file available on the download link given above.

APP Tool has been dual licensed under the MIT or GPL v3 Licenses. Contributors to this project: Sayan Paul, Jay Priyadarshi, Sasank Channapradaga, Spriha Awinpushpam and Mohit P. Tahiliani

Kindly Note: Please report to us in case you find any errors while working with the APP Tool. You can write to us at wing@nitk.ac.in or place a comment in this post itself.

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