Professional Documents
Culture Documents
Routing Algorithm
Routing Algorithm
Suggested Reading:
Bertsekas and Gallager: 5.1 (5.1.1, 5.1.2), 5.2.3 (on Bellman-Ford and
Dijkstras)
Outline
Flooding
Distributed Bellman Ford Algorithm
Dijkstras Shortest Path First Algorithm
Problem
Given a topology, link costs, and a source-destination (SD) pair,
determine a route from S to D so that the route has the minimum
cost (i.e., is the shortest).
Example network
The shortest route A to B:
R1, R2, R5, R8
R1
R2
R4
R3
R6
R5
R7
R8
Routing Metrics
Metrics
Link state: up or down (stability)
Delay to send an average size packet (Make high speed links
attractive, but closeness counts)
Bandwidth
Link utilization
For simplicity, our examples assume that the cost for the path is
additive.
Example network
In this simple case, solution is clear from inspection
A
R1
R2
R4
R3
R6
R5
R7
R8
Flooding
Routers forward packets to all ports
except the ingress port.
R1
Advantages:
Simple.
Every destination in the network is reachable.
Disadvantages:
Some routers receive a packet multiple times.
Packets can go round in loops forever.
Inefficient.
Spanning Trees
Find the lowest cost route from each of
(R1, , R7) to R8 (the same as from R8 to the rest for this case)
R1
R2
R4
R3
R6
R5
R7
R8
A Spanning Tree
1
R1
R2
R4
R3
R5
R6
R7
2
3
R8
Finds the shortest paths, from a given source node, say node 8, to all other
nodes (i is the index for destinations).
General idea:
First find the shortest single arc path,
Then the shortest path of at most two arcs, etc.
Let dij be the cost between node i to j; and dij= if (i,j) is not directly linked
If all weights are positive, algorithm terminates in N-1 steps, where N is the
no. of nodes in the network.
*Notations are similar to those used in Bertsekas and Gallager.
Bellman-Ford Algorithm
R1
Example
R3
R1
R2
R4
R3
R5
R6
2
R8
R7
R2
4
R4
R5
R7
R6
2
3
R8
Bellman-Ford Algorithm
6
R1
R2
R5
R3
R4
6
3
R6
R7
R8
Solution
5
R1
R2
2
4
R3
R4
R5
R6
R7 3
2
R8
R1
R5
R2
R5
R3
R3
R4
R5
R5
R5
R6
R6
R7
R7
Next Hop
Distributed Bellman-Ford
Let N(i) be a set of neighbors of node i:
Di(h+1) = min {j in N(i)} [Dj(h) +dji] for i8; D8(h+1) = 0
Only need to keep/eachange distance information from/with neighbors.
Bellman-Ford Algorithm
Questions:
1.
2.
3.
R2
R3
R4
R3
R1
R2
3,R2
2,R3
1, R4
3,R2
2,R3
3,R2
3,R2
4,R3
3,R2
5,R2
4,R3
5,R2
Counting
to
infinity
R3
d34=inf.
R4 fails
2.
3.
Step 2:
S = {R8 , R5},
C = {R3 , R7 , R6 , R2 }.
Step 3:
S = {R8 , R5 , R6},
C = {R3 , R7 , R2 , R4 }.
Step 4:
R5
R8
R6
R5
R8
S = {R8 , R5 , R6 , R7 },
C = {R3 , R2 , R4}.
R6
R5
R7
R8
R1
R2
R4
R6
2
R3
R5
R7
3
R8