Search This Blog

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

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:

./ --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:

./ -c core

You are done with it!

Hope it helps.

Mohit P. Tahiliani

Comments (7)

can you send me the link of ubuntu 15.04 for install in Laptop
Sachin from Dharwad

hello sir, I want to code of sinkhole attack in ns3 using AODV routing protocol.pleace send me sinkhloe attack code or give me the idea ,how to modify the blackhole attack code in to sinkhole attack and AODV protocol modify.


Respected Sir,

when I run blackhole patch 3.20 , i found following error

pm@pm-WIV52H55-0062:~/ns3/ns-allinone-3.19/ns-3.19$ ./waf --run scratch/blackhole
Waf: Entering directory `/home/pm/ns3/ns-allinone-3.19/ns-3.19/build'
[1908/2233] cxx: scratch/ -> build/scratch/
[2218/2233] cxxprogram: build/scratch/ -> build/scratch/blackhole
Waf: Leaving directory `/home/pm/ns3/ns-allinone-3.19/ns-3.19/build'
'build' finished successfully (5.718s)
msg="Invalid attribute set (IsMalicious) on ns3::aodv::RoutingProtocol", file=../src/core/model/, line=70
terminate called without an active exception
Command ['/home/pm/ns3/ns-allinone-3.19/ns-3.19/build/scratch/blackhole'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run --command-template="gdb --args %s ").

Hello Sir!!

The same error i am getting while simulating Blackhole ns-3.25 patch.

Sir, kindly give some review to the error described by Patel Nillam ma'm.

Thanks & Regards,

HI sir,
I am watching your comments. Thanks for posting such useful comments. I have installed ns3.26 and ndnsim through your blog. Now ns3.27 version is released. Please provide the installation steps for ns3.27. I have checked the same withns3.26 steps, but it is showing error. kindly update me.

Hello sir

The code for nanonetwork is not run in ns-3
Please help me

Anupam Mishra

i am trying to install ns3 on ubuntu 15.10 but not able to do please help
/home/vibha/Pictures/Screenshot from 2017-11-09 12-48-32.png