Erlend's Lookout Post

Concerning ns-2, Ubuntu and other stuff with incredibly useful hints and tips hard to come by out there on the internets.

Using ns-2 with Eclipse

Filed under: ns-2

Renaming the ns-2 folder

When changing the main ns-2 folder, there is a problem doing a reinstall using the ./install command. The tk directory is not updated with regards to the correct folder name. To make this right, dive into the tk8.x.x/unix subdirectory and edit the directory entries in the “Makefile” file.

Then jump back to the main ns-2 directory and run the ./install command again. Good luck!

Filed under: linux, ns-2

Reinstalling/making ns-2 on Ubuntu 9.10

This has been copied from the ns-2 ubuntu installation guide

For Ubuntu 9.10 (karmic), you may encounter this error in the linking of otcl:

otcl.o: In function `OTclDispatch':
/home/ns/ns-allinone-2.34/otcl/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/ns/ns-allinone-2.34/otcl/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [libotcl.so] Error 1

This error is because the linker being used is “ld -shared” instead of “gcc -shared”. If you edit one line in otcl-1.13/configure, and rerun install, it should work:

--- configure.orig 2009-11-02 12:14:52.556167945 -0800
+++ configure 2009-11-02 12:17:28.966706099 -0800
@@ -6301,7 +6301,7 @@
;;
Linux*)
SHLIB_CFLAGS="-fpic"
- SHLIB_LD="ld -shared"
+ SHLIB_LD="gcc -shared"
SHLIB_SUFFIX=".so"
DL_LIBS="-ldl"
SHLD_FLAGS=""

Filed under: linux, ns-2

Find size of multiple files

find rapidly_shrinking_drive/ -name "offender1" -mtime -1 -print0 | du --files0-from=- -hc | tail -n1

from here.

Filed under: linux

Data centric networking

I came across Van Jacobson’s talk at Google Tech Talks, where he presents “A new way to look at networking“. Quite an interesting perspective!

Filed under: General, Sensor Networks

Searching gmail

Filed under: General

HELLO interval format bug in OLSR by Masimum

The implementation of OLSR (v0.8.8) by Francisco J. Ros at the University of Murcia, Spain works very good for simulations with OLSR. However, if you want to adjust the intervals of HELLO and TC, especially with decimals, note that the hello_ival, tc_ival_ and mid_ival_ variables are declared as integers in OLSR.h, so any alterations to these variables in the script file will be converted to an integer value. Change these and the inline methods hello_ival() etc. to doubles. Also, the defined macros OLSR_REFRESH_INTERVAL, OLSR_HELLO_INTERVAL and OLSR_TC_INTERVAL in OLSR.h must be updated to match the tcl script file’s definitions.

Filed under: ns-2

Using grep and OR

To fetch lines that are a subset of the lines in the file, with known, but different, starting characters, write this:
more <filename.txt> | grep "^1 \|^101 \|^251 "
where 1, 101 and 251 followed by a space represent the start of the lines we are interested in. In other words, the operator OR “|” must be escaped using the “\”.

Filed under: linux

Topology (Mobility) Generation Tool

The Nam ns2 topology investigation tool with lots of nodes

The Nam ns2 topology investigation tool with lots of nodes

To generate topology scripts for use with ns-2, I recommend the rwall command line program by Santashil PalChaudhuri. It generates big topologies really fast, and supports random walk and random waypoint with and without reflection or wrapping. It can be found here: http://monarch.cs.rice.edu/~santa/research/mobility/.

My experience is with the code in the palm_rw directory, where the file rwall.c can be compiled by simply running make.

A fast way to generate for example 10 different topologies with 30 nodes in a 1500 x 300 m^2 using random walk with reflection for a simulation lasting 700 seconds where the nodes have a set velocity of 5 m/s and changes direction every 10 s plus-minus 5 s in a linux bash shell (command line), do this:

i=0; while [ $i -lt 10 ]; do sleep 1; ./rwall 3 30 1500 300 700 5 0 0 0 10 5 > $i.top; let i=i+1; done

The sleep command has to be run to ensure that the rwall code generates 10 randomly different topologies. Without it, the program uses the same random seed for all 10 topologies, and you end up with 10 identical .top files.

To generate 10 static random topologies, I set the simulation time to 1, and the node velocity to 1 (they cannot be set to zero), and leave the rest of the parameters as above.

On a side note, I would like to warn people that not all topology generator tools do what is expected, so I would urge you to throroughly investigate the behavior of the generated topologies, especially when the topologies include mobility.

Filed under: ns-2

Compiling threshold.cc

threshold.cc is a program to calculate the thresholds for transmission receipt using the relation between various physical parameters (distance, effect, propagation model etc.) related to transmissions in ns-2. It has to be compiled by the user. This is not a difficult task, but could pose some challenges as the compiler over time is updated and no longer accepts the outdated c-code of outdated versions of ns-2.

Trying to do g++ threshold.cc will break if trying this with a reasonably updated version of Ubuntu and the g++ compiler (v4.3.3) in combination with ns-2.33. Thus, to make it work, delete the line that reads
#include <iostream.h>

and write these three lines there instead:
#include <iostream>
#include <cstring>
using namespace std;

Then try to compile with g++ again:
g++ threshold.cc -o threshold

Filed under: ns-2

The Author

Erlend is currently finishing his PhD at UniK/NTNU on routing protocols and QoS enhancing mechanisms related to ad hoc networks.