Professional Documents
Culture Documents
Raheel Memon
System Software Laboratory
Myongji University, Yongin-si, South Korea
Step 1:
Download the ns2 software from <Link: http://www.isi.edu/nsnam/ns/ns-build.html>
I am using version ns-allinone-2.35 you may get the zip folder.
Step2:
Place the downloaded folder in /home/username folder. And unzip it. In my case I am using this
location: /home/raheel/ns-allinone-2.35
$
$
$
$
cd /home/raheel/Downloads
cp ./ns-allinone2.35 /home/raheel
cd ..
tar xvzf ns-allinone2.35
Step3:
Install dependencies
$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3
Step4:
Now, change the compiler type to gcc-4.3. Open the Terminal and change the directory to nsallinone2.35
$cd /home/raheel/ns-allinone-2.35/otcl-1.13
$gedit Makefile.in
Find the following line in code:
CC= @CC@
Comment this line using # sign
#CC= @CC@
And write a new line below that line
CC= gcc-4.3
Step5:
Start installation
Change the directory to (root user #)
# cd /home/raheel/ns-allinone-2.35
#. /install
Note: root user #
Step6:
At the end of installation you will get an IMPRTANT NOTICE that you must put some paths to your
environment variables
NOTE: replace user name with your user name in path variables.
Congratulations you have successfully completed the installation of NS2 in ubuntu.
Simple Example:
set ns [new Simulator]
proc finish {}
{
global ns tracefile nf
$ns flush-trace
close $nf
close $tracefile
exec nam out.nam &
exit 0
}
'finish' procedure
Scheduling Events
- $ns at 1.0 start
and at 3.0 finish
$ns run
References:
1. http://www.isi.edu/nsnam/ns/ns-build.html
2. Introduction to Network Simulator NS2 by Teerawat Issariyakul , Ekram Hossain
3. http://www.anand-iyer.com/blog/?p=22
4. http://csis.bits-pilani.ac.in/faculty/murali/resources/tutorials/ns2.htm