Skip to main content

MANET Routing Protocols using ns3

#AODV #OLSR #MANETs #DSDV #DSR

Download the Code here: 
https://drive.google.com/open?id=1OkVOsifjN9UfQjPGvfR7OuS-x_GBRgCV

Check the Video for Detailed instruction and how to use the plots, graphs and source code.


Comparison of MANET routing Protocols 1. AODV
2. DSDV
3. DSR
4. OLSR
using NS3 (Network Simulator 3)
B.Tech, M.Tech, PhD...
1. Reactive Vs Proactive routing
2. PErformance comparison of MANET protocols
3. AODV Vs DSDV Comparison

https://www.nsnam.com and also at my channel.

What Version: ns-3.29
My Ubunut OS is: Ubuntu 18.04

This file we are going to use for our simulation:
/home/networks/ns-allinone-3.29/ns-3.29/examples/routing/manet-routing-compare.cc

Once you under stand the code, now lets run this example

Step 1: Copy the above file in to ~ns-3.29/scratch/ folder

Step 2: Understand this code.
Step 3: Run this code
Open the terminal, Go to ns-3.29 and run the following command

$] ./waf --run scratch/manet-routing-compare

enable the following header file

#include "ns3/flo…

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 License (GPL).

Installation of GreenCloud
GreenCloud Tool is developed mainly for debian based systems like (Ubuntu, Debian, Linux Mint, etc). The tool will be comfortably work with Ubuntu 12.x and afterwards with a kernel of 3.2+. GreenCloud also comes with a preconfigured VM which includes Eclipse to debug ns, modifying the source code and to start/run simulations.

Here is the instructions for GreenCloud on a Non VM machine. Download the software from this url
http://greencloud.gforge.uni.lu/ftp/greencloud-v2.0.0.tar.gz. Execute the command as specified below.

--------------------------------CODE-----------------------------
Unzip or untar the software using the command

pradeep@localhost $] tar zxvf greencloud-v2.0.0.tar.gz
pradeep@localhost $] cd greencloud-v2.0.0
pradeep@localhost greencloud-v2.0.0 $] ./configure
pradeep@localhost $] ./install-sh

(This will install almost as 300MB of software with the dependencies. You need to press “Enter” manually for fewer number of times during the installation, If the installation is unsuccessful, correct the dependencies)
Execute the script by running (This command will pop out a window in a browser with a test simulation data)

--------------------------------CODE-----------------------------

Sample Simulation
The GreenCloud comes with a default test simulation with 144 Servers with one Cloud User. All of the parameters can be varied and tested based on the inputs given to the Tcl file.

The Tcl files are located under the ~greencloud/src/scripts/ directory. There are many scripts that specifies the functionality of the cloud environment
main.tcl - specifies the data center topology and simulation time
topology.tcl – create the network topology
dc.tcl – creates the servers and VMs
setup_params.tcl – general configuration like servers, switches, tasks, etc
user.tcl – defines the users and their behaviors
record.tcl – reporting the results
finish.tcl – prints the statistics.

The output can be viewed using the browser using the show-dashboard.html file by running the ./run scripts.
The ./run scripts consists of the following parameters Data center load, Simulation Time and Memory requirement. The Data center load specifies the value from 0 to 1 (the values near 0 indicates the idle data center and while the load closer or greater than 1 indicates the saturation of data center). The simulation time specifies the task that can be scheduled under a VM or a single host based on the deadlines of the task.

The simulation results are processed in the ~greencloud/traces/ directory. There are various trace files that records the information from data center load, main tasks, switch tracing, loading, etc.

Changing the Cloud parameters
The parameters of the data center can be changed using the Tcl files that were shown in the previous section. Here a simple change is shown below. Two files (main.tcl and topology.tcl) are modified caters to 40 servers and single user cloud data center with a average load capacity of 0.3 (as shown in the Table 1)

--------------------------------CODE-----------------------------
#topology.tcl, where the network topology is been set
switch $sim(dc_type) {
"three-tier high-speed" {
set top(NCore) 2 ;# Number of L3 Switches in the CORE network
set top(NAggr) [expr 2*$top(NCore)] ;# Number of Switches in AGGREGATION
set top(NAccess) 256 ;# Number switches in ACCESS network
set top(NRackHosts) 3 ;# Number of Hosts on a rack
}
"three-tier debug" {
set top(NCore) 1 ;# Number of L3 Switches in the CORE network
set top(NAggr) [expr 2*$top(NCore)] ;# Number of Switches in AGGREGATION
set top(NAccess) 2 ;# Number switches in ACCESS network per pod
set top(NRackHosts) 20 ;# Number of Hosts on a rack
}
# three-tier
default {
set top(NCore) 8 ;# Number of L3 Switches in the CORE network
set top(NAggr) [expr 2*$top(NCore)] ;# Number of Switches in AGGREGATION
set top(NAccess) 64 ;# Number switches in ACCESS network
set top(NRackHosts) 3 ;# Number of Hosts on a rack
}
}

# Number of racks is set as 2 * 1
set top(NRacks) [expr $top(NAccess)*$top(NCore)]

# Number of servers is set to 2 * 20 (40 servers)
set top(NServers) [expr $top(NRacks)*$top(NRackHosts)]
…...
--------------------------------CODE-----------------------------

--------------------------------CODE-----------------------------
#main.tcl, where the simulation information and data center load information is specified
# Type of DC architecture
set sim(dc_type) "three-tier debug"

# Set the time of simulation end
set sim(end_time) [ expr 60.1 + [lindex $argv 1] ] ;# simualtion length set to 60 s + deadline of tasks

# Start collecting statistics
set sim(start_time) 0.1

set sim(tot_time) [expr $sim(end_time) - $sim(start_time)]

