Skip to content

Instantly share code, notes, and snippets.

@slashsbin
Last active October 16, 2021 15:01
Show Gist options
  • Save slashsbin/a383559dc1f683c7cd502af9fd39c3ab to your computer and use it in GitHub Desktop.
Save slashsbin/a383559dc1f683c7cd502af9fd39c3ab to your computer and use it in GitHub Desktop.
Install & Setup NS2(w/ UM-OLSR Patch) on Ubuntu 16.04

Upgrade Ubuntu

sudo apt update
sudo apt upgrade -Vy

Download NS2

Download NS2 & OLSR:

Extract NS2 & put it in Home:

cd ~
tar xzvf ~/Downloads/ns-allinone-2.35.tar.gz

Extract UM-OLSR & put it in NS2:

tar xzvf ~/Downloads/um-olsr-1.0.tgz
# Move UM-OLSR into NS2 & Reanme it to "olsr"
 mv ~/um-olsr ~/ns-allinone-2.35/ns-2.35/olsr

APT

Install Required Packages:

sudo apt install -Vy build-essential autoconf automake gcc
sudo apt install -Vy xorg-dev tcl-dev tk-dev perl xgraph libxt-dev libx11-dev libxmu-dev

Prepare NS2 Source Code

cd ~/ns-allinone-2.35/

# File LinkStat
# Line 137
gedit ns-2.35/linkstate/ls.h +137
# Change "erase" to "this->erase", Save and Exist GEdit

Prepare OLSR Source Code

Apply OLSR Patch:

cd ns-2.35/
patch -p1 < olsr/um-olsr_ns-2.35_v1.0.patch
cd ..

Install

Install NS2 & OLSR:

./install

Configure Bash Path

Put these lines at the end of ~/.bashrc file:

gedit ~/.bashrc

Replace madooga with your username(whoami):

##### NS2 ####
# LD_LIBRARY_PATH
OTCL_LIB="/home/madooga/ns-allinone-2.35/otcl-1.14"
NS2_LIB="/home/madooga/ns-allinone-2.35/lib"
USR_LOCAL_LIB="/usr/local/lib"
export LD_LIBRARY_PATH="$OTCL_LIB:$NS2_LIB:$USR_LOCAL_LIB:$LD_LIBRARY_PATH"

# TCL_LIBRARY
TCL_LIB="/home/madooga/ns-allinone-2.35/tcl8.5.10/library"
USR_LIB="/usr/lib"
export TCL_LIBRARY="$TCL_LIB:$USR_LIB:$TCL_LIBRARY"

# PATH
XGRAPH="/home/madooga/ns-allinone-2.35/bin:/home/madooga/ns-allinone-2.35/tcl8.5.10/unix:/home/madooga/ns-allinone-2.35/tk8.5.10/unix"
NS="/home/madooga/ns-allinone-2.35/ns-2.35"
NAM="/home/madooga/ns-allinone-2.35/nam-1.15"
export PATH="$XGRAPH:$NS:$NAM:$PATH"

Done!

Run NS2:

ns ~/path/to/file.tk
@beletu
Copy link

beletu commented May 9, 2019

is UM-OLSR ANDOLSR (as described in RFC 3626) AND please help me how i can integrate OLSR (as described in RFC 3626) with ns2.35 in ubuntu 16.04 ...my email adress [email protected]

@beletu
Copy link

beletu commented May 9, 2019

please help me
?
even i did not know which part of olsr can be modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment