Optimized Link State Routing Protocol(OLSR) is not readily available with ns-2. We can apply a suitable version of the OLSR patch on a suitable version of ns-2 and do our OLSR experiments.
In fact, this subject is very old. There were some old discussions about OLSR in our forum also.
Here we assume that the student is having some elementary knowledge on Linux and ns2. For installation of Linux and ns2.28, refer internet for the procedure for installing linux and installing ns2 on Linux or consult your lab admin or your friend or anybody who knows installation of Linux and ns2
(The given procedure is for ns2.28 only)
Installing ns2.28
Download ns2.28 from the following link
$ gunzip -d ns*.gzthis will extract ns-allinone-2.28.tar in the/ file system
$ tar -xvf ns*.tar this will extract ns.28 under the directory/ns-allinone-2.28
First install ns2.28
After successful installation, edit the /home/user_name/.bash_profile with the following values – then only the following commands will work from any project directory) [/.bash_profile is a hidden file and you have to edit these paths according to your ns2 installation path]
TCL_LIBRARY=/ns-allinone-2.28/tcl8.4.5/library
PATH=$PATH:$HOME/bin:/ns-allinone-2.28/bin:/ns-allinone-2.28/tcl8.4.5/unix:/ns-allinone-2.28/tk8.4.5/unix
export USERNAME BASH_ENV PATH LD_LIBRARY_PATH TCL_LIBRARY
Reboot the system and login again
Check the good working of ns2 by just typing the following command.
If all the above three commands are working, then only you may proceed with the following.
Installing OLSR Routing Agent in ns2.28
We are downloading the OLSR patch from the following link and just renamed it as OLSR.patch (see bottom of this article for the updated patch for ns2.35)
You need to first patch your ns version 2.28 as follows.
Now you are having a working version of ns2.28
copy the file OLSR.patch to ns-allinone-2.28 folder.
run terminal window and change to ns-allinone-2.28 folder.
apply OLSR patch as follows
the following screen shows a successful patch operation
Chage to ns-allinone-2.28/ns-2.28 folder and make new ns binary with swarm as follows. (cd /ns-allinone-2.28/ns-2.28)
A successful compilation of ns2 with OLSR
OLSR is getting compiled
The final screen showing no errors – means successful compilation
(some times optional – it will copy ns binary files to /bin and /usr/bin directory)
If everything is ok, then it will create a new ns binary with OLSR routing protocol.
7. Now we can test the installation with a sample tcl script wich is using OLSR routing protocol.
You can download a sample ns2 simulation script to test the working of OLSR from the following link.
http://masimum.dif.um.es/um-olsr/olsr_example.tcl
It will run the code and open the example scenario in nam window.
If you are getting any routing agent related errors, then check from the top.
Yes It may be tough for a normal student. There is no other simple way to do it.
You have to complete the above things even before starting a single line of coding for your project on OLSR under ns2.
Updates:
Resent version of patches may be found at the following links.
https://drive.google.com/file/
https://drive.google.com/
Reference
https://en.wikipedia.org/wiki/Optimized_Link_State_Routing_Protocol