Pages

Showing posts with label ns-2. Show all posts
Showing posts with label ns-2. Show all posts

Monday, February 13, 2012

Installing ns-2.35 on Ubuntu 10.04

A lot of people dread having to install ns2. Well here is a simple tutorial to get you through in just a single go. Mostly people fail at installing ns2 in the first go because of the missing libraries and dependencies.

Here is what you do to install ns2 in the first go.

1. Download ns-allinone-2.35

2. cd into the directory where you have downloaded the ns-allinone-2.35.tar.gz file.
tar -xvzf ns-allinone-2.35.tar.gz

3. Next you need to install the required libraries

sudo apt-get install autoconf automake gcc g++ build-essential libxmu-dev libtool libxt-dev 

6. Now cd into the ns-allinone-2.35 directory and do ./install , hopefully everything will go smoothly and you ns-2 will be installed. But before you can proceed you need to set the environment variables.

gedit ~/.bashrc
copy the following lines at the end of the file, be sure to change /your/path to the path where ns is installed on your system.

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.35/otcl-1.14
NS2_LIB=/your/path/ns-allinone-2.35/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your/path/ns-allinone-2.35/bin:/your/path/ns-allinone-2.35/tcl8.5.10/unix:/your/path/ns-allinone-2.35/tk8.5.10/unix
NS=/your/path/ns-allinone-2.35/ns-2.35/
NAM=/your/path/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM

for instance on my system i would replace /your/path with /home/z3d

9. source ~/.bashrc to have the changes take effect or you can simply reopen terminal.

10. Now cd into the folder /ns-allinone-2.35/ns-2.35/ and type the command ./validate
it will take a considerably longer time than it did to install and in almost an hour you should get a message all tests successful.

11. Now you can type ns and begin doing your work :)

Sunday, August 22, 2010

Otcl and ns2

I have been receiving emails on how to run otcl code. In order to run ns2 code you need to have ns2 installed which is already installed in the lab. In case you wish to install it on your home PC's, you can refer to the following post regarding installation instructions. http://zaidmunir.blogspot.com/2010/06/installing-ns2-on-ubuntu-910.html

Tuesday, August 17, 2010

DCN lab 2 - FALL 2010

In this lab we will be learning tcl and Otcl. The lab manual has been placed at the photocopier you are supposed to fill it up and submit it by the end of today's lab.

You can google and follow any tutorial on tcl that you wish. A list of tcl tutorials is also given here:

1. http://www.tcl.tk/man/tcl/tutorial/tcltutorial.html
2. http://users.belgacom.net/bruno.champagne/tcl.html

Sunday, June 27, 2010

Installing ns-2 for multiple users

There are a few tips that might save you considerable time and irritation if you follow them.
  1. Firstly, never install ns-2 in the home folder, make a folder at "/" for installing applications, for instance "/Apps" in this case.
  2. Installing for multiple users is no big deal, just install it like you would for a single user, if you are looking for Ubuntu install instructions you can refer to my earlier post http://zaidmunir.blogspot.com/2010/06/installing-ns2-on-ubuntu-910.html you just need to prefix the commands mentioned in the link with a sudo :)
  • After installing it just make a minor change, instead of making changes to the ~./bashrc file make the same changes to /etc/bash.bashrc if you are using Ubuntu or /etc/bashrc for other flavours of Linux.
  • Now go the user which is most probably a "desktop user" you can switch environments without having to log off using the command "su username -" and enter password when prompted for it. Now you would be in the username's environment. now if you run ns-2 it would run but when you run the validation checks, it would fail. This is because the folder that you created at root does not have write privileges by default. You can change this issuing the command "sudo chmod -Rf +w /Apps/ns-allinone-2.34" or you can use "sudo chmod -Rf 777 /Apps/ns-allinone-2.34" this would cause the specified folder and its subfolder to have wrx permissions for all users.
  • Now you can run the validation tests and in a while you should get an all tests passed message. Whola, you are ready to go. By following this method all the users can run ns-2 without any issue. :)

Friday, June 25, 2010

Installing ns2 on Ubuntu 9.10

A lot of people dread having to install ns2. Well here is a simple tutorial to get you through in just a single go. Mostly people fail at installing ns2 in the first go because of the missing libraries and dependencies.

Here is what you do to install ns2 in the first go.

1. Download ns-allinone-2.34

2. cd into the directory where you have downloaded the ns-allinone-2.34.tar.gz file. Then issue the command cp ns-allinone-2.34.tar.gz ~/

3. Then type cd ~/ to get into your home folder

4. Then use the command tar -xvzf ns-allinone-2.34.tar.gz

5. But before you can continue you need to install the following libraries

autoconf
automake
gcc
g++
build-essential
libxmu-dev
libtool
libxt-dev

6. You can download and install the libraries individually using the command sudo apt-get install libraryname e.g
sudo apt-get install autoconf

7. Now you are all set to proceed, but before you do there is one more modification that needs to be made, cd into ns-allinone-2.34/otcl-1.13 and then use the command gedit configure to make the following changes to the configure file.

change the following line
SHLIB_LD = "ld -shared" to SHLIB_LD = "gcc -shared", you would find that the string SHLIB_LD occurs at many places, you are to change the one that is written under Linux*)

OR you may try typing export CC = gcc-4.3 to change the environment variable, though i have not tried this seemingly easier method. (note: run the command gcc -v to check your version to use in the above command)

8. Now cd into the ns-allinone-2.34 directory and do ./install , hopefully everything will go smoothly and you ns-2 will be installed. But before you can proceed you need to set the environment variables.

gedit ~/.bashrc

copy the following lines at the end of the file, be sure to change /your/path to the path where ns is installed on your system.

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your/path/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your/path/ns-allinone-2.34/bin:/your/path/ns-allinone-2.34/tcl8.4.18/unix:/your/path/ns-allinone-2.34/tk8.4.18/unix
NS=/your/path/ns-allinone-2.34/ns-2.34/
NAM=/your/path/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

for instance on my system i would replace /your/path with /home/z3d

9. source ~/.bashrc to have the changes take effect or you can simply reopen terminal.

10. Now cd into the folder /ns-allinone-2.34/ns-2.34/ and type the command ./validate
it will take a considerably longer time than it did to install and in almost an hour you should get a message all tests successful.

11. Now you can type ns and begin doing your work :)