set sim(linkload_stats) "enabled"

# Set the interval time (in seconds) to make graphs and to create flowmonitor file
set sim(interval) 0.1

# Setting up main simulation parameters
source "setup_params.tcl"

# Get new instance of simulator
set ns [new Simulator]

# Tracing general files (*.nam & *.tr)
set nf [open "../../traces/main.nam" w]
set trace [open "../../traces/main.tr" w]

# Building data center topology
source "topology.tcl"
…......
--------------------------------CODE-----------------------------

Table 1: Simulation Data
Data center Architecture
Three tier debug
Core Switches
1
Aggregation Switches
2
Access Switches
2
Number of Servers
40
Users
1
Average Load/Server
0.3
Total tasks
688
Average Task/Server
17.2
Total Energy Calculated
322.7 Watt Hour
Server Energy
164.1 Wh
Total Switch Energy
158.6 Wh


GreenCloud using NS2
Simulation Summary

GreenCloud using NS2
Data Center characteristics

GreenCloud using NS2
Data Center Network Characteristics

GreenCloud using NS2
Energy consumption details

The graph in the browser shows 4 parts, Simulation summary as shown in Table 1, Data center characteristics as shown in Figure 3, DC Network characteristics as shown in Figure 4 and Energy consumption details as shows in Figure 5.

Multiple simulations can be performed using a single run script. In these case, the results are plotted in as a tabbed pane.

To modify the existing source code
The above sections shows the parameter changes in the existing network and to analyse the results. However, if a researcher is trying to configure a CPU, HPC Cluster, Cache Memory alteration, handling of Virtual Machines, etc, then there should be code modification in the source files (.cc and .h).
The location of these files are in the ~greencloud/build/ns-2.35/greencloud/ directory. Already these files are compiled as object files. Any changes to these files needs a compilation as specified below

--------------------------------CODE-----------------------------
if a file called cpu.cc is modified and have to be recompiled using the make command as shown below.

~pradeep@localhost $] cd /home/pradeep/greencloud/build/ns-2.35/
~pradeep@localhost ns-2.35 $] make

If new set of files (newfile.cc and newfile1.cc) are added, those details have to be added to ~ns-2.35/Makefile.in as specified below in the OBJ_CC variable. For each .cc file, there need to be a .o file to be added.

OBJ_CC = \
…...
greencloud/newfile.o \
greencloud/newfile1.o \

--------------------------------CODE-----------------------------

GreenCloud is a best open source tool that analyse the performance of a data center by varying parameters of the cloud and also gives a provision to add or modify existing source code to define new metrics for a cloud. Any questions on installation or tuning the GreenCloud are always welcome.

Reference:


T S Pradeep Kumar

Comments

Popular posts from this blog

Routing in VANETs using ns3

Part 1
WAVE - Wireless Access for Vehicular environments. vanet-routing-compare.cc It might take more than an hour. The readers are requested to be patient. SUMO, VANETs, routing comparison 1. Explain the full source code (1550 lines of code) 2. Creating a real scenario using osm (Open Street Map Web Wizard) 3. Performance analysis for various vanet protocols. https://www.nsnam.com Location of the source code /home/pradeepkumar/ns-allinone-3.27/ns-3.27/src/wave/examples
Move this file to the scratch/ for inclusion of all modules. Step 1: Explanation of source code. Copy the file to scratch folder. This is just Part 1 of the VANET comparison

Part 2 Please watch the First Part before watching this video   https://www.youtube.com/watch?v=IJYeIpUqjQI&t=850s
Part 2 - Analysis of the results.
Please go through the first video (Part 1) and then watch this video (PArt 2)
#VANETs #NS3 #Routing
1. SUMO for web traffic (osmWebWizard.py) 2. Convert this into mobility.tcl file and t…

ns3 installation in Ubuntu 16.04

This post serves the installation instructions of ns3 in ubuntu 16.04 version. Some of my students are working in ns3, this post will benefit them in installing ns3.

OS Used: Ubuntu 16.04.4
ns3 version: ns3 version 3.27

The same procedure will be applied for OS like Debian, Linux Mint.

Fresh installation of Ubuntu 16.04 Let you try the fresh installation of ubuntu in your hard disk along with windows.
Installation of ns3 dependencies ns3 needs so many dependencies, developmental libraries, drivers, etc. so install all those
$] sudo apt update  $] sudo apt upgrade
$] sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake p7zip-full python-matplotlib python-tk python-dev python-kiwi python-gnome2 python-gnome2-desktop-dev python-rsvg qt4-dev-tools qt4-qmake qt4-qmake qt4-default gnuplot-x11 wireshark
The above command make take some time to download, compile and install it, Be Patient. 
Installing ns3 Download the…

TORA Protocol in NS-2.35 (NS2)

This post tells you how to enable the TORA (Temporally ordered routing Algorithm) protocol in Network Simulator 2 (ns-2.35)

TORA is a protocol in wireless adhoc networks that works with timing parameters. NS-2.35 comes with the TORA protocol by default but it has to be tweaked manually to make it run.
This post will help you to do that.

You can watch this video for detailed instructions:


Step 1: Generate a Scenario for TORA protoco using NS2 Scenario Generator NSG Software.
We have created a tcl file using NSG2.1.jar

$] java -jar NSG2.1.jar

Three files have to be modified
~ns-2.35/tora/tora.cc~ns-2.35/tora/tora.h~ns-2.35/imep/imep.cc There are various websites that tells you how to configure TORA by making changes to the above three files.  Change 1: tora.h In the tora.h file, go to the end of the File before the agent completes, include these two lines

#include <classifier/classifier-port.h>
protected: PortClassifier *dmux_;

Change 2: tora.cc Open the tora.cc and include the follow…