![]() |
Tutorial: Ns-2.33 (and nam) on Ubuntu 8.04 (Hardy Heron) |
Since I have been working with ns2 for the last few months in preparation for my thesis I have decided to write a guide on how to install the most recent version of ns2 on the most recent version of ubuntu (at the time of this writing, Monday June 9th, 2008).
I have found many people already who have had difficulty setting it up so maybe this will be of some help to someone. For this tutorial I am assuming you have installed the most recent version of Ubuntu (8.04). (At the time of writing)
Step 1: Update Ubuntu
Since it has already been a month or so since Hardy Heron has been released its probably best, if you haven’t already done so to update Ubuntu. The easiest way I’ve found is to go to System>>Administration>>Update Manager. Alternatively, you can enter this into the terminal:
sudo apt-get update
sudo apt-get upgrade
Step 2: Download all of the required pieces to make ns2 work
Here is a list of archives required for ns2 to work properly (you can download them by clicking the links or just enter all of the commands in the code sections below for automatic download and untar). I saved each archive to the desktop so I could find each one easily but you could use anywhere you like.
Step 2.5: Install Ubuntu Packages
Before installing everything else, I have found that it is helpful to get a few packages from the ubuntu repositories or else it wont build correctly. Grab a cup of coffee it might take a while since kdebase-dev is somewhat large. I’m sure there is a way to do this with fewer packages however I know this works. If anyone figures out exactly which packages are required let me know so I can update this.
sudo apt-get install libx11-dev kdebase-dev
Step 3: Install tcl
wget http://www.jasonernst.com/wp-content/uploads/2008/06/tcl8.4.19-src.tar.gz
tar xvf tcl8.4.19-src.tar.gz
cd tcl8.4.19/unix
./configure
make
sudo make install
Step 4: Install tk
cd ..
cd ..
wget http://www.jasonernst.com/wp-content/uploads/2008/06/tk8.4.19-src.tar.gz
tar xvf tk8.4.19-src.tar.gz
cd tk8.4.19/unix
./configure
make
sudo make install
Step 5: Install oTcl
Important Note: The ‘./configure –with-tcl=’ portion of the following two code fragments should point to the source files for tcl. If you have been following the guide by copying and pasting the previous commands what we have here will work just fine. Otherwise you will need to change this to point to the correct location of your tcl source files.
cd ..
cd ..
wget http://www.jasonernst.com/wp-content/uploads/2008/06/otcl-src-1.13.tar.gz
tar xvf otcl-src-1.13.tar.gz
cd otcl-1.13
./configure --with-tcl=../tcl*/
make
sudo make install
Step 6: Install tclcl
cd ..
wget http://www.jasonernst.com/wp-content/uploads/2008/06/tclcl-src-1.19.tar.gz
tar xvf tclcl-src-1.19.tar.gz
cd tclcl-1.19
./configure --with-tcl=../tcl*/
make
sudo make installStep 7: Install ns2
cd ..
wget http://www.jasonernst.com/wp-content/uploads/2008/06/ns-2.33.tar.gz
tar xvf ns-2.33.tar.gz
cd ns-2.33
./configure
make
sudo make install
You will likely get alot of warnings for deprecated conversions. Just ignore these or if you really are concerned about them visit the nsnam troubleshooting page. If you want to make sure your version of ns-2 is working correctly after the install you can run the validation test from within the ns2 source directory. You can do this by entering:
./validate
You should see that the test output agrees with the reference output. Congratulations you have a working version of ns-2 installed.
Step 8: (optional) Install nam
cd ..
wget http://www.jasonernst.com/wp-content/uploads/2008/06/nam-src-1.13.tar.gz
tar xvf nam-src-1.13.tar.gz
cd nam-1.13
./configure
make
sudo make install
Note: if you get this error:
error: X11/Xmu/WinUtil.h: No such file or directoryit may be necesary to do this:
sudo apt-get install libxmu-devYou are now ready to start working with ns2 and nam. If you are like me and working on a new protocol or something you will want to start modifying the ns-2 source code and recompile again so you might want to keep that folder handy. The rest of the source can be safely removed as far as i know. Keep in mind after you have modified the source you will want to do another make install so that when you type ns in your terminal the version you just compiled is used.
Getting Started with NS2
These are some quick tips to get you started using ns2 if you are a beginner.
All example files are located in ns/tcl/ex. You can run these scenarios on ns2 using ns filename.tcl The best way to start is probably changing things in these files until you understand what is happening more thoroughly.
The output will usually be a trace file with a similar name: ex) filename.tr. Trace files can usually be viewed with a text-editor program. There are also tools to analyze the trace files and pull stats from them. These may require some tweaking however depending on the format of the trace file. Additionally, a nam output file for visualization may be generated as well. This will usually be named filename.nam. To view the visualization use: nam filename.nam
Useful Links
I thought it might be useful to add a section on useful links here since this article has become quite popular. If you would like to suggest a link feel free to contact me.
- Ns2 Wiki
- Marc Greis’ Tutorial
- NS Manual
- NS for Beginners (pdf)
- Common NS2 Installation Problems
- NS2 Wireless and Mobility Modules
- NS2 Mailing Lists
- NS2.33 Wireless MAC and PHY improvements
Previous: « Fair Scheduling & Load Balancing in WMN
103 Responses to Tutorial: Ns-2.33 (and nam) on Ubuntu 8.04 (Hardy Heron)
Leave a Reply
Leave a Reply
Recent Articles
Creating a Bluetooth Access point (NAP) in Ubuntu 11.10
November 29, 2011
A Bluetooth NAP is similar to a Wi-Fi access point. In this case, we will...
Burg / Grub 2 Icons for Meego
November 29, 2011
Only recently I noticed that Moblin (which I sometimes use) has changed...
Aircrack suite + Ubuntu 11.10 problems with monitor mode...
November 4, 2011
Recently I have been playing around with the aircrack suite and in...
Upcoming PhD QE Progress
July 27, 2011
So I've been doing my PhD for over two years now, and I haven't posted a...
Why Blanket Wireless Coverage in Waterloo Failed, and...
July 22, 2011
Today the KW Record ran an article entitled "Blanket Wi-Fi plans unplugged...
Windows 7 – SP1, Multiple OS – Grub
July 17, 2011
A while ago I bought a Toshiba netbook which of course came with Windows 7...








