1. 1
INSTALLATION OF
NETWORK SIMULATOR 2
T S Pradeep Kumar
VIT Chennai
http://www.nsnam.com
http://www.pradeepkumar.org
Email: pradeepkumarts@gmail.com
2. 2
Installation
• The version taken here is ns-allinone-2.35.
• There are two types
• Build all at once (ns-allinone-2.35.tar.gz)
• Good for beginners as well advanced users
• Build from pieces (download individually and
build it)
• For advanced users.
3. 3
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
8. 8
Step 1
• tar zxvf ns-allinone-2.35.tar.gz
or
gzip -d ns-allinone-2.35.tar.gz
tar xvf ns-allinone-2.35.tar
• z – to decompress from gz
• x – extract
• v – verbose mode
• f – force (don’t ask whether to extract a file)
9. 9
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.35
• Execute the command ./install
• If the installation fails in the middle, then try to
install the Linux packages that are necessary to
run NS2.
10. 10
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)
• /home/user/.profile (for Linux Mint)
11. 11
Step 3
• Path should be set for two variables
• PATH
• LD_LIBRARY_PATH
• Example
• PATH=$PATH:$HOME:/home/pradeep/ns-
allinone-2.35/bin:/home/pradeep/ns-allinone-2.35/
tcl8.4.14/unix:/home/pradeep/ns-allinone-2.35/
tk8.4.14/unix
• export LD_LIBRARY_PATH=/home/pradeep/ns-
allinone-2.35/otcl-1.13:/home/pradeep/ns-
allinone-2.31/lib
12. 12
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)
13. 13
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
14. 14
What if installation is
unsuccessful?
• My website addresses for more than 25 distributions
like
• Ubuntu 8.04 to 16.04 (Latest)
• Fedora 9 to Fedora 23 (Latest)
• Linux Mint 13 to Linux Mint 18 (Latest)
• Redhat Linux Enterprise Linux or CentOS
So, Please refer http://www.nsnam.com for further information
15. 15
Examples in NS2
• To see examples, please go to this folder
• /home/user/ns-allinone-2.35/ns-2.35/tcl/ex
• There are huge number of examples for NS2
• To run a tcl file, following is the command
ns filename.tcl
• To run a nam file
nam filename.nam
16. 16
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