Ns2 Installation in Ubuntu

At this moment, let’s discuss about the required steps for the installation of network simulator 2 in Ubuntu through this article.

Phase: I Ns2 Installation in Ubuntu

To the start, we have to install Ns2 in Ubuntu through opening the command window and executing the command which is highlighted in the following.

sudo apt-get update

Updating Packages

sudo apt-get install ns2

Installation of Ns2

sudo apt-get install nam

Installation of Nam

sudo apt-get install tcl

Installation of Tcl

Phase: II Creation of Ns2 Simulation in Ubuntu

To create the Ns2 simulation in Ubuntu, we have to create the main file along with source that have been highlighted in the following and store that with the file extension .tcl.

  • Ns2 code to define the object for network simulator, network animation and tracing

set ns [new Simulator]

set namf [open wired2.nam w]

$ns namtrace-all $namf

set tracef [open wired2.tr w]

  • Ns2 code for the creation of wired nodes

set n0 [$ns node]

set n1 [$ns node]

set n2 [$ns node]

set n3 [$ns node]

To this end, we hope that we have provided the required processes and steps to install the network simulator 2 in Ubuntu. If you guys have any queries, you can contact us.