This semester I got an assignment from Wireless/Mobile Computing lecture. It's all about NS2, the most popular network simulator. Today I tried to install it on my Ubuntu 8.04. And, here is the story :)
1. Download ns-allinone-2.33.tar from here.
2. Place it in somewhere, e.g. /home/programmer, then extract it.
3. Download & install some packages from repository :)
4. Install the ns2
5. Edit some paths ==a
Put these lines on that file. Off course, you might change /home/programmer for it depends on where you extract ns-allinone-2.33.tar.
6. Validate it
7. (Optionally) Create a symlink, so that ns can be called from everywhere
8. Try to run it (and pray :)
Cheers!
1. Download ns-allinone-2.33.tar from here.
2. Place it in somewhere, e.g. /home/programmer, then extract it.
$ cd /home/programmer
$ tar -xvf ns-allinone-2.33.tar
3. Download & install some packages from repository :)
$ sudo apt-get install build-essential autoconf automake libxmu-dev
4. Install the ns2
$ cd ns-allinone-2.33
$ ./install
5. Edit some paths ==a
$ gedit ~/.bashrc
Put these lines on that file. Off course, you might change /home/programmer for it depends on where you extract ns-allinone-2.33.tar.
# LD_LIBRARY_PATH
OTCL_LIB=/home/programmer/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/programmer/ns-allinone-2.33/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=/home/programmer/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/programmer/ns-allinone-2.33/bin:/home/programmer/ns-allinone-2.33/tcl8.4.18/unix:/home/programmer/ns-allinone-2.33/tk8.4.18/unix
NS=/home/programmer/ns-allinone-2.33/ns-2.33/
NAM=/home/programmer/ns-allinone-2.33/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
6. Validate it
$ cd ns-2.33
$ ./validate
7. (Optionally) Create a symlink, so that ns can be called from everywhere
$ sudo ln -s /home/programmer/ns-allinone-2.33/ns-2.33/ns /usr/bin/ns
8. Try to run it (and pray :)
$ ns
Cheers!

Ha! Sama dong pake ns2, untungnya buat Mac ada package ns2 allinone precompiled universalbinary
ReplyDelete@raizamn:
ReplyDeleteWah, enak dong, mas, sudah ada yang bikin package .dmg nya..
Ntar deh klo sempet, ini mau iseng-iseng bikin package .deb untuk ns2 .. =D hehe..
Bila run %ns
ReplyDeletehasilnya ini, betul ke?
--------------------------
mbi@spp:~/ns-allinone-2.33/ns-2.33$ ns
Usage: host [-v] [-a] [-t querytype] [options] name [server]
Listing: host [-v] [-a] [-t querytype] [options] -l zone [server]
Hostcount: host [-v] [options] -H [-D] [-E] [-G] zone
Check soa: host [-v] [options] -C zone
Addrcheck: host [-v] [options] -A host
Listing options: [-L level] [-S] [-A] [-p] [-P prefserver] [-N skipzone]
Common options: [-d] [-f|-F file] [-I chars] [-i|-n] [-q] [-Q] [-T] [-Z]
Other options: [-c class] [-e] [-m] [-o] [-r] [-R] [-s secs] [-u] [-w]
Special options: [-O srcaddr] [-j minport] [-J maxport]
Extended usage: [-x [name ...]] [-X server [name ...]]
@mbi:
ReplyDeleteyup :)
1) I have installed ns2 on ubuntu 8.04. same like u.
ReplyDeletewhen i run %ns, the output is ;
Usage: host [-v] [-a] [-t querytype] [options] name [server]
Listing: host [-v] [-a] [-t querytype] [options] -l zone [server]
Hostcount: host [-v] [options] -H [-D] [-E] [-G] zone
Check soa: host [-v] [options] -C zone
Addrcheck: host [-v] [options] -A host
Listing options: [-L level] [-S] [-A] [-p] [-P prefserver] [-N skipzone]
Common options: [-d] [-f|-F file] [-I chars] [-i|-n] [-q] [-Q] [-T] [-Z]
Other options: [-c class] [-e] [-m] [-o] [-r] [-R] [-s secs] [-u] [-w]
Special options: [-O srcaddr] [-j minport] [-J maxport]
Extended usage: [-x [name ...]] [-X server [name ...]]
But i look at another source, the output must be %. So which one is right?
I'm very confuse......
2) If the output is right, what the basic command. What must i do to doing the simple example. I'am very new in this ns2..
@Anonymous:
ReplyDeleteplease use google to find any NS2 tutorial..
here I just give NS2 installation tutorial on Ubuntu..
moreover, I have no advance experience with NS2 :)
Everything was find, i got it validated but when is run ns, this is what i get:
ReplyDeletefabian@fabian-laptop:~$ ns
% ns
warning: using backward compatibility mode
wrong # args: should be {ns message ?args...?}
any ideas why?
hi,
ReplyDeletei install ns2.33 on ubunto 6.06 as you are mentionned, eveything is good but at the end of the installation i have this message:
tk8.4.18 installation failed
can you please help me ?
thanks
hi @ mbi and others who are getting the host stuff
ReplyDeletewhen entering ns at the cmd line, its because you have
a software called host installed on ur system, which is invoked by the cmd line option ns
SO just remove it by using sudo apt-get remove host
or you could invoke ns by using its absolute path.
Great description. Worked for me perfectly.
ReplyDelete@raizamn : ternyata dah gak isa didownload :(
ReplyDeletethnx buddy u proved to be a grrt help fr me...it wrkd
ReplyDeleteThanks a lot
ReplyDeleteHi, i have a problem with ns2. the tora code is not working when i try to simulate using tora.tcl.. while it does work for aodv and dsdv protocols. is it becuz the code from the ns2 package wrong? if so where can i get the correct code? i've been searching for it. and my proj just doesn't move!!
ReplyDeleteso pls help!!!!
thanks in advance
anggriawan, perfectly worked for me...just the output must be %, not some host...u should all remove that by apt-get removed host....
ReplyDeleteIt's feeling good to complete the 1st step....more to come...
Bon avant tous je tien a remercie infiniment celui qui a ecrit ce tuto; car vraimnt c trés intéréssent mais!!!!
ReplyDeleteaprés suivre toutes les étapes j'ai encore un autre probléme c que il me donne tjr ce mssg:
exemple.tcl does not exist, try again
Donc jai rien a compri il me dit que le fichier .tcl n'éxiste pas!!! malgré qu'il existe vraiment...
SVP si qlqun peux maider j'attend au plus tot la réponse et merci pour toute personne qui participe a m'aider...
Mon adresse mail c'est: ammarahmi@hotmail.com
thansk a lot, from morocco !
ReplyDeletekanapa ya, d kompi ki selalu eror pas install tcl nya.. binun
ReplyDeleteHi, the ORIGINAL post.. which suggests doing sudo apt-get ... has a minor correction. The command is to be writen AFTER doing cd ns2-allinone.
ReplyDeleteThanks a lot for the post. It works great.
ReplyDeletei use ur procedure but i didn't get %
ReplyDeletewah makasih Mas atas infonya, saya coba pake ns2 di CentOS tapi bingung waktu bikin path-nya
ReplyDeleteTernyata setelah dicoba pake langkah 5 tersebut tetep bisa:D
Thank you so much friend, your steps were so helpful for me, its working woooohhoooooooooooooooooo thank you
ReplyDelete