Installation of NS2 and Congestion Control

21
1 Department of Information Science and Engineering M S Ramaiah Institute of Technology (Autonomous Institute, Affiliated to VTU) Bangalore-560054 NS2 Installation and Congestion control A presentation submitted to M S Ramaiah Institute of Technology An Autonomous Institute, Affiliated to Visvesvaraya Technological University, Belgaum in partial fulfillment of 5 th Sem Under DATA COMMUNICATIONS Submitted by Suman Raj K(1MS14IS417) Suneel N P(1MS13IS114) under the guidance of Dr. Mydhili K. Nair

Transcript of Installation of NS2 and Congestion Control

Page 1: Installation of NS2 and Congestion Control

1

Department of Information Science and Engineering

M S Ramaiah Institute of Technology(Autonomous Institute, Affiliated to VTU)

Bangalore-560054

NS2 Installation and Congestion controlA presentation submitted to

M S Ramaiah Institute of Technology An Autonomous Institute, Affiliated to

Visvesvaraya Technological University, Belgaum in partial fulfillment of 5th Sem Under

DATA COMMUNICATIONS

Submitted by

Suman Raj K(1MS14IS417)

Suneel N P(1MS13IS114)

under the guidance of

Dr. Mydhili K. Nair

Page 2: Installation of NS2 and Congestion Control

OVERVIEW

Installation of NS2

Recompiling NS2

Congestion Control

Page 3: Installation of NS2 and Congestion Control

LINUX FOR NS2

Linux Use of Linux is recommended

Fedora (10, 12) If DVD Version- no need of additional package installation

Install all the packages (if default installation selected, then additional packages have to be installed)

Ubuntu (9.04, 9.10, 10.04, 10.10) Additional packages to be installed, there may be GCC Issues, xgraph and

NAM issues

Red Hat Enterprise Linux 5 (RHEL5) Cent OS is the alternative for RHEL

Basic commands (ls, chmod, tar, rpm, make, gedit, vi, pwd, passwd, echo, cd, etc)

Directory structure and shell prompt

Path variables setting, Installation of packages and dependencies

Page 4: Installation of NS2 and Congestion Control

INSTALLATION OF NS2

Download from http://isi.edu/nsnam/ns/ns-build.html#allinone

Copy the file under /home/pradeep (if your username is “abcdef” then home folder will be /home/abcdef)

Extract it using “tar zxvf ns-allinone-2.34.tar.gz”

“cd ns-allinone-2.34”

“./install “ (if any errors, please correct it)

Setting of paths in “.bash_profile” or “.bashrc”

Page 5: Installation of NS2 and Congestion Control

BASIC ARCHITECTURE OF NS2

Page 6: Installation of NS2 and Congestion Control

DIRECTORY STRUCTURE OF NS2

Page 7: Installation of NS2 and Congestion Control

TCLCL

TCLCL Consists of Six main classes

Tcl (Methods to access the interpreted hierarchy)

InstVar (binds member variable in both

hierarchies together

TclObject (base class of all simulation objects)

TclClass (maps class of IH to class of CH)

TclCommand (global access to CH from IH)

EmbeddedTcl (translates OTCL Script to C++

Code)

Page 8: Installation of NS2 and Congestion Control

TCLCL

Each class have various member functions

that are used to get compiled

As a case study, lets start how to create a

simple agent.

Page 9: Installation of NS2 and Congestion Control

SIMPLE AGENT

class TSPAgent : public Agent {

public:

TSPAgent();

protected:

int command(int argc, const char*const* argv);

private:

int tsp_var1;

double tsp_var2;

void TSPPrivFunc(void);

};

Page 10: Installation of NS2 and Congestion Control

SIMPLE AGENT

static class TSPAgentClass : public TclClass {

public:

TSPAgentClass() : TclClass("Agent/TSPAgentOtcl") {}

TclObject* create(int, const char*const*) {

return(new TSPAgent());

}

} class_tsp_agent;

TSPAgent::TSPAgent() : Agent(PT_UDP) {

bind("tsp_var1_otcl", &tsp_var1);

bind("tsp_var2_otcl", &tsp_var2);

}

Page 11: Installation of NS2 and Congestion Control

SIMPLE AGENT

int TSPAgent::command(int argc, constchar*const* argv) {

if(argc == 2) {

if(strcmp(argv[1], "call-tsp-priv-func") == 0) {

TSPPrivFunc();

return(TCL_OK);

}

}

return(Agent::command(argc, argv));

}

Page 12: Installation of NS2 and Congestion Control

SIMPLE AGENT

void TSPAgent::TSPPrivFunc(void) {

Tcl& tcl = Tcl::instance();

tcl.eval("puts \"Message From

TSPPrivFunc\"");

tcl.evalf("puts \" tsp_var1 = %d\"", tsp_var1);

tcl.evalf("puts \" tsp_var2 = %f\"", tsp_var2);

}

Page 13: Installation of NS2 and Congestion Control

SIMPLE AGENT TO TEST

#name it as .tcl file

# Create TSPAgent

set myagent [new Agent/TSPAgentOtcl]

# Set configurable parameters of TSPAgent

$myagent set tsp_var1_otcl 2

$myagent set tsp_var2_otcl 3.14

# Give a command to TSPAgent

$myagent call-tsp-priv-fun

Page 14: Installation of NS2 and Congestion Control

14

CONGESTION CONTROL

Page 15: Installation of NS2 and Congestion Control

15

CONGESTION CONTROL

When one part of the subnet (e.g. one or more routers in an area) becomes overloaded, congestion results.

Because routers are receiving packets faster than they can forward them, one of two things must happen: The subnet must prevent additional packets from

entering the congested region until those already present can be processed.

The congested routers can discard queued packets to make room for those that are arriving.

Page 16: Installation of NS2 and Congestion Control

16

FACTORS THAT CAUSE CONGESTION

Packet arrival rate exceeds the outgoing link

capacity.

Insufficient memory to store arriving packets

Bursty traffic

Slow processor

Page 17: Installation of NS2 and Congestion Control

17

CONGESTION CONTROL VS FLOW CONTROL

Congestion control is a global issue –

involves every router and host within the

subnet

Flow control – scope is point-to-point;

involves just sender and receiver.

Page 18: Installation of NS2 and Congestion Control

18

CONGESTION CONTROL, CONT.

Congestion Control is concerned with

efficiently using a network at high load.

Techniques for detection and recovery

are:

Warning bit

Choke packets

Load shedding

Page 19: Installation of NS2 and Congestion Control

19

WARNING BIT

A special bit in the packet header is set by the router to warn the source when congestion is detected.

The bit is copied and piggy-backed on the ACK and sent to the sender.

The sender monitors the number of ACK packets it receives with the warning bit set and adjusts its transmission rate accordingly.

Page 20: Installation of NS2 and Congestion Control

20

CHOKE PACKETS

A more direct way of telling the source to slow down.

A choke packet is a control packet generated at a congested node and transmitted to restrict traffic flow.

The source, on receiving the choke packet must reduce its transmission rate by a certain percentage.

An example of a choke packet is the ICMP Source Quench Packet.

Page 21: Installation of NS2 and Congestion Control

THANK YOU