Compter Netorks Roting Algorithms Based on Compter Netorking, 4 th Edition b Krose and Ross Interpla beteen roting, forarding roting algorithm local forarding table header ale otpt link 000 00 0 00 ale in arriing packet s header 0
Graph abstraction Graph: G = (N,E) N = set of roters = {,,,,, } E = set of links ={ (,), (,), (,), (,), (,), (,), (,), (,), (,) } Remark: Graph abstraction is sefl in other netork contets Eample: PP, here N is set of peers and E is set of TCP connections Graph abstraction: costs c(, ) = cost of link (, ) - e.g., c(,) = cost cold alas be, or inersel related to bandidth, or inersel related to congestion Cost of path (,,,, p ) = c(, ) + c(, ) + + c( p-, p ) Qestion: What s the least-cost path beteen and? Roting algorithm: algorithm that finds least-cost path
Roting Algorithm classification Global or decentralied information? Global: all roters hae complete topolog, link cost info link state algorithms Decentralied: roter knos phsicall- connected neighbors, link costs to neighbors iteratie process of comptation, echange of info ith neighbors distance ector algorithms Static or dnamic? Static: rotes change slol oer time Dnamic: rotes change more qickl periodic pdate in response to link cost changes A Link-State Roting Algorithm Dijkstra s algorithm net topolog, link costs knon to all nodes accomplished ia link state broadcast all nodes hae same info comptes least cost paths one node ( sorce ) to all other nodes gies forarding table for that node iteratie: after k iterations, kno least cost path to k destinations Notation: c(,,): link cost node to ; = if not direct neighbors D(): crrent ale of cost of path sorce to dest. p(): predecessor node along path sorce to N': set of nodes hose least cost path definitiel knon
Dijsktra s Algorithm Initialiation: N' = {} for all nodes 4 if adjacent to then D() = c(,) 6 else D() = 7 8 Loop 9 find not in N' sch that D() is a minimm 0 add to N' pdate D() for all adjacent to and not in N' : D() = min( D(), D() + c(,) ) /* ne is either old or knon 4 shortest path pls cost to */ ntil all nodes in N' Dijkstra s algorithm: eample Step 0 4 N' D(),p(),,, D(),p(), 4,,, D(),p(), D(),p(), D(),p() 4, 4, 4, 4
Dijkstra s algorithm: eample () Reslting shortest-path tree : Reslting forarding table in : destination link (,) (,) (,) (,) (,) Dijkstra s algorithm, discssion Algorithm compleit: n nodes each iteration: need to check all nodes,, not in N n(n+)/ comparisons: O(n ) more efficient implementations possible: O(nlogn) Oscillations possible: e.g., link cost = amont of carried traffic A +e D 0 0 B 0 e C e initiall A +e 0 D B 0 +e 0 C recompte roting A 0 +e D B 0 0 +e C recompte +e A 0 D B 0 +e e C recompte
Distance Vector Algorithm Bellman-Ford Eqation (dnamic programming) Define d () := cost of least-cost path to Then d () = min {c(,) + d () } here min is taken oer all neighbors of Bellman-Ford eample Clearl, d () =, d () =, d () = B-F eqation sas: d () = min { c(,) + d (), c(,) + d (), c(,) + d () } = min { +, +, + } = 4 Node that achiees minimm is net hop in shortest path forarding table 6
Distance Vector Algorithm D () = estimate of least cost to Distance ector: D = [D (): є N ] Node knos each neighbor : c(,) Node maintains D = [D (): є N ] Node also maintains its neighbors distance ectors For each neighbor, maintains D = [D (): є N ] Basic idea: Each node periodicall sends its on distance ector estimate to neighbors When a node receies ne DV estimate neighbor, it pdates its on DV sing B-F eqation: D() min{c(,) + D()} for each node N Under minor, natral conditions, the estimate D() conerge to the actal least cost d() Distance Vector Algorithm Iteratie, asnchronos: each local iteration cased b: local link cost change DV pdate message neighbor Distribted: each node notifies neighbors onl hen its DV changes neighbors then notif their neighbors if necessar Each node: ait for (change in local link cost of msg neighbor) recompte estimates if DV to an dest has changed, notif neighbors 7
Distance Vector: link cost changes Link cost changes: node detects local link cost change pdates roting info, recalclates distance ector if DV changes, notif neighbors 4 0 Good nes traels fast At time t 0, detects the link-cost change, pdates its DV, and informs its neighbors. At time t, receies the pdate and pdates its table. It comptes a ne least and sends its neighbors its DV. At time t, receies s pdate and pdates its distance table. s least costs do not change and hence does not send an message to. Distance Vector: link cost changes Link cost changes: 60 good nes traels fast 4 bad nes traels slo - cont to infinit problem! 44 iterations before algorithm stabilies Poissoned reerse: If Z rotes throgh Y to get to X : Z tells Y its (Z s) distance to X is infinite (so Y on t rote to X ia Z) ill this completel sole cont to infinit problem? 0 8
Distance Vector: eample node table D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = D ()=min{c(,)+ D (),c(,)+d ()} = min{+, 7+0} = node table node table 0 7 0 0 0 7 0 0 7 0 7 0 0 0 0 0 0 0 7 7 0 0 7 0 0 0 0 0 time Comparison of LS and DV algorithms Message compleit LS: ith n nodes, E links, O(nE) msgs sent DV: echange beteen neighbors onl conergence time aries Speed of Conergence LS: O(n ) algorithm reqires O(nE) msgs ma hae oscillations DV: conergence time aries ma be roting loops cont-to to-infinit problem Robstness: hat happens if roter malfnctions? LS: node can adertise incorrect link cost each node comptes onl its on table DV: DV node can adertise incorrect path cost each node s table sed b others error propagate thr netork 9
Hierarchical Roting Or roting std ths far - idealiation all roters identical; netork flat not tre in practice scale: ith 00 million destinations: can t store all dest s in roting tables! roting table echange old samp links! administratie atonom internet = netork of netorks each netork admin ma ant to control roting in its on netork aggregate roters into regions, atonomos sstems (AS) roters in same AS rn same roting protocol intra-as roting protocol roters in different AS can rn different intra-as roting protocol Gatea roter Direct link to roter in another AS Interconnected ASes Forarding table is configred b both intra- and inter-as roting algorithm Intra-AS sets entries for internal dests Inter-AS & Intra-As sets entries for eternal dests c a b AS a c d b AS a c b AS Intra-AS Roting algorithm Inter-AS Roting algorithm Forarding table 0
Inter-AS tasks Sppose roter in AS receies datagram for hich dest is otside of AS Roter shold forard packet toards one of the gatea roters, bt hich one? AS needs:. to learn hich dests are reachable throgh AS and hich throgh AS. to propagate this reachabilit info to all roters in AS Job of inter-as roting! c a b AS a c d b AS a c b AS