Smith College, CSC 249 March 6, 2018 1 Overview q Routing Algorithms v Link-state – From last week v Distance-vector – TODAY 2 1
Overview of Routing so far v Routing algorithms v Find the ‘best’ path through a network v Create forwarding tables v Routing occurs between routers (not hosts) v Differences between centralized (global) and decentralized algorithms v What are examples of each v Amount of information known initially v How information is shared/spread v Synchronous or asynchronous? 3 Algorithm 2: Distance Vector Rather than using global information, a distance vector algorithm is: q distributed: v each node communicates only with directly- attached neighbors q iterative: v continues until no nodes exchange info. v self-terminating: no “signal” to stop q asynchronous: v nodes need not exchange information or iterate in lock step! 4 2
Distance Vector Algorithm Bellman-Ford Equation Define d x (y) := cost of least-cost path from x to y Then d x (y) = min {c(x,v) + d v (y) } v where min is taken over all neighbors v of x Bellman-Ford Equation 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 3 v w 5 2 B-F equation says: u z 2 1 3 1 d u (z) = min { c(u,v) + d v (z), 2 x y c(u,x) + d x (z), 1 c(u,w) + d w (z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 The node that achieves the minimum, is the next hop in the shortest path ➜ forwarding table 6 3
Distance Vector Routing Algorithm Distance Table data structure q each node has v A row for each possible destination v A column for each directly-attached neighbor q example: in node X, for destination Y via neighbor Z: distance from X to Y, = x via Z as next hop D (Y,Z) Z c(X,Z) + min {D (Y,w)} = w 7 Distance Table: example with complete information E cost to destination via 1 B C D () 7 A B D A 8 2 1 A 1 14 5 E D 2 B 7 8 5 n E o D i c(E,D) + min {D (C,w)} t D (C,D) = a w n i C t 6 9 4 = 2+2 = 4 s e E d D c(E,D) + min {D (A,w)} D (A,D) = w D 4 11 2 = 2+3 = 5 loop! E B c(E,B) + min {D (A,w)} D (A,B) = w = 8+6 = 14 loop! 8 4
Distance table to forwarding table E cost to destination via Outgoing link D () A B D to use, cost A 1 14 5 A A,1 B 7 8 5 B D,5 n n o o i t i t a a n n i C 6 9 i t 4 C D,4 t s s e e d d D 4 11 2 D D,2 Forwarding Table Routing table Distance table 9 Distance vector algorithm Asynchronous Iterations: q Each node begins with D x (y) v An estimate of the cost of the least-cost path from itself to node y, for all nodes in N q Each node periodically sends its own distance vector estimate to neighbors v è A vector of least costs from itself to all routers q When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation, and sends any update to its neighbors D x (y) ← min v {c(x,v) + D v (y)} for each node y ∊ N q Under normal conditions, the estimate D x (y) converges to the actual least cost d x (y) 10 5
Distance Vector Algorithm: example for obtaining complete information Y 2 1 X Z Z X = 7 c(X,Z) + min {D (Y,w)} D (Y,Z) w = 7+1 = 8 Y X = D (Z,Y) c(X,Y) + min {D (Z,w)} w = 2+1 = 3 11 Distance Vector Algorithm: obtaining info Y 2 1 X Z 7 12 6
Distance Vector Routing Activity B A C D 13 Distance Vector Routing Activity 1 B A 3 6 2 C D 8 • Review actual graph – does it match activity results? • What happens if/when c(A,D) = 4 & c(C,D) = 1? 14 7
Distance Vector Routing Activity C B A E D 15 Distance Vector Routing Activity 1 C B 7 A 8 2 1 E D 2 • Review actual graph – does it match your results? • What happens if/when c(A,B) = 2 and/or if c(C,D) = 5? 16 8
Comparison of LS and DV algorithms q Information requirements q Message complexity q Convergence time varies q Robustness: what happens if router malfunctions? q Oscillations possible? q Loops possible? 17 Summary Forwarding: q Leads to questions of addressing v Assignment of IP addresses v NAT, IPv6 … Routing: q Routing objectives q Routing notation q Routing classification q Link state v. Distance Vector q Hierarchical structure 18 9
Recommend
More recommend