Download presentation
Presentation is loading. Please wait.
1
Routing: Distance Vector Algorithm
Networking CS 3470, Section 1
2
Review So how is routing different from forwarding?
3
The University of Adelaide, School of Computer Science
19 September 2018 Routing Network as a Graph The basic problem of routing is to find the lowest-cost path between any two nodes Where the cost of a path equals the sum of the costs of all the edges that make up the path 5 3 B C 2 5 A 2 1 F 3 1 2 D E 1 Chapter 2 — Instructions: Language of the Computer
4
Routing Routing protocols need to be both dynamic and distributed
Deal with node and link failures, changing link costs, and scalability
5
Distributed Routing Algorithms
Two standard distributed routing algorithms Link state routing Distance vector routing What link state routing protocol did we discuss last time?
6
Link State vs Distance Vector
Both assume that The address of each neighbor is known The cost of reaching each neighbor is known Both find global information By exchanging routing info among neighbors Differ in info exchanged and route computation LS: tells every other node its distance to neighbors DV: tells neighbors its distance to every other node
7
Distance Vector Routing
A router tells neighbors its distance to every router Communication between neighbors only Each router maintains a distance table A row for each possible destination A column for each neighbor DX(Y,Z) : distance from X to Y via Z So far we have talked about link state routing. Under link state routing each router receives complete information about the network topology and computes shortest paths using Dijkstra’s algorithm. Now we will discuss a different routing protocol called distance vector Routing. Under distance vector routing, a router informs its neighbors about the distance from that router to every other router in the network. Unlike in link state routing, here information is exchanged only between neighbors. It is based on Bellman-Ford algorithm for computing shortest paths. We will go through an example to see how this works. Under distance vector routing, each router maintains a distance table. A row for each possible destination and a column for each neighbor. An entry in router X’s table corresponding to a row Y and a column Z is the distance from X to Y via Z. Given a distance table we can find the shortest distance to a destination, i.e., the smallest value in the row corresponding to the destination. A list of <destination, shortest distance> tuples is called a distance vector and these distance vectors are exchanged between neighbors.
8
Distance Vector Routing
Given a distance table we can find the shortest distance to a destination i.e., the smallest value in the row corresponding to the destination. A list of <destination, shortest distance> tuples is called a distance vector Current least cost to each destination Exchanged between neighbors Based on Bellman-Ford algorithm Computes “shortest paths”
9
Distance Table: Example
Distance table at router E D () A B C D 1 7 6 4 14 8 9 11 5 2 E cost to destination via destination A E D C B 7 8 1 2 Lets look at an example. Here A, B, C, D, and E are routers and the links are labeled with their costs. And this is a distance table at router E. You can see that there is one row per each destination an one column per each neighbor. If you look at the third row, it says that you can reach C via A with cost 6, via B with cost 9 and via D with 4. So the shortest distance to C is 4 via D. If E were to advertise its distance vector it will send <A,1>,<B,5>,<C,4>,<D,2>. If E were to advertise its distance vector, it would send <A,1>,<B,5>,<C,4>,<D,2>
10
Distance Table to Routing Table
1 7 6 4 14 8 9 11 5 2 E cost to destination via destination Outgoing link to use, cost A B C D A,1 D,5 D,4 D,2 What we are really interested in is the routing table. How do we create a routing table from this distance table. Pretty simple. For example, to reach B the shortest path is via D. So the next hop for routing to B is D. We can get the whole routing table this way. Now the question is how do we compute this distance table. That’s where we use Bellman-Ford algorithm. destination Distance table Routing table
11
Distance Vector Routing Algorithm
Now the real question… How do we compute this distance table? That’s where we use Bellman-Ford algorithm.
12
Distance Vector Routing Algorithm
iterative: continues until no nodes exchange info. self-terminating: no “signal” to stop asynchronous: nodes need not exchange info/iterate in lock step! distributed: each node talks only with directly-attached neighbors Distance Table data structure each node has its own row for each possible destination column for each directly-attached neighbor to node example: in node X, for dest. Y via neighbor Z: D (Y,Z) X distance from X to Y, via Z as next hop c(X,Z) + min {D (Y,w)} Z w =
13
Distance Vector Routing: Overview
Each node: Iterative, asynchronous: each iteration caused by: local link cost change message from neighbor: its least cost path change from neighbor Distributed: each node notifies neighbors only when its least cost path to any destination changes neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors
14
Distance Vector Algorithm: Example
Z 1 2 7 Y D (Y,Z) X c(X,Z) + min {D (Y,w)} w = 7+1 = 8 Z At beginning, a node only knows the distance to their immediate neighbors. After a few iteration, a node progressively learns the distance to other nodes. D (Z,Y) X c(X,Y) + min {D (Z,w)} w = 2+1 = 3 Y
15
Distance Vector Algorithm: Example
Z 1 2 7 Y This process continues until no one changes the shortest path to others. Some later steps are not shown in the figure.
16
Distance Vector Algorithm: Example
Z 1 2 7 Y This process continues until no one changes the shortest path to others. Some later steps are not shown in the figure.
17
Convergence of DV Routing
router detects local link cost change updates distance table if cost change in least cost path, notify neighbors X Z 1 4 50 Y “good news travels fast” algorithm terminates Now lets look at the convergence of distance vector routing. Here we show only the cost of reaching X from Y and Z. Suppose that the cost of link between X and Y changes from 4 to 1. The router Y notices the change and updates its distance table. Since the shortest distance changed, it notifies Z. The router Z changes the distance to X via Y as 2 from the previous value 5. It then notifies Y since the shortest distance changed. Y once again changes the distance table. However, this time no change in the shortest distance. This is the case when the link cost decreases which is a good news. Now lets see what happens when the link cost increases.
18
Problems with DV Routing
Link cost changes: good news travels fast bad news travels slow “count to infinity” problem! X Z 1 4 50 Y 60 algorithm continues on! Suppose that link cost is increased from 4 to 60. Once again router Y senses the change, updates the distance table. It sees that it can reach X via Z with distance 6. Since the shortest distance changed, it notifies the neighbor Z. The router Z in turn updates its table and informs Y. This goes on and on. Do you know when it terminates? What will be the entries in distance table when it converges? It finally reaches steady state with distance from Y to X via Z as 51 and Z to X via Y as 52. This is the problem with distance vector routing. Good news travels fast but bad news travels slow. This results in what is known as count to infinity problem.
19
Fixes to Count-to-Infinity Problem
Split horizon A router never advertises the cost of a destination to a neighbor If this neighbor is the next hop to that destination Split horizon with poisonous reverse If X routes traffic to Z via Y, then X tells Y that its distance to Z is infinity Instead of not telling anything at all Accelerates convergence
20
Split Horizon with Poisoned Reverse
X Z 1 4 50 Y 60 If Z routes through Y to get to X : Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) algorithm terminates Lets look at the earlier example again. Note that the initially the cost to reach Z from Y via X is infinity since Y is the next hop for Z to reach X. When the cost changes to 60, Y senses it, updates its table and notifies Z. The router Z realizes that direct link to X is shorter than going thru Y and updates its routing table. It then notifies Y which updates its table and makes Z its next hop to reach X. Then as per the rule, Y announces its cost to reach X as infinity. This way routers quickly converge to stable state. Does this solution completely solve the count to infinity problem?
21
Count-to-Infinity Problem
X Y Z W What happens when the link Y to Z goes down? All three routers X, Y, and W together count to infinity. Split horizon solution works only when two routers are involved in a loop. What happens when the link Y to Z goes down. All three routers X, Y, and W together count to infinity. Split horizon solution works only when two routers are involved in a loop. So what is the solution? To completely eliminate the problem, a router some how need to figure out the complete path to a destination. Obvious solution is to pass on the path information along with the distance vector. This path vector approach is used in BGP. Split horizon with poison reverse does not help.
22
Count-to-Infinity Problem
X Y Z W To completely eliminate the problem, a router some how need to figure out the complete path to a destination. Obvious solution is to pass on the path information along with the distance vector. This path vector approach is used in BGP. What happens when the link Y to Z goes down. All three routers X, Y, and W together count to infinity. Split horizon solution works only when two routers are involved in a loop. So what is the solution? To completely eliminate the problem, a router some how need to figure out the complete path to a destination. Obvious solution is to pass on the path information along with the distance vector. This path vector approach is used in BGP. Split horizon with poison reverse does not help.
23
Link State vs Distance Vector
Tells everyone about neighbors Controlled flooding to exchange link state Dijkstra’s algorithm Each router computes its own table May have oscillations Tells neighbors about everyone Exchanges distance vectors with neighbors Bellman-Ford algorithm Each router’s table is used by others May have routing loops Now lets compare these two routing protocols. Under link state, a router tells everyone about its neighbors using controlled flooding. Distance vector case a router communicates with neighbors only to inform about everyone. Link state each router gathers global information and computes its own table using Dijkstra’s algorithm. Distance vector performs distributed computation using other routers tables. We saw that distance vector can cause routing loops. There may be frequent changes in routes in the case of link state. This results in out of order delivery of packets which is undesirable. Both these approaches have advantages and disadvantages. Both are used in the Internet. OSPF is the most popularly used intra-domain routing protocol that is based on link state. RIP is based on distance vector which is being taken over by OSPF. BGP is an inter-domain protocol that uses path vectors.
24
RIP RIP == Routing Information Protocol
RIP is a distance vector implementation Instead of advertising costs to the next router, RIP advertises the cost to the next network. (network_address, distance) pairs
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.