Routing algorithm network layer

48
Guest Lecture On Routing Algorithms Nilesh U. Sambhe Assistant Professor, Department Of Computer Technology, Yeshwantrao Chavan College Of Engineering, Nagpur 1

Transcript of Routing algorithm network layer

Page 1: Routing algorithm  network layer

Guest Lecture On

Routing Algorithms

Nilesh U. SambheAssistant Professor, Department Of Computer Technology,

Yeshwantrao Chavan College Of Engineering, Nagpur1

Page 2: Routing algorithm  network layer

Outline

• Routing Algorithm

• Shortest Path Routing

• Flow Based Routing

• Flooding

• Distance Vector Routing

• Link State Routing

• Hierarchical Routing2

Page 3: Routing algorithm  network layer

Routing is the process of forwarding of a packet in a network so that it reaches its intended destination.

•Correctness: The routing should be done properly and correctly so that the packets may reach their proper destination.

•Simplicity: The routing should be done in a simple manner so that the overhead is aslow as possible. With increasing complexity of the routing algorithms the overhead also increases.

•Robustness: Once a major network becomes operative, it may be expected to run continuously for years without any failures. The algorithms designed for routing should be robust enough to handle hardware and software failures and should be able to cope with changes in the topology and traffic without requiring all jobs in all hosts to be aborted and the network rebooted every time some router goes down.

Properties Of Routing Algorithm

3

Page 4: Routing algorithm  network layer

• Stability: The routing algorithms should be stable under all possible circumstances.

• Fairness: Every node connected to the network should get a fair chance of transmitting their packets. this is generally done on a first come first serve basis.

• Optimality: The routing algorithms should be optimal in terms of throughput and minimizing mean packet delays. here there is a trade-off and one has to choose depending on his suitability.

4

Page 5: Routing algorithm  network layer

Types Of Routing Algorithms• Nonadaptive (Static)

• Do not use measurements of current conditions

• Static routes are downloaded at boot time

• Adaptive Algorithms

• Change routes dynamically

• Gather information at runtime

• locally

• from adjacent routers

• from all other routers

• Change routes

• Every delta T seconds

• When load changes

• When topology changes5

Page 6: Routing algorithm  network layer

d3 > d2

as

d1 + d3 > d1 + d2

I K

J

Optimal path from I to K over J

d1

d2

distance

d1 + d2 is minimal d3

Other path from J to K

Set of all optimal routes

• from all sources

• to a given destination

is a tree: sink tree

Optimality Principle

6

Page 7: Routing algorithm  network layer

(A) A SUBNET. (B) A SINK TREE FOR ROUTER B. 7

• The set of optimal routes to a particular node forms a sink tree.• Sink trees are not necessarily unique.• Goal of all routing algorithms

• Discover sink trees for all destinations

Page 8: Routing algorithm  network layer

Dijkstra’s Algorithm

A

B C

E FD

G H

1

22

6 4

2

7

33

22

Each node is labeled (in parentheses) with its distance from the source node along the best known path.

Page 9: Routing algorithm  network layer

(Cont’d)• We want to find the shortest path from A to D.• Initially, no paths are known, so all nodes are labeled with

infinity.

A

