Installation of NS2 with UM-OLSR in Ubuntu 16.04

Koay Yong Cett
5 min readApr 17, 2020

First of all, Optimized Link State Routing (OLSR) is not available in the network simulator 2 (ns2) packages. Therefore, the UM-OLSR is needed to be patch into the ns2 before any simulation related to OLSR routing protocol can be run.

In this example, the virtual box will be used in my window machine in order to run Ubuntu 16.04. The Ubuntu 16.04 will be added as a new virtual machine in the virtual box.

Let’s start with the installation of Virtual Box. First, the correct platform packages for the machine operating systems is selected and downloaded from the website: https://www.virtualbox.org/wiki/Downloads.

The platform packages that will be selected is Windows hosts because that the window machine is used to run virtual box.

After the virtual box is completely downloaded, the installation of virtual box is started (Use the default steps for the ease installation).

When the installation is successful installed.The main menu of the Virtual Box is showed in the figure above.

Second part of installation is related to the Ubuntu 16.04. The Desktop image for Ubuntu 16.04 can be found and needed to be downloaded from the website: http://releases.ubuntu.com/16.04/

Select the correct desktop image for your machine. Note: remember to check what bit that your PC support, if not it will be waste of time to download the desktop image because that its size is in between 1.5–2.0 GB.

Now, we can create a new virtual machine when we clicked on the new star logo in the main menu of virtual box. (Click on the default option for ease installation)

The Ubuntu 16.04 is now successfully added in the virtual box and start it by clicking on the arrow logo.

After starting it, we will need to select the desktop image that we downloaded in previous step.

If not the desktop image can also be added in the storage option of setting for the Ubuntu 16.04 machine.

After selecting the correct desktop image, the installation of Ubuntu 16.04 is started (Follow the default steps for ease installation)

The installation of Ubuntu 16.04 is successful and shown in above figure.

Installation of Network Simulator 2 in the Ubuntu 16.04 machine in the virtual box. Search for the packages and download the nsnam(ns 2.35) from the website: https://sourceforge.net/projects/nsnam/files/latest/download

Download it from the website link.

The zip file is successfully downloaded and extract it. Use command in Ubuntu terminal to extract the file: tar xvzf- ns-allinone-2.35.tar.gz

Check whether the ns2.35 is extracted or not with command: ls ns-allinone-2.35

Change directory to the ns-2.35 file with command: cd ns-2.35. Then, edit the ls.h file in the ns-2.35 with nano command: nano ls.h. Next, the code this-> is added to the line 137 and before the erase (basemap::begin(), baseMap::end()) code

Insert sudo apt-get update in order to update the repositories for the required packages. Next, insert the command: sudo apt-get install build-essential autoconf automake libxmu-dev to fetch and install the required packages needed for the network simulator (NS2).

The installation process will start and the time to complete will be vary according to machine with command: ./install

This indicate that the installation of NS2 is successful.

After the installation process is completed, open the .bashrc file with nano .bashrc in home and add the PATH stated into the file .

The Network Animator (nam) in ns2.35 is successful installed and tested.

The Xgraph in ns2.35 is successful installed and tested. Note that if it is not installed, just use sudo apt-get install to install it.

Lastly, the UM-OLSR will be downloaded from website: https://sourceforge.net/projects/um-olsr/ and patched to the ns2.35 that installed in previous step.

Download it from the website link.

Move with command: mv ~/um-olsr ~/ns-allinone-2.35/ns-2.35/olsr and Patch the UM-OLSR extracted to the ns-2.35 file with command: patch -p1 < olsr/um-olsr_ns-2.35_v1.0.patch

The olsr packages is successful patched into the ns-2.35 directory and run the steps for installation again with command: ./install (that mentioned before).

The network simulator (NS2) is successful installed and tested with simple script found in the internet. Now, the ns-2.35 in the Ubuntu 16.04 can run the simulation with OLSR routing protocol.

Have fun Guys !!!

--

--

Koay Yong Cett

A Bachelor CS student with major in Network Security (UniSZa). Every stories I shared is based on my personal opinion. Thanks you. Having my Internship now.