Installation of ns2 in Ubuntu 18.04

ns2 installation in Ubuntu 18.04

Unlike earlier version of ubuntu, the 18,04 version does not support the direct installation of ns2, because of the latest C/C++ compiler (7.x), but the latest C/C++ compiler supported by ns2 is gcc-4.8. So this post and video tells you about the installation of gcc-4.8 version, then ns2 and then configuration.
Here are the steps, Please follow the video given below for more information.

$] tar zxvf ns-allinone-2.35.tar.gz

$] sudo apt install gcc-4.8 g++-4.8

if you have installed ubuntu just now, you can try these commands also in the beginning

$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev

$] cd ns-allinone-2.35/ns-2.35
$] gedit
$] gedit linkstate/ls.h

line number 137, change erase to this->erase
$] cd ..
$] ./install

export PATH=$PATH:/home/pradeepkumar/ns-allinone-2.35/bin:/home/pradeepkumar/ns-allinone-2.35/tcl8.5.10/unix:/home/pradeepkumar/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pradeepkumar/ns-allinone-2.35/otcl-1.14:/home/pradeepkumar/ns-allinone-2.35/lib

Subscribe to my Youtube Channel
Installation of ns2 in Ubuntu 18.04
T S Pradeep Kumar

Gnuplot for Research

This post shows you how to plot using gnuplot for producing/creating graphs. Usually these graphs are used to publish in papers like journals/conferences.
Gnuplot tutorial on handling data files.


Installation of gnuplot 

$] sudo apt install gnuplot

Two files for plotting a graph in gnuplot 

File1: mydata.txt 
1 34.5 45 12000
2 36.4 34 24000
3 38.7 22 34000
4 32.3 18 43000
5 41.5 24 23456
6 35.6 36 12345
7 24.5 67 67987
8 56.7 54 45678
9 62.3 27 32123
10 65.4 33 8999

File2: mygnucode.plt

set terminal pdf

set output "pradeep.pdf"

set title "Drivers Data"

set xlabel "Number of Days"

set ylabel "Drivers Info"

plot "mydata.txt" using 1:2 with impulse title "Speed km/hr" lw 

2,"mydata.txt" using 1:3 with points title "Age" lw 2

set terminal png size 600,400

set output "salary.png"

set title "Drivers Data"

set xlabel "Number of Driver"

set ylabel "Drivers Salary"

plot "mydata.txt" using 1:4 with linespoints title "Salary in Rs." 

lw 2, 20000 title "Minimum Salary"

Please see the following video for step by step instructions. 
Gnuplot Tutorial - Research

Gnuplot video is successful to plot 2d graphs. 

please subscribe to my channel

Aquasim in ns3

This post shows you how to install aquasim in ns3. Aquasim is a simulator used for simulating underwater Wireless Sensor networks which was used with ns2 earlier, and now it is available for ns3 too.

OS Used: Linux Mint 18.1 or Ubuntu 16.04
Ns version used: ns-3.27

You should have installed ns3 before trying the following. Please follow the ns3 installation instructions here.

Open the terminal and give the following instructions.

$] cd ns-allinone-3.27/ns-3.27/src

$] git clone

$] cd ..

$] ./waf --enable-examples --enable-tests configure --disable-python

$] ./waf 

Once successful, you will get a screen like this which indicates that aquasim is installed successfully in ns3.
Aquasim in ns3

To test an example, go to the folder

~ns-3.27/src/aqua-sim-ng/examples/ and copy the file to the scratch/ folder and type the command to run the example.

$] cd ns-allinone-3.27/ns-3.27
$] ./waf --run scratch/broadcastMAC_example (give the name of the file correctly to run)
See the screenshot below, it looks like this.
Please look for the video that shows the explanation and installation of Aquasim in ns3.

T S Pradeep Kumar

ns3 installation in Ubuntu 16.04

This post serves the installation instructions of ns3 in ubuntu 16.04 version. Some of my students are working in ns3, this post will benefit them in installing ns3.

OS Used: Ubuntu 16.04.4
ns3 version: ns3 version 3.27

The same procedure will be applied for OS like Debian, Linux Mint.

Fresh installation of Ubuntu 16.04

Let you try the fresh installation of ubuntu in your hard disk along with windows.

Installation of ns3 dependencies

ns3 needs so many dependencies, developmental libraries, drivers, etc. so install all those

$] sudo apt update 
$] sudo apt upgrade

$] sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake p7zip-full python-matplotlib python-tk python-dev python-kiwi python-gnome2 python-gnome2-desktop-dev python-rsvg qt4-dev-tools qt4-qmake qt4-qmake qt4-default gnuplot-x11 wireshark

The above command make take some time to download, compile and install it, Be Patient. 

Installing ns3

Download the ns3 package from

I have used ns version 3.27 and the file looks like ns-allinone-3.27.tar.bz2.

You can unzip it in two ways. Right click over the above file and extract it to the folder (/home/pradeepkumar/). Most preferred place to install is to put it in the home folder.

go to the location of the download folder and copy the file to the home folder and open the terminal and give the command 

$]  tar jxvf ns-allione-3.27.tar.bz2
$] cd ns-allinone-3.27/
$] ./ --enable-examples --enable-tests

This will take sometime for getting compiled and build. Once the installation is successful, you will get a screen like given below.
ns3 installation
ns3 installation

This indicates that ns3 is built successfully.

To check any application is running. do the following steps 

$] cd ns-3.27/
$] ./waf --run hello-simulator
This will print the hello Simulator which indicates that ns3 is installed successfully.

Please see the following video to get more glimpse of how to install ns3. Please subscribe to

Subscribe to my Video Channel
T S Pradeep Kumar

Routing Protocol for Lossy Networks (RPL)

RPL protocol for Internet of Things is called as Routing Protocol for Low Power Lossy Networks. The following video depicts the use of RPL in Contiki OS with COOJA Framework.

The simulation was carried out using sky motes.  These are the modules that are used as firmware.

~contiki-2.7/examples/ipv6/rpl-border-router/border-router.c (This firmware is used for one of the sky mote)

~contiki-2.7/examples/skywebsense/skywebsense.c (this is programmed with other 5 nodes)

Please refer the video for more details.

T S Pradeep Kumar

Internet of Things - Presentation

The following three slides gives the importance of internet of things. These are basic slides that features

  • IoT Applications
  • IoT Communication Protocols 
  • RPL - Routing Protocol for Low Power and Lossy Networks

T S Pradeep Kumar

Network Simulator 2 - presentation Slides

I have gone across more than 80 institutions in the country to give hands on session, workshop, seminars related to network simulator 2. Mostly I will try different simulations, different models for simulation, etc.

But basically, every researcher/students needs some basics to get to know about ns2.

These slides make you understand the basics of ns2. Still in the country, there are so many universities uses ns2 as their simulated platform for the networking course, wireless networks course, etc. reading these slides make you know the basics of ns2.

These slides can be downloaded from my slideshare profile.

Introduction to Network Simulator 2

Installation of Network Simulator 2

Wired and Wireless Network Examples in ns2

OTCL and C++ Linkages in ns2

Recompiling Network Simulator 2

Mannasim for NS2

T S Pradeep Kumar

Error: Meta size 4064 too large (max = 1000)

Error: Meta size 4064 too large (max = 1000)

When using Mannasim Simulator for ns2, you may encounter this error when you are trying to run a tcl file with LEACH protocol. Here is a small workaround for the solution.

To install mannasim, please go here.

To overcome the above error, open the file
and change the following line

struct hdr_rca {
       int msg_type_;
       char meta_[1000];


struct hdr_rca {
       int msg_type_;
       char meta_[5000];

Since I get 4064 as meta size, i changed it to 5000, if you get more than 4064, then accordingly you can increase the meta size and compile it. 

Here is the important step to compile 

~ns-2.35 $] ./configure --with-tcl-ver=8.5
~ns-2.35 $] make

Sometimes simply typing make will compile, but the .object files would not be created. So use the above two steps.

Here is the screenshot.
Mannasim Meta Size Error

T S Pradeep Kumar

Installing Kali Linux Tools in Ubuntu or Linux Mint

Kali linux is a debian based and its not easy to configure it on a typical PC. If the machine is UEFI based, then Kali is tough to customize.

So what is the alternative....? Here is the answer: Katoolin

Its the name of the package system for installing the entire kali linux tools (Penetration Testing) in Ubuntu or Debian based system.

Here I am trying to install inside my Linux Mint

OS Used: Linux Mint 18.2 Sonya
Prequisites: Python 2.7
Always perform these steps after the installation of ubuntu or Linux Mint

$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev
$] sudo apt install git
$] git clone
$] sudo cp katoolin/ /usr/bin/katoolin
$] sudo katoolin

This will give various options as shown below
Fig 1 Katoolin
Fig 2 Katoolin

Select the option '1' to add Kali repositories and update
After it is done, Select "2" -> update
If you want to go to the previous menu type back

Fig 3 Katoolin
 In the above pic. Select 2 to View categories and you will get the screen as shown in the next image.
Select "0" to install all the applications.

This will install 1.3G to download and 3.5 GB space will be taken..
Fig 4 Katoolin

Fig 5 Katoolin
After the packages were downloaded, again run the command sudo katoolin to install the Kali Menu or Classical menu by pressing 4 or 3 respectively as shown in Fig. 2.

Once everything is installed, This is how the start menu of Linux Mint looks like
Fig 6 - Start Menu in Linux Mint

T S Pradeep Kumar

Contik OS - A Complete Video

Contiki OS is an operating system for wireless sensor networks. You can use this OS to generate object code for supported sensors.

Please look at this following video that tells

  • How to use Contiki OS
  • How to deploy the OS in to motes
  • How to create our own application using Protothreads
  • How to create a target code for a given Sensor node and etc...
Please comment below for any queries related to Contiki OS

T S Pradeep Kumar

Workshop on NS3 at VIT Chennai

Network Simulation using NS3 workshop is being conducted at VIT Chennai on 31st August and 1st September 2017. 
Please click the following link for registration:

Also check 

T S Pradeep Kumar

TCL installation error

In case, if ns2 have to be recompiled based on a new addition of protocol or agent, there should be an entry to the After the changes are made, the following things need to be done to compile the agents.

$] ./configure 
$] make 

but ./configure may throw an error as shown below like
"Configure: Error: Installation of Tcl Seems to be incomplete or not found"

tcl error
TCL Error
To correct this problem, please try the following

$] ./configure --with-tcl-ver=8.5 

The above works only after the successful installation of ns2. If you are installing ns2 for the first time refer this blog post

T S Pradeep Kumar

Introduction to Contiki OS

Introduction to Contiki OS

To install Contiki: Refer this post :

To Refer the Characteristics and comparison of Various OS, refer this Slides:

How to use Contiki OS for Sensor Simulation - A Detailed video is enclosed herewith.
It tells about
Oracle Virtual Box
How to create a Sensor mote using Contiki
How to write a new App in contiki
What are the different windows that categorise? and lot more. Refer this video

T S Pradeep Kumar