June 11, 2008

Categories:
Tags: 










Sitemap
Valid XHTML
Valid CSS
Login
@ Nara: I have never encountered that problem before, however from what you have posted it looks like there is some kind of problem with X or whatever display environment you are using. You may want to try posting into the ns mailing list with this problem. Also when you post you will likely want to provide information on what version of linux you are using and any extra details you can think of that may be useful.
Hello, i have tried to install OLSR in ns2.33, i follow the steps in:http://masimum.dif.um.es/?Software:UM-OLSR:Installation ; but when i run a script i get:
num_nodes is set 3
(_o14 cmd line 1)
invoked from within
“_o14 cmd addr”
invoked from within
“catch “$self cmd $args” ret”
invoked from within
“if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error “error when calling class $cls: $args” $…”
(procedure “_o14″ line 2)
(SplitObject unknown line 2)
invoked from within
“_o14 addr”
(“eval” body line 1)
invoked from within
“eval $node addr $args”
(“default” arm line 2)
invoked from within
“switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 “$node start-dsr”
}
AODV {
set ragent [$self cre..."
(procedure "_o3" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns_ node"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}”
thank you!
Great post. Got this from google.
Thank you.
hello ,
i want to install ns-2.27 on my ubuntu8.04, i’ve follow the last tutorial: http://sara.kw.ac.kr/?document_srl=661
but when i tape make, i have too message of warning:
common/packet.h:230: attention : deprecated conversion from string constant to «char*»
almost in every line!
when i want to execute wireless.tcl i have this result:
num_nodes is set 50
INITIALIZE THE LIST xListHead
Loading connection pattern…
Loading scenario file…
Load complete…
Starting Simulation…
channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS …DONE!
NS EXITING…
note wireless.tcl is in tcl/ex.
.
please can anyone help me, i need it for my final project of studies in 3 week
thank you in advance.
It looks like from your output is has finished executing successfully, you just need to look for a .tr (trace) file to see the output of the experiment. You can view this with any text editor. Additionally, there may have been a .nam file which will allow you to “see” what happened in the simulation as well by using the nam tool (if you have installed it)
hi jason,,
im working my final project about scheduling algorithm in wimax,, im using nist wimax module,, but i confused how to add or implementing new scheduling algorithm,, am i have to change the .cc or .h to implementing new algorithm ? or i just working on .tcl to add new scheduling alghrtm? which file i should editing, or adding? so i can focus on one subject to learn,,
i am sorry for bothering you,, i really need your advise,, thank you
Hi Gesit, I am not too familiar with the wimax module you are talking about so I can’t comment specifically, however I would recommend trying to make changes to the existing code first (you may need to change both cc and h files depending on what you are trying to accomplish). I have not done too much work yet in ns2, I have been focusing mostly on ns3. However in ns3 I did my scheduling work at the mac layer, so that may be a place to start to look for trying to modify the wimax module you are talking about.
Thank you for your advice mr Jason,, yes there are files name BSscheduler.cc ,, and my algorithm work in mac layer too, im trying to run simulation in downlink mode with PMP topology ,, i am using proportional fairness algorithm, but the default algorithm which has had implemented before is Weighted Round Robin,, but now after i knew how to start then i will focusing in C++ learning, thanks again mr Jason, hopefully you will success for your work and research, i will report you about my final project progress next time,, but if you are not mind off course :p
Hi,
I would like to know whether we need any patches to install in ns2.33
for wireless sensor networks?(I mean for ns 2.29 we install mannasim patch)
Hi ava, I’m not sure if you need a patch for ns2.33 and WSN, I have not had any experience yet with sensor network simulation so I haven’t explored this myself. You could always take a look at the source yourself and see if it includes what you need.
hi jason
i’m using ns2.33 installed in xp with cygwin and i try to install program antnet by lavina jain in ns2.33, i follow all the steps she gave and my problem started when i edit the Makefile :
OBJ_CC = \
tools/random.o tools/rng.o tools/ranvar.o common/misc.o common/timer-handler.o \
* . . *
antnet/antnet_common.o antnet/antnet_rtable.o antnet/antnet.o \
$(OBJ_STL)
then i did these:
$ touch common/packet.cc
$ make
and after i run make i got this message:
make[1]: Nothing to be done for `all’.
make[1]: Leaving directory `/usr/local/ns-allinone-2.33/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/ucb’
what is my problem??what is the meaning ‘ Leaving directory `/usr/local/ns-allinone-2.33/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/ucb’ ??? i can run tcl script from marc greis which i don’t put the scripts not in ns2.33 directory but i can’t run her tcl script ( i put the program in ns2.33 directories as her instruction) . i already try to ./configure, make , make install but nothing change. Please give me solution what to do
it sounds like something is wrong with your makefile and it no longer knows what to do for the “make all”
i install ns2.29.3 on ubuntu and got no problem even upto the command ns and i get the % on the terminal. but When I run validate, it reports like this:
“validate overall report: some tests failed: ./test-all-red
to re-run a specific test, cd tcl/test; ../../ns test-all TEST-NAME
Notice that some tests in webcache will fail on freebsd when -O is turned on.
This is due to some event reordering, which will disappear when -g is turned on.”
please help me to get out from this problem i have tried to install ns2 for a number of times since a week.
and also tell me the link where can i download examples of WLAN and LAN simulations for ns.
I have never encountered a failed validation yet myself. You could try to re-validate the specific test using the method mentioned in the error message to double check it without having to re-run all of them. If it still fails I would try posting to the ns2 mailing list or at least do a google search for the particular failed test. Maybe you can find someone else with a similar problem. As for the examples of WLAN and LAN just look through the source code folders, there should be one that has many scenario files (i think its somewhere like /tcl/examples or /ex/tcl or something. There you will find all different types of scenarios.
I would like to create forms using tcl/tk on NS 2.33 and ubuntu 8.01 to allow the user of the system to enter parameter like packet size, number of nodes to make the system more user friendly.
Create mobile nodes, show communication by flashing of nodes, calculate bandwidth, delay and packey loss and show these on X graphs.
Show mobility of nodes on NAM.
If you have a single code that does the above please email me using the above address
Please assist.
Regards,
Lisa
As far as I know NAM already supports visualization of mobility, I have done some experiments myself with mobility and there is no problem. For the forms you are looking for, I am assuming you mean forms that are displayed in a browser? For this I don’t know of any existing tools for this, although I am interested in something like this as well, it would make it much easier to input and change simulation values rather than having to edit scenario files constantly. Let me know if you find anything, or would like to start some kind of module for this. Maybe we can collaborate on something.