Friday, 1 April 2016

Installing and Testing ns-3 with NetAnim on Ubuntu 14.04



Hi members 
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

No comments:

Post a Comment