Update Manager - Ubuntu Hardy Heron

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
Update Manager - Ubuntu Hardy Heron

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.

  1. tcl 8.4.14
  2. tk 8.4.14
  3. otcl 1.13
  4. tclcl 1.19
  5. ns 2.33
  6. nam 1.13

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 install

Step 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 directory

it may be necesary to do this:

sudo apt-get install libxmu-dev

You 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.

 

103 Responses to Tutorial: Ns-2.33 (and nam) on Ubuntu 8.04 (Hardy Heron)

 
  1. Hari says:

    Hi……..I m implementing LEACH…I used your ns2leach.. I get an error .."$env (RCA_LIBRARY) cant read variable error in ns-2.27" pls help me wat the error is about

  2. Hassan says:

    I installed fresh copy of Ubuntu 8.04 (not able to find 8.10 in archives of ubuntu site) and trying to install ns2.29. I am getting hell lot of errors. Am I missing something like patches or installation of packages on Ubuntu before installing ns2.29 ?
    Your urgent help will be highly appreciated.

  3. ka346 says:

    Hi Jason,

    I’m trying to clone AODV to in order to implement a new security algorithm on it. I have made all the necessary changes as mentioned in http://masimum.dif.um.es/nsrt-howto/html/node1.html

    But it is still shooting a compilation error when I type make. It says “In file included from mepa/mepa_logs.cc:31:
    ./mepa/mepa.h: At global scope:
    ./mepa/mepa.h:220: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:223: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:224: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:231: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:232: error: expected ‘;’ before ‘(’ token
    ./mepa/mepa.h:253: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:275: error: ‘mepa_rt_entry’ has not been declared
    ./mepa/mepa.h:282: error: ‘mepa_rtable’ does not name a type
    ./mepa/mepa.h:283: error: ‘mepa_ncache’ does not name a type
    ./mepa/mepa.h:298: error: ‘mepa_rtable’ does not name a type
    make: *** [mepa/mepa_logs.o] Error 1″

    How do I deal with this error? Please help me solve this issue!

    Thank you so much for your help!
    ka346

    • Jason Ernst says:

      Hey, it looks like you are missing a declaration for mepa_rt_entry. I’m guessing its a part of a struct definition somewhere, so look to make sure you have it defined, or that you aren’t missing a semi-colon somewhere near it.

  4. ka346 says:

    Jason,

    Thanks for the reply. :) I have tried running the code in another C++ compiler. It doesn’t give me any errors there. It says the error is in global scope. Is there any common .h file that I am missing. I have recently started working on ns 2.33 and have limited understanding of it’s architecture. Can you please help me figure out this error?

    Ka346

  5. Vivek says:

    Hi Jason thanking you for ur effort.
    I have installed ns2.29 and ns2.33 in ubuntu 9.04

    Now I need to wireless sensor network simulation in ns-2.

    By googling i came to know about mannasim ,but after applying patch I am facing The error
    error:
    >
    >
    > In file included from mannasim/processing.h:44,
    >
    > from
    > mannasim/accessPointApp.h:45,
    >
    > from
    > mannasim/accessPointApp.cc:37:
    >
    > mannasim/sensorNode.h:36:18: error: list.h: No such file or
    > directory
    >
    > In file included from
    > mannasim/processing.h:45,
    >
    > from
    > mannasim/accessPointApp.h:45,
    >
    > from
    > mannasim/accessPointApp.cc:37:
    >
    > mannasim/sensedData.h:41:20: error: vector.h: No such file or
    > directory
    > In file included from
    > ./common/agent.h:41,
    >
    > from
    > mannasim/accessPointApp.h:40,
    >
    > from
    > mannasim/accessPointApp.cc:37:
    >
    > ./common/packet.h: In constructor
    > ‘p_info::p_info()’:
    >
    > ./common/packet.h:184: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:185: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:186: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:187: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:188: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:189: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:190: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:191: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:192: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:193: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:194: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:195: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:196: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:197: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:198: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:199: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:200: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:201: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:202: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:203: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:205: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:206: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:207: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:208: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:209: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:210: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:212: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:213: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:214: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:215: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:216: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:217: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:218: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:219: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:220: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:221: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:222: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:223: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:224: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:225: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:227: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:228: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:230: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:231: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:232: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:235: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:238: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:241: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:244: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:247: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:250: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:254: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:258: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:259: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:261: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:262: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:265: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:268: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:271: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:274: warning: deprecated conversion from string constant
    > to ‘char*’
    > ./common/packet.h:276: warning: deprecated conversion from string constant
    > to ‘char*’
    > In file included from
    > mannasim/processing.h:44,
    >
    > from
    > mannasim/accessPointApp.h:45,
    >
    > from mannasim/accessPointApp.cc:37:
    > mannasim/sensorNode.h: At global scope:
    > mannasim/sensorNode.h:48: error: expected initializer before ‘ mannasim/sensorNode.h:73: error: ‘AppList’ does not name a type
    > In file included from mannasim/processing.h:45,
    > from mannasim/accessPointApp.h:45,
    > from mannasim/accessPointApp.cc:37:
    > mannasim/sensedData.h:49: error: expected initializer before ‘ mannasim/sensedData.h:50: error: expected initializer before ‘ mannasim/sensedData.h:65: error: ‘AppDataList’ does not name a type
    > mannasim/sensedData.h:105: error: ‘AppDataList’ does not name a type
    > In file included from mannasim/processing.h:47,
    > from mannasim/accessPointApp.h:45,
    > from mannasim/accessPointApp.cc:37:
    > mannasim/dataGenerator.h: In member function ‘virtual AppData*
    > DataGenerator::collect()’:
    > mannasim/dataGenerator.h:94: warning: no return statement in function
    > returning non-void
    > mannasim/dataGenerator.h: In member function ‘virtual AppData*
    > DataGenerator::getMaximumAllowedValue()’:
    > mannasim/dataGenerator.h:132: warning: no return statement in function
    > returning non-void
    > mannasim/accessPointApp.cc: In member function ‘virtual void
    > AccessPointApp::process_data(int, AppData*)’:
    > mannasim/accessPointApp.cc:72: error: ‘ON_DEMAND_DATA’ was not declared in
    > this scope
    > mannasim/accessPointApp.cc:79: error: ‘AppDataList’ was not declared in
    > this scope
    > mannasim/accessPointApp.cc:79: error: expected `;’ before ‘list’
    > mannasim/accessPointApp.cc:81: error: expected primary-expression before
    > ‘int’
    > mannasim/accessPointApp.cc:81: error: expected `)’ before ‘int’
    > mannasim/accessPointApp.cc:83: error: ‘AppDataList’ is not a class or
    > namespace
    > mannasim/accessPointApp.cc:83: error: expected `;’ before ‘it’
    > mannasim/accessPointApp.cc:83: error: ‘it’ was not declared in this scope
    > mannasim/accessPointApp.cc:83: error: missing template arguments before ‘.’ > token
    > mannasim/accessPointApp.cc: In member function ‘virtual void
    > AccessPointApp::forward_data(int, AppData*)’:
    > mannasim/accessPointApp.cc:97: error: ‘AppDataList’ was not declared in
    > this scope
    > mannasim/accessPointApp.cc:97: error: expected `;’ before ‘list’
    > mannasim/dataGenerator.h: At global scope:
    > mannasim/dataGenerator.h:65: warning: inline function ‘virtual void
    > EventTimer::expire(Event*)’ used but never defined
    > mannasim/dataGenerator.h:52: warning: inline function ‘virtual void
    > SensingTimer::expire(Event*)’ used but never defined
    > mannasim/sensorBaseApp.h:83: warning: inline function ‘virtual void
    > DisseminatingTimer::expire(Event*)’ used but never defined
    > make: *** [mannasim/accessPointApp.o] Error 1
    > Ns make failed!
    >

    > I am using Ubuntu 9.04 and have tried to google to solve this error but
    > couldnt. Please do help me out. Also, is it possible to use mannasim with
    > other versions of NS2.
    >

    Please Help me……

    Hoping to get some response…….

    Thanking You in Advance

    With Regards
    Vivek

    • Jason Ernst says:

      Well you can probably ignore the warnings, the major things are the missing files. For example “list.h” is missing. If you ensure that you have the file where the compiler is looking for it, you will have more luck.

  6. siva says:

    Hello sir, i am getting output of ./configure as folllows.
    please help me regarding this??
    i am trying to implement a new protocol

    config.status: creating autoconf.h
    config.status: autoconf.h is unchanged

    Also when i do make i am getting the output as follows

    for i in indep-utils/cmu-scen-gen/setdest indep-utils/webtrace-conv/dec indep-utils/webtrace-conv/epa indep-utils/webtrace-conv/nlanr indep-utils/webtrace-conv/ucb; do ( cd $i; make all; ) done
    make[1]: Entering directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/cmu-scen-gen/setdest’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/cmu-scen-gen/setdest’
    make[1]: Entering directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    make[1]: Entering directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/epa’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/epa’
    make[1]: Entering directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/nlanr’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/nlanr’
    make[1]: Entering directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/ucb’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/root/Desktop/realproject/ns-allinone-2.34/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/ucb’

    what is the meaning of this?
    i couldnt find the solution
    please help me

    thanks

    regards
    siva

  7. thomhert says:

    Hallo sir, I want to ask something.
    In this article, you used Ns-2.33 (and nam) on Ubuntu 8.04 (Hardy Heron). How about if I want to install Ns-2.29 on Ubuntu 9.04, can I use your article to do that?
    Actually, I need your explanations to help me understanding NS-2. I want to research about WiMAX scheduling algorithm, I got a patch QoS WiMAX from http://perso.telecom-bretagne.eu/aymenbelghith/tools/. But I got any problems, because I and My Friend doesn’t usually use NS-2.29. How do you think about if I use Ns-2.33? Can this patch run as well as in Ns-2.29?
    Thank You.

  8. irvan says:

    hey Jason

    hope you can help me..im new in ns2..i want to analyze delay, pdr, from trace file. i found in some website awk and pearl script to measure the parameters. But it just give value in its file.
    I want to get the graph of this parameter, i dont know how to make xgraph file based my trace file in order to measure the parameter above.
    please help me

    • Jason Ernst says:

      I usually work in ns3 lately, so my help may not be very good. If you are having trouble, one possible way to accomplish this, is to keep track of the values within the program rather than from trace file. Create your own variables to count packets, successful deliveries etc., and then compute the pdr and delay yourself. Then after each experiment run output these results in a format you can use, and then use a program like excel to plot the graph.

  9. Elli says:

    Hi
    Thank u for such useful blog!
    I try to install ns2.26 on linux redhat 9, but I encounter this error while building ns2.26:
    /usr/bin/ld : cannot find -lpcap
    collect 2: ld retured 1 exit status
    make : *** [ns] error 1
    NS make failed

    what is ur idea about this error’s solution?
    Tanx!

  10. shumon says:

    Hi
    I have install ns2.33 in ubuntu8. bt i cant run ZRP. i need zrp patch. can anybody help me..please help//

    • Jason Ernst says:

      I have checked the project site for ZRP. It looks like it has been designed for an older version of ns (ns2.1 allinone version) see the project website: http://sites.google.com/site/nsnamzrp/) You will probably have best luck if you use the older version of ns (of course the other option is to try to figure out how to adapt to new version of ns)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Articles

Creating a Bluetooth Access point (NAP) in Ubuntu 11.10

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...

Screenshot at 2011-11-29 08:54:32

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 channel

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

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...

waterloo

Why Blanket Wireless Coverage in Waterloo Failed, and...

July 22, 2011

Today the KW Record ran an article entitled "Blanket Wi-Fi plans unplugged...

sp1

Windows 7 – SP1, Multiple OS – Grub

July 17, 2011

A while ago I bought a Toshiba netbook which of course came with Windows 7...