You are on page 1of 17

INSTALLATION OF

NETWORK SIMULATOR 2
T S Pradeep Kumar
VIT University – Chennai Campus
http://www.pradeepkumar.org
tspembedded@gmail.com
Installation
• The version taken here is ns-allinone-2.34.
• There are two types
– Build all at once (ns-allinone-2.34.tar.gz)
• Good for beginners as well advanced users
– Build from pieces (download individually and
build it)
• For advanced users.
Requirements for NS2
• A Basic C compiler (GCC)
– This comes almost in all distros of Linux
• TCL/Tk
– This should be installed separately, default
installation does not carry these packages
• PERL Script
– This also comes default
• X11 Libraries
– This is helpful for running Network Animator (GUI)
– This also comes in the default installation
Step1:
Untar or unzip
the contents
Step 2:
Go to the folder
and execute
./install
command
Step 3:
Once
installation
completed, set
the path…
Insight…
Step 1
• tar zxvf ns-allinone-2.34.tar.gz
or
gzip -d ns-allinone-2.34.tar.gz
tar xvf ns-allinone-2.34.tar
• z – to decompress from gz
• x – extract
• v – verbose mode
• f – force (don’t ask whether to extract a
file)
Step 2
• Always use /home/<user>/ to install ns2
– Example I used /home/pradeep/
• Once untar is done, go to the concerned
folder using the command cd ns-allinone-
2.34
• Execute the command ./install
– If the installation fails in the middle, then try to
install the Linux packages that are necessary to
run NS2.
Step 3
• If the installation is success,
– NS2 will give the path information for you
– These path details to be updated and then we
can run ns, nam and xgraph
• Path settings will be done in this file
– /home/user/.bash_profile (for Fedora)
– /home/user/.bashrc (for ubuntu)
Step 3
• Path should be set for two variables
– PATH
– LD_LIBRARY_PATH
• Example
– PATH=$PATH:$HOME:/home/pradeep/ns-allinone-
2.31/bin:/home/pradeep/ns-allinone-
2.31/tcl8.4.14/unix:/home/pradeep/ns-allinone-
2.31/tk8.4.14/unix
– export LD_LIBRARY_PATH=/home/pradeep/ns-allinone-
2.31/otcl-1.13:/home/pradeep/ns-allinone-2.31/lib
Step 4
• Logout and login
• Go to terminal and type the command
– ns (a % symbol indicates the successful
installation of ns2)
– nam (a network animator window will be
opened)
What if installation is unsuccessful?
• Since there are different Linux distributions, not
all the Linux will do the same as above.
• Based on the
– GCC version incompatibility
– Unavailability of packages for a particular
distribution
– Backward incompatibility
– Updation or major changes in the software packages
May lead to unsuccessful installation
What if installation is unsuccessful?
• My website addresses for more than 8
distributions like
– Ubuntu 8.04,8.10,9.04,10.04,10.10,11.04
– Fedora 9,10,12 and 14
– Redhat Linux
So, Please refer http://www.pradeepkumar.org for
further information
Examples in NS2
• To see examples, please go to this folder
– /home/user/ns-allinone-2.34/ns-2.34/tcl/ex
– One can see more than 200 examples of various
networks
– To run a tcl file, following is the command
ns filename.tcl
– To run a nam file
nam filename.nam
Tracing
• To see the tracing file
– Either xgraph can be used (which comes along
with ns2)
– Third party software like “tracegraph” can be
used (but the support is stopped, still it is good to
predict the results)
• For installing tracegraph, refer my website for a video
tutorial
– gnuplot can be used
THANK YOU,
LET US MEET IN
THE NEXT
SESSION…

You might also like