Skip to main content

Posts

GreenCloud Simulator using NS2

Introduction to GreenCloud Simulator GreenCloud is a packet level simulator that uses the existing Network Simulator 2 (NS2) libraries for energy-aware data centers for cloud computing. It models the various entities of cloud such as servers, switches, links for communication and their energy consumption. It can be helpful in developing solutions for resource monitoring and allocation, scheduling workloads for number of users, optimizing the protocols used for communication and also provide solutions for network switches. The data center upgradation or extension may be decided using this tool. NS2 uses two languages C++ and Otcl (Tool Command Language). The commands from TCL are usually passed to C++ using an interface TclCL. GreenCloud uses 80% of the coding is done using C++ (TclCL Classes) and remaining 20% coding is implemented using Tcl scripts (Commands are sent from Tcl to C++). GreenCloud is developed by University of Luxembourg and released under the General Public Licen...

How to set Destination of Mobile nodes and Traffic Generation in ns2

This post will help you to understand the automatic TCL code generation for creating connections between the nodes, to create hops, generates tcp or cbr agents, etc. There are two things are used: setdest and cbrgen.tcl setdest is used to Create hops between the nodes using the GOD (General Operations Director) object. Create mobility for nodes in terms of metres/second Move from one place to another place using setdest (Set destination) with speed To execute, use ./setdest Example of Setdest is $] cd /home/pradeepkumar/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/setdest $] ./setdest -v 2 -n 10 -s 1 -m 10 -M 50 -t 30 -P 1 -p 1 -x 500 -y 500 > usersetdest.tcl The above output is redirected to usersetdest.tcl  cbrgen.tcl  create connections between the nodes , one can specify the maximum number of connections to be made for all the nodes in the network to create the type of agents between the nodes (cbr or tcp) rate at which the packets a...

Propagation models in ns2

This post is helpful for you to find out the receiving threshold values of various propagation models for certain communication distance. By default, ns2 uses a distance of 1.5m (the antenna is just placed 1.5m above the node ground). Suppose if someone needs to calculate the factor when the distance of the antenna is placed 10m above the ground, then the default value changes. NS2 has an inbuilt mechanism to calculate the distance for certain communication range using the threshold.cc file in ~ns-2.35/indep-utils/propagation/  The file is not having any OTcl linkages, its a conventional C++ file that can be compiled using the command  g++ Before compiling the file, there are some changes in the threshold.cc file. 1. Change the #include<iostream.h> to #include <iostream> 2. Include the following two lines #include <string.h> using namespace std; Once the changes are made, compile the file using the command g++ -o threshold threshold.cc...

Printing Routing Table in AODV: NS2

There are no automatic provisioning to print a routing table for a given node in ns2. However, using the tracefile generated using ns2, routing table can be printed, but one should be good enough in processing a file using awk, python or any other scripts. The following code will make you print the routing table when you are using AODV Protocol. Files to be modified: ~ns-2.35/aodv/aodv.h ~ns-2.35/aodv/aodv.cc The RED colored code indicates the addition of these lines in to the existing codes. The following line can be added to the aodv.h file inside the class AODV in the protected scope.  probably add the line after the rt_down() function. void rt_print(nsaddr_t nodeid); In the aodv.cc file, add the following entry anywhere, but probably after the end of rt_down() function.  void  AODV::rt_print(nsaddr_t nodeid) { FILE *fp; fp = fopen("route_table.txt", "a"); aodv_rt_entry *rt; for (rt=rtable.head();rt; rt = rt->rt_link.le_nex...

Adding a malicious node in NS2 in AODV Protocol

Adding a malicious node is ns2 using aodv protocol. The node which is declared as malicious will simply drop the router packet (DROP_RTR_ROUTE_LOOP). Two files have to be modified. 1. aodv.h 2. aodv.cc aodv.h file changes Declare a boolean variable malicious as shown below in the protected scope in the class AODV bool malicious; aodv.cc file changes 1. Initialize the malicious varible with a value "false". Declare it inside the constructor as shown below AODV::AODV(nsaddr_t id):Agent(PT_AODV)... { ....... malicious = false; } 2. Add the following statement to the aodv.cc file in the "if(argc==2)" statment. if(strcmp(argv[1], "malicious") == 0) {     malicious = true;    return TCL_OK; } 3. Implement the behavior of the malicious node by setting the following code in the rt_resolve(Packet *p) function. The malicious node will simply drop the packet as indicated below. if(malicious==true) { drop(p,DROP_RTR_ROUTE_LOOP); } Onc...

A Text book for OMNeT++ (Learning OMNeT++)

This post is for the nsnam.com readers particularly those who want to learn OMNeT++. As you aware, ns2 and OMNeT++ are two software that are freely distributed and available to academics for almost free of cost. However, when dealing with the documentation, both suffers a set back. NS has a documentation and still researchers across the world have their own way of learning. And OMNeT++ has a proper documentation, that is very huge and takes times to understand. Packt Publishing has published a book in OMNeT++ authored by Thomas Chamberlain You may refer the following website for http://www.packtpub.com/ OMNeT++ You can also learn:  http://www.nsnam.com/2013/12/installation-of-omnet-in-linux-mint-16.html This book is organized in the following chapters. Getting started with OMNeT++ Installing OMNeT++ OMNeT++ Simulations  Creating and Running simulation Learning from your simulation There are just 5 chapters that are just enough for a beginner to...

Installing NS-2.35 in Fedora 20 (64 bit)

Installing ns2 under Fedora 20 is same as Fedora 19. However, there are some slight changes in the installation pattern. Refer to this post for downloading the ns2.35 software and pre installation steps: http://www.nsnam.com/2013/09/installing-network-simulator-2-ns-2-35-in-fedora-19.html Steps for Fedora 20 During the software customization in Fedora 20, I have selected all the softwares in GNOME Desktop. So I did not tried the following command. However, if you have installed Fedora 20 with default set of softwares, there here is the step to install all the developmental libraries. $prompt] yum install tcl tk gcc-c++ libX11-devel libXt-devel libXmu-devel  You need to change the file ns-2.35/linkstate/ls.h file as specified below. in Line number 137, change erase( to this->erase   The installation will report an error if the above change is not made. Once installed, set the PATH in /home/pradeepkumar/.bash_profile file, in my case here is my path informa...