Sunday, September 7, 2014

NS2 Installation and Running in Ubuntu 12.04

Network Simulation(NS) is very useful in simulating network and analysing various parameters of a wireless network or wired network. The simulator allows you to test the working of various protocols.
Preferable OS is Linux. If you want to run through windows, then help of cygwin can be taken.
I have ubuntu 12.04 with me.

Step1:
Download ns-2allione from here .A zip file will be downloaded.

Step2:
Go to corresponding directory of download and run the following command for unpacking.
tar -zxvf ns-allinone-2.35.tar.gz

Step3:
Install few of the prerequisite libraries

sudo apt-get install tcl8.5-dev tk8.5-dev --fix-missing
sudo apt-get install build-essential autoconf automake --fix-missing
sudo apt-get install perl xgraph xorg-dev libxt-dev libx11-dev libxmu-dev --fix-missing

Step4: Run the installation set up file
cd your_path_to_directory_of_download/ns-allinone-2.35
./install


Step5: Couple of library paths has to be added to the PATH,LD_LIBRARY_PATH & TCL_LIBRARY_PATH env variables.
libray paths will be given if its installed properly in the step4.
and run the following commands by filling appropriate library paths

export PATH=$PATH:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/bin:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/tcl8.5.10/unix:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/otcl-1.14:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/lib

export TCL_LIBRARY=$TCL_LIBRARY:/home/user/achuth/WirelessSensorNetworks/ns-allinone-2.35/tcl8.5.10/library


Your Installation is done !!!

Step5:Execute the following commands to validate the simulation.
cd ns-2.35
./validate


Step6: Download Network Animator and ns.
sudo apt-get install nam
sudo apt-get install ns

Step7: Download the code from internet of any protocol with extension .tcl and run
    ns eg1.tcl
Now, three files will be generated,
with extensions like, testeg.nam, testeg.tr,win.tr

After this run,
nam testeg.nam

Now simulator will be launched, and you are good to explore !!


Thanks
Achutha

No comments:

Post a Comment

What it takes for a 100 day WorkOut Streak !

 Those who know me know that I am a great believer of consistency. I strongly believe that with consistency anything under the sun can be ac...