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. Usman Ali says:

    Result of ./configure
    usmanali@ubuntu:~$ cd ns-2.33
    usmanali@ubuntu:~/ns-2.33$ ./configure
    No .configure file found in current directory
    Continuing with default options…
    checking build system type… i686-pc-linux-gnu
    checking host system type… i686-pc-linux-gnu
    checking target system type… i686-pc-linux-gnu
    checking for gcc… gcc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether gcc accepts -g… yes
    checking for gcc option to accept ANSI C… none needed
    checking for g++… g++
    checking whether we are using the GNU C++ compiler… yes
    checking whether g++ accepts -g… yes
    checking how to run the C preprocessor… gcc -E
    checking for egrep… grep -E
    checking for ANSI C header files… yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking for string.h… (cached) yes
    checking for main in -lXbsd… no
    checking for socket in -lsocket… no
    checking for gethostbyname in -lnsl… yes
    checking for dcgettext in -lintl… no
    checking for getnodebyname in -ldnet_stub… no
    checking that g++ can handle -O2… no
    checking if C++ libraries work without any namespace… no
    checking if C++ libraries work with namespace std… yes
    checking if STL works without any namespace… no
    checking if STL works with namespace std… yes
    checking should use STL… yes
    checking for tcl.h… -I/usr/local/include
    checking for libtcl8.4… -L/usr/local/lib -ltcl8.4
    checking for init.tcl… /usr/local/lib/tcl8.4
    checking for tclsh8.4.18… no
    checking for tclsh8.4… /usr/local/bin/tclsh8.4
    checking for tk.h… -I/usr/local/include
    checking for libtk8.4… -L/usr/local/lib -ltk8.4
    checking for tk.tcl… /usr/local/lib/tk8.4
    checking for otcl.h… -I../otcl-1.13
    checking for libotcl1.13… -L../otcl-1.13 -lotcl
    checking for tclcl.h… -I../tclcl-1.19
    checking for libtclcl… -L../tclcl-1.19 -ltclcl
    checking for tcl2c++… ../tclcl-1.19
    checking for X11 header files
    checking for X11 library archive
    checking for XOpenDisplay in -lX11… yes
    checking for XShmAttach in -lXext… yes
    checking for libtcldbg… no
    checking dmalloc… not requested with –with-dmalloc
    checking for perl… /usr/bin
    checking for ANSI C header files… (cached) yes
    checking arpa/inet.h usability… yes
    checking arpa/inet.h presence… yes
    checking for arpa/inet.h… yes
    checking fenv.h usability… yes
    checking fenv.h presence… yes
    checking for fenv.h… yes
    checking netinet/in.h usability… yes
    checking netinet/in.h presence… yes
    checking for netinet/in.h… yes
    checking for string.h… (cached) yes
    checking for strings.h… (cached) yes
    checking time.h usability… yes
    checking time.h presence… yes
    checking for time.h… yes
    checking for unistd.h… (cached) yes
    checking net/ethernet.h usability… yes
    checking net/ethernet.h presence… yes
    checking for net/ethernet.h… yes
    checking for main in -lm… yes
    checking for bcopy… yes
    checking for bzero… yes
    checking for fesetprecision… no
    checking for feenableexcept… yes
    checking for getrusage… yes
    checking for sbrk… yes
    checking for snprintf… yes
    checking return type of random… long
    checking for int8_t… yes
    checking for int16_t… yes
    checking for int32_t… yes
    checking for u_int8_t… yes
    checking for u_int16_t… yes
    checking for u_int32_t… yes
    checking for u_char… yes
    checking for u_int… yes
    checking for strtoq… yes
    checking for strtoll… yes
    checking for long… yes
    checking size of long… 4
    checking for __int64_t… no
    checking for long long… yes
    checking for int64_t… yes
    checking which kind of 64-bit int to use… int64_t
    checking system version (for dynamic loading)… Linux-2.6.28-13-generic
    checking for dlopen in -ldl… yes
    checking dlfcn.h usability… yes
    checking dlfcn.h presence… yes
    checking for dlfcn.h… yes
    checking for ns library name… libns.so
    checking for struct ether_header… found
    checking for struct ether_addr… found
    checking for addr2ascii… no
    checking for Linux compliant tcphdr… found
    checking for BSD compliant tcphdr… not found
    checking for socklen_t… yes
    checking for main in -lpcap… no
    checking to make nse… no
    Explicitly disabling static compilation
    checking for dlopen in -ldl… (cached) yes
    checking for a BSD-compatible install… /usr/bin/install -c
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating tcl/lib/ns-autoconf.tcl
    config.status: creating indep-utils/webtrace-conv/ucb/Makefile
    config.status: creating indep-utils/webtrace-conv/dec/Makefile
    config.status: creating indep-utils/webtrace-conv/nlanr/Makefile
    config.status: creating indep-utils/webtrace-conv/epa/Makefile
    config.status: creating indep-utils/cmu-scen-gen/setdest/Makefile
    config.status: creating autoconf.h
    config.status: autoconf.h is unchanged

  2. Usman Ali says:

    hi
    in step 7
    when i run make
    it gives error make error 1
    what should i do now

  3. oyekunle says:

    I installed ns on ubuntu 9.04 successfully
    I followed all steps and also steps from ns-nam troubleshooting.
    I get an error while launching nam:
    nam:
    [code omitted because of length]
    : no event type or button # or keysym
    while executing
    "bind Listbox {
    %W yview scroll [expr {- (%D / 120) * 4}] units
    }"
    invoked from within
    "if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Listbox {
    %W yview scroll [expr {- (%D)}] units
    }
    bind Li..."

    Could you please help urgently.

  4. Shilpa Lambor says:

    Nice information. I am trying to install ns2 on Ubuntu. The downloading & installation commands have worked well. However when I try to set the environment variables using the $ gedit ~/.bashrc command, it says that the bashrs file / directory does not exist. What should I do?

  5. Mahedi says:

    Hello Everybody,

    I am using NS-2.31 in ubuntu 8.10. I got this error message when try run this command “make”. After I install NS-2.31, I got this kind of error:

    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 `/opt/ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen/setdest’
    g++ -o setdest setdest.o rng.o -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=std -Wall \
    -lnsl -lpcap -ldl -lm -lm
    setdest.o: In function `Node::Node()’:
    setdest.cc:(.text+0x22e5): undefined reference to `my_abort(int, char*)’
    setdest.o: In function `init()’:
    setdest.cc:(.text+0x23f6): undefined reference to `my_abort(int, char*)’
    setdest.cc:(.text+0x243e): undefined reference to `my_abort(int, char*)’
    setdest.cc:(.text+0x24b1): undefined reference to `my_abort(int, char*)’
    setdest.o: In function `Node::Node()’:
    setdest.cc:(.text+0x27a7): undefined reference to `my_abort(int, char*)’
    setdest.o:setdest.cc:(.text+0x296a): more undefined references to `my_abort(int, char*)’ follow
    collect2: ld returned 1 exit status
    make[1]: *** [setdest] Error 1
    make[1]: Leaving directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen/setdest’
    make[1]: Entering directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/dec’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/dec’
    make[1]: Entering directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/epa’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/epa’
    make[1]: Entering directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/nlanr’
    g++ -Wall -DCPP_NAMESPACE=std -o nlanr-tr-stat tr-stat.o logparse.o -L/opt/ns-allinone-2.31/lib -ltcl8.4 -lnsl -lpcap -ldl -lm
    tr-stat.o: In function `main’:
    tr-stat.cc:(.text+0x6ad): undefined reference to `my_abort(int, char*)’
    tr-stat.cc:(.text+0×731): undefined reference to `my_abort(int, char*)’
    tr-stat.cc:(.text+0×779): undefined reference to `my_abort(int, char*)’
    tr-stat.cc:(.text+0x8e8): undefined reference to `my_abort(int, char*)’
    logparse.o: In function `lf_get_next_entry(_IO_FILE*, lf_entry&)’:
    logparse.cc:(.text+0x1b1): undefined reference to `my_abort(int, char*)’
    logparse.o:logparse.cc:(.text+0x26f): more undefined references to `my_abort(int, char*)’ follow
    collect2: ld returned 1 exit status
    make[1]: *** [nlanr-tr-stat] Error 1
    make[1]: Leaving directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/nlanr’
    make[1]: Entering directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/ucb’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/opt/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/ucb’

    Would anyone please tell me how to solve this problem. I am facing this kind of error.

    Thank you in advances

  6. irk says:

    Hello Jason,
    I want to implement a tdma-based mac protocol in NS2. But I don't find information about mac protocol implementation in NS2 and about the mac-tdma protocol implemented in NS2. Do you know any book or documentation to have something about that?.
    Thanks in advance,
    irk.

  7. kar says:

    this is result of my validate report

    validate overall report: all tests passed
    karthik@karthik-desktop:~/project/ns-allinone-2.34/ns-2.34$

    now i ve created a tcl file example1.tcl and placed in directory ns-2.34…. now what should i do to run tat tcl file…

  8. abdul says:

    hi,
    i compile my progrm test.tcl and i got test.tr. but i didn't got output in tracegraph.

  9. swathi says:

    hi i am doing my project in ns2. i have to include wimax patch in it to work? Do you know how to include it and how to work properly?

  10. Priyanka says:

    hi… i'm unable to install um-olsr in ns2…
    when i run this command:
    $ patch -p1 < olsr/um-olsr-2.34_v0.8.8.patch
    i'm getting the following error:
    olsr/um-olsr-2.34_v0.8.8.patch : no such file or directory.
    can you plz tel me how to apply this patch?

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