Posts

Showing posts from March, 2015

Security Protocol (packet) in NS2

Image
Security is not my area of work, but most of the places, I have been bombarded with questions like , is it possible to implement security protocol in ns2.
The answer is yes, here is the solution for that.  Here is the document to read
This work is done in 2005 and developed for ns version 2.26 or 2.27. I have done the compilation for ns-2.35
The files to be modified
1. Create a new agent called "Security_packet" and two files Security_packet.h and Security_packet.cc are created.
2. Add a new packet type in ~ns-2.35/common/packet.h
3. Add a new packet type in ~ns-2.35/tcl/lib/ns-default.tcl
4. Add a new packet type in ~ns-2.35/tcl/lib/ns-packet.tcl
5. modify the ~ns-2.35/Makefile.in

Steps
1. Download the two files here
2. Copy the security.cc and security.h file in ~ns-2.35/security folder (create the security/ folder and paste both the files)
3. Open ~ns-2.35/Makefile.in and make an entry as shown below,
OBJ_CC =
......
...
             security/security.o

4. Open the ~ns-2.3…

Adding a New Agent and Application in Network Simulator 2 (NS2)

Image
 This post is reproduced from this website http://nile.wpi.edu/NS/new_app_agent.html.  But the above code is compiled for older ns2 version. But nsnam.com showcases the code for ns-2.35 version. You can read the theory about the agent from this weblink.

A Simple theory about Application and Agent
In Ns2, Nodes are individual entities where in...

Nodes -> Agent -> Application
Nodes is attached with an Agent and the Agent carries the Application. You can see the following image where Node is attached with the Agent and the Agent carries the FTP or CBR Application

Here is an Agent and Application is implemented
Agent - UDPmm
Application - mmApp


To compile it 
Method 1: Easy method


Please download the code here
Copy the mm-app.cc/.h and udp-mm.cc/.h in the -ns-2.35/multimedia directorythere is another folder called ns-modified-files/folder, copy the files which are there in to the corresponding location as specified below (Replace the existing files, Also take backup of your old files)

Tracegraph installation in Fedora 21

Image
To install tracegraph (a software that handles the tracing automatically by specifying the trace file generated from ns2)

OS Used: Fedora 21 (64 bit)
Tracegraph version: 2.02

Download the tracegraph software from this link

Since tracegraph is a 32 bit software, you need to install all the 32bit libraries. The following packages that ends with .i686 are related to 32bit libraries

Steps to install
$] su
and press the root password
$] yum update
$] yum install ld-linux.so.2 libXext.i686 libXt.i686 libXp-devel.i686
Still if tracegraph is not working, install these softwares too (this will also help in installing ns-2.35)
$]yum install tcl tk gcc-c++ libX11-devel libXt-devel libXmu-devel

To install Tracegraph
untar the software after copying it to your home folder (/home/pradeepkumar) in my case.
$] tar zxvf tracegraph202.tar.gz
$] cd tracegraph202
After the above step you need to set the LD_LIBRARY_PATH
Open the file /home/pradeepkumar/.bash_profile and give this line in the file
export LD_LIBRARY_PA…

BonnMotion - A mobile scenario Generator Tool

Image
BonnMotion is a tool that generates scenario for ns2, ns3, qualnet, etc. This will comfortably work with Linux. And in windows, there could be some bugs.

Please refer the documentation here: http://sys.cs.uos.de/bonnmotion/doc/BonnMotion_Docu.pdf

To use this tool for ns2, here are the steps.
Step1 : Download the BonnMotion tool from this website
Step 2: Unzip it to home folder (/home/pradeepkumar in my case)
step 3: Here are the commands to install
$] unzip -d bonnmotion-2.1.3.zip
$] cd bonnmotion-2.1.3/
$] ./install 
The above command will install, if any packages are missing for dependencies, please install it.

$] Once installed, copy the bonnmotion-2.1.3/bin/bm file to /usr/bin/ for running it anywhere. if not go to bin folder using the command given below

$] cd bonnmotion-2.1.3/bin/

To run BonnMotion
$bonnmotion-2.1.3/bin] ./bm -hm 
(this will list all the models)

$bonnmotion-2.1.3/bin] ./bm -hm RandomWaypoint
Will display all the parameters for RandomWaypoint like number of nodes, x…

Ant Colony Algorithm (antnet) in NS-2.35

Image
The source code of antnet is taken from this website. If anyone claims as the owner of this software, let me know so that I will give credits to him/her.

(NB: This topic does not have any relevance to me and I have just reproduced what was available in the above website). And of Course, corrected some bugs. 

Important: These codes will work well with fresh installation of ns-allinone-2.35. If you have already compiled any other simulation in ns-2.35, kindly take a back up before you proceed.

These are the files to be modified. Download the entire folder here
...ns-2.35/tcl/lib/ns-default.tcl 
...ns-2.35/common/packet.h    
rtable.txt (This file is created for my network with 2 nodes)
...ns-2.35/trace/cmu-trace.cc 
...ns-2.35/queue/drop-tail.h
...ns-2.35/tcl/lib/ns-lib.tcl      
...ns-2.35/queue/priqueue.cc  
simpleant.tcl (This is the tcl file can be copied anywhere)
...ns-2.35/trace/cmu-trace.h  
...ns-2.35/Makefile.in
...ns-2.35/tcl/lib/ns-packet.tcl   
...ns-2.35/queue/priqueue.h   
antnet_281_2…