HOW TO Install NS 2.34 PACKAGES IN UBUNTU

To import ns 2.34 packages in NS2 we provide assistance. Our developers can also offer you excellent project ideas and guidance on how to implement them in your research tailored to your interest. Network Simulator 2 (NS2) is a well-known open-source tool for simulating network events. It was first created under the VINT (Virtual Inter-Network Testbed) project. NS2 helps users simulate different network protocols, routing methods, and traffic types. With this simulator, users can create custom network designs and analyze protocol performance using detailed statistics. NS2 remains an essential tool in network simulation, supporting advancements in areas like mobile networking, the Internet of Things (IoT), and protocol creation.

PRE-REQUISITES:

  1. Fresh installation of Ubuntu 16.04 LTS:

Screenshot:

Fresh installation of Ubuntu 16.04 LTS

2.Download ns-allinone-2.34.tar.bz2 file:

We have to download the ns-allinone-2.34.tar.bz2 under home directory by the clicking the Link, it will directly download to Download Location and move the compressed file to the home Directory.

Link:- https://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz/download

Screenshot:

Download ns-allinone-2.34.tar.bz2 file

3.Extraction of the ns-allinone-2.34.tar.bz2 file:

Next, we have to extract the compressed file by right click and click Extract here to extract the ns-allinone-2.34 as folder in the home directory.

Screenshot:

Extraction of the ns-allinone-2.34.tar.bz2 file

Screenshot:

Extraction of the ns-allinone-2.34.tar.bz2 file

ns-allinone-2.34 compressed file Extracted Successfully in the home directory.

INSTALL DEPENDENCIES OF NS2:

  1. Open a terminal, Copy and Paste the commands to install required package:

Screenshot:

Open a terminal, Copy and Paste the commands to install required package

2.System File Update Command:

First of all, we need to updates the list of available packages and their versions stored in the system’s package index. Use below command to update the system package.

Command:      “sudo apt-get update”

Screenshot:

System File Update Command

3.Install Essential Tools:

    1. build-essential: A package containing essential tools for compiling software on Ubuntu, including GCC, g++, and make.
    2. autoconf: A tool for automatically configuring source code packages to adapt to various UNIX-like systems.
    3. automake: A tool that automatically generates Makefile.in files, simplifying the creation of portable makefiles.
    4. libxmu-dev: A development package for the X11 Athena Widget library, providing miscellaneous utility functions for X Window System programs.

Command:      “sudo apt-get install build-essential autoconf automake libxmu-dev” 

Screenshot:

Install Essential Tools

Click the key Y to install the required Essentials tools for giving permission to install the package in the user system.

Screenshot:

Install Essential Tools

Installation of the Essential tools package completed successfully. 

INSTALL NETWORK SIMULATOR 2 (NS2):

  1. Locating the ns-allinone-2.34 Folder:

Next, we need to install the NS 2 in our system so locate the Extracted ns-allinone-2.34 folder in the home directory.

Screenshot:

Locating the ns-allinone-2.34 Folder

2.Launching the terminal in the ns-allinone-2.34 Folder:

Then Right Click in the current Directory and select the “Open in Terminal” button and it will launch the terminal.

Screenshot:

Here, we launched the terminal by that button in the folder.

Screenshot:

Launching the terminal in the ns-allinone-2.34 Folder

3.Modification of ns2.34 Code:

Next, we need to modify the Ns-2.34 to install the network simulation 2 Environment in the User system and it will resolve some dependency errors. First of all, locate to the Ns-2.34 folder.

Command:      “cd Ns-2.34”

Screenshot:

Modification of ns2.34 Code

Next, we need to edit the ls.h file in the Ns-2.34 with gedit command.

Command:      “cd linkstate && gedit ls.h

Screenshot:

Modification of ns2.34 Code

 

Screenshot:

Modification of ns2.34 Code

Next, the code this-> is added to the line 137 and before the erase (basemap::begin(), baseMap::end()) code.

Screenshot:

Modification of ns2.34 Code

Next, we need to edit the ranvar.cc file in the Ns-2.34 with gedit command.

Command:      “cd tools && gedit ranvar.cc

Screenshot:

Modification of ns2.34 Code

Screenshot:

Modification of ns2.34 Code

Next, In the code line 219 by removing this line “return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);” and add this line “return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);”

Screenshot:

Modification of ns2.34 Code

Next, we need to edit the mac_802_11Ext.h file in the Ns-2.34 with gedit command.

Command:      “cd mac && gedit mac_802_11Ext.h

Screenshot:

Modification of ns2.34 Code

Screenshot:

Modification of ns2.34 Code

Next, add “#include <stddef.h>” in  line 66.

Screenshot:

Modification of ns2.34 Code

Next, we need to edit the nakagami.cc file in the Ns-2.34 with gedit command.

Command:      “cd mobile && gedit nakagami.cc

Screenshot:

Modification of ns2.34 Code

Screenshot:

Modification of ns2.34 Code

Next, In the code line 183 by removing this line “resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();” and add this line “resultPower = ErlangRandomVariable(Pr/m, int_m).value();”

Screenshot:

Modification of ns2.34 Code

Next, In the code line 185 by removing this line “resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();” and add this line “resultPower = GammaRandomVariable(m, Pr/m).value();”

Screenshot:

Modification of ns2.34 Code

4.Installing Ns-2.34 by the terminal:

Next, we need to install the network simulation 2.34 Environment in the User system and it. So, use the command to install the ns-2.34 in the ns-allinone-2.34 folder location.

Command:      “./install”

Screenshot:

Installing ns-2.34 by the terminal

Ns-2.34 Configuration process:

Screenshot:

Ns-2.34 Configuration process

The configuration of the Network Simulator 2 (NS-2) environment. This command is typically used to set various parameters, such as the simulation duration, network topology, and node properties. It can also be used to specify the output format and other simulation settings.

Screenshot:

Ns-2.34 Configuration process

Ns-2.34 Configuration Completed successfully.

Ns-3.25 Building process:

Screenshot:

Next, Building the Network Simulator 2 (NS-2) framework from its source code. When use this command, It will compiles the source code, generates the Makefiles, and builds the NS-2 binary and libraries and make Runnable Environment.

Screenshot:

Ns-2.34 Building process

Ns-2.34 Installed successfully in the Ubuntu 16.04 system.