B( C(

E( F(D(

G( H(

Page 10: Routing algorithm  network layer

(Cont’d)• We start out by marking node A (the working node) as

permanent.• We examine each of the nodes adjacent a, relabeling each

one with the distance to a.

A

B(2, A) C(

E( F(D(

G(6, A) H(

2

6

Page 11: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(

E( F(D(

G(6, A) H(

We make B with the smallest label permanent.

B becomes the new working node.

Page 12: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(

E(4, B F(D(

G(6, A) H(

2

7

We examine each of the nodes adjacent B, relabeling each one with the distance to B.

Page 13: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(9, B)

E(4, B) F(D(

G(6, A) H(

We make E with the smallest label permanent.

E becomes the new working node.

Page 14: Routing algorithm  network layer

E(4, B)

(Cont’d)

1 2A

B(2, A) C(9, B)

F(D(

G(5, E) H(

We examine each of the nodes adjacent E, relabeling each one with the distance to E.

Page 15: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(9, B)

E(4, B) F(6, E)D(

G(5, E) H(

We make G with the smallest label permanent.

G becomes the new working node.

Page 16: Routing algorithm  network layer

E(4, B)

(Cont’d)

4

A

B(2, A) C(9, B)

F(6, E)D(

G(5, E) H(G

We examine each of the nodes adjacent G, relabeling each one with the distance to G.

Page 17: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(9, B)

E(4, B) F(6, E)D(

G(5, E) H(9, G)

We make F with the smallest label permanent.

F becomes the new working node.

Page 18: Routing algorithm  network layer

E(4, B)

(Cont’d)

2A

B(2, A) C(9, B)

F(6, E)D(

G(5, E) H(8, F)

3

We examine each of the nodes adjacent F, relabeling each one with the distance to F.

Page 19: Routing algorithm  network layer

(Cont’d)

A

B(2, A) C(9, B)

E(4, B) F(6, E)D(

G(5, E) H(8, F)

We make H with the smallest label permanent.

H becomes the new working node.

Page 20: Routing algorithm  network layer

E(4, B)

(Cont’d)

2

A

B(2, A) C(9, B)

F(6, E)D(10, F

G(5, E) H(8, F)

We examine each of the nodes adjacent H, relabeling each one with the distance to H.

Page 21: Routing algorithm  network layer

(Cont’d)

E(4, B)A

B(2, A) C(9, B)

F(6, E)D(10, F

G(5, E) H(8, F)

We make C with the smallest label permanent. C becomes the new working node.

Page 22: Routing algorithm  network layer

(Cont’d)

E(4, B)A

B(2, A) C(9, B)

F(6, E)D(10, F

G(5, E) H(8, F)

3

We examine each of the nodes adjacent C, relabeling each one with the distance to C.

Page 23: Routing algorithm  network layer

(Cont’d)

E(4, B)A

B(2, A) C(9, B)

F(6, E)D(10, F

G(5, E) H(8, F)

We make D with the smallest label permanent. D becomes the new working node.

Page 24: Routing algorithm  network layer

(Cont’d)

E(4, B)A

B(2, A) C(9, B)

F(6, E)D(10, H

G(5, E) H(8, F)

The shortest path from A to D follows.

Page 25: Routing algorithm  network layer

Flow Based Routing Algorithm

25

•It is a non-adaptive routing algorithm.

•It takes into account both the topology and the load in this routing algorithm;

•We can estimate the flow between all pairs of routers.

•From the known average amount of traffic and the average length of a packet

you can compute the mean packet delays using queuing theory.

•Flow-based routing then seeks to find a routing table to minimize the average

packet delay through the subnet.

•Given the line capacity and the flow, we can determine the delay. It needs to

use the formula for delay time T.

Where, μ = Mean number of arrivals in packet/sec, 1/μ = The mean packet size

in the bits, and c = Line capacity (bits/s).

Page 26: Routing algorithm  network layer

Routing: Flooding

• Every packet is sent out on every outgoing line except the one it arrived at

• It is non adaptive algorithm.

26

Page 27: Routing algorithm  network layer

27

Page 28: Routing algorithm  network layer

28

Page 29: Routing algorithm  network layer

29

Page 30: Routing algorithm  network layer

• Every packet is sent out on every outgoing line except the one it arrived at

• Duplicates!! How to limit?

• Hop counter

• Decrement in each router

• Discard packet if counter is 0

• Sequence number in packet

• Avoid sending the same packet a second time

• Keep in each router per source a list of packets already seen

• Selective flooding

• Use only those lines that are going approximately in right direction

30

Routing: Flooding

Page 31: Routing algorithm  network layer

Routing: Distance Vector

• Adaptive algorithm

• Exchange of info only with neighbours

• Data to be available in each router

• Routing table: per destination

• Distance

• Outgoing line

• Distance to all neighbours

31

Page 32: Routing algorithm  network layer

ROUTING: DISTANCE VECTORRouting table for ATo cost viaA 0 -B 12 B

C 25 BD 40 BE 14 EF 23 EG 18 BH 17 JI 21 E

J 9 JK 24 JL 29 J 32

Page 33: Routing algorithm  network layer

• Algorithm

• At each step within a router:

• Get routing tables from neighbours

• Compute distance to neighbours

• Compute new routing table

33

Page 34: Routing algorithm  network layer

ROUTING: DISTANCE VECTORRouting tables from

34

Page 35: Routing algorithm  network layer

Better?

• Keep 4 tables (one for each neighbour)

• Use shortest path

35

Page 36: Routing algorithm  network layer

Count To Infinity Problem

Good news:

• A comes up again

Only distances to A

Faster not possible!!!

36

Page 37: Routing algorithm  network layer

Bad news:

• A goes down

B receives:

• Distance from A

• Distance 2 from C

New distance from B to A: 3 via C

37

Page 38: Routing algorithm  network layer

Bad news:

• A goes down

C still

• believes its distance to A is 2

• routes via B

B routes its packets for A via C

38

Page 39: Routing algorithm  network layer

Bad news:

• A goes down

39

Page 40: Routing algorithm  network layer

Routing: Link State

• Each router must

• Discover its neighbours and learn their network addresses

• Measure the delay or cost to each of its neighbours

• Construct a packet with these distances

• Send this packet to all other routers

• Compute the shortest path to every other router

40

Page 41: Routing algorithm  network layer

41

Discovering your neighbors

• Send “hello” packet on each point-to-point line. Destination node replies with its address.

Page 42: Routing algorithm  network layer

42

Measuring line cost

• Send an “ECHO” packet over the line.

• Destination is required to respond to “echo” packet immediately.

• Measure the time required for this operation.

Page 43: Routing algorithm  network layer

Building link state packets• Packet containing:

• Identity of sender

• Sequence number + age

• For each neighbour: name + distance

43

Page 44: Routing algorithm  network layer

Age in each packet:

• Decremented during flooding, while used in router

• Age 0 info discarded

44

• Flooding

• Each router records the (source, seq. No.)

• Only flood and record packets from a source with higher seq.No. Than previously recorded.

• Sequence numbers or router records of them can get corrupt.

• Include age after seq. No. And decrement it per second. Discard packets with age zero.

Distributing the link state packets

Page 45: Routing algorithm  network layer

Computing new routes

• With a full set of link state packets, a router can:

• Construct the entire subnet graph

• Run Dijkstra's algorithm to compute the shortest path to each destination

• Problems for large subnets

• Memory to store data

• Compute time

45

Page 46: Routing algorithm  network layer

Hierarchical Routing• When network size increases…

• Larger stables• More CPU time needed to compute …• More bandwidth needed.

46

The Solution is to •Routers grouped in regions•Each routers knows how to reach:

• Other routers in its own group• Other regions

Page 47: Routing algorithm  network layer

47

Page 48: Routing algorithm  network layer

Thank you

48