Install Ns2 in Linux

Let’s take a look about the installation of network simulator 2 mainly in Linux over this article.

Ns2 Download in Linux

As the first process, we have to download the packages based on network simulator 2.35 from the below mentioned URL.

Link to Download Ns2

Following that, the downloaded packages are named as the ns-src-2.35.tar.gz and copy that into the Linux home folder to extract the commands which are highlighted in the following in the terminal.

cd ~/

tar -xvzf ns-src-2.35.tar.gz

As the matter of fact, all the files are extracted and they are saved in the folder which is named as ns-2.35.

Ns-2.35 Folder

Install Ns2.34 in Linux

Moreover, we have to install the Ns2.35 packages in Linux through executing the below mentioned commands.

cd ./ns-allinone-2.35/

sudo ./install

Source Code in Ns2.35

For your ease, we have highlighted some source code in the Ns2 simulation main file which is used to implement the Nam and Xgraph packages.

exec ./nam Spectrum_Sensing.nam &

exec ./xgraph -bar -brw 0.5 -t “Average Interference Ratio Graph” -x “No.of.SUs” -y “Average Interference Ratio” -bg white &

If you have any issues, you guys can reach us at any time to clarify your doubts based on the Ns2 installation.