Computer Networking Interpla between roung, forwarding routing algorithm local forwarding table header alue output link 000 00 0 00 alue in arriing packet s header 0
Graph abstracon Graph: G = (N,E) u w N = set of routers = { u,, w,,, } E = set of links ={ (u,), (u,), (,), (,w), (,w), (,), (w,), (w,), (,) } Remark: Graph abstraction is useful in other network contets Eample: PP, where N is set of peers and E is set of TCP connections Graph abstracon: costs u w c(, ) = cost of link (, ) - e.g., c(w,) = cost could alwas be, or inersel related to bandwidth, or inersel related to congestion Cost of path (,,,, p ) = c(, ) + c(, ) + + c( p-, p ) Question: What s the least-cost path between u and? Routing algorithm: algorithm that finds least-cost path
Roung Algorithm classificaon Global or decentralied informaon? Global: all routers hae complete topolog, link cost info link state algorithms Decentralied: router knows phsicall- connected neighbors, link costs to neighbors iterae process of computaon, echange of info with neighbors distance ector algorithms Stac or dnamic? Stac: routes change slowl oer me Dnamic: routes change more quickl periodic update in response to link cost changes A Link- State Roung Algorithm Dijkstra s algorithm net topolog, link costs known to all nodes accomplished ia link state broadcast all nodes hae same info computes least cost paths one node ( source ) to all other nodes gies forwarding table for that node iterae: aqer k iteraons, know least cost path to k dest. s Notaon: c(,): link cost node to ; = if not direct neighbors D(): current alue of cost of path source to dest. p(): predecessor node along path source to N': set of nodes whose least cost path definiel known
Dijsktra s Algorithm Initialiation: N' = {u} for all nodes 4 if adjacent to u then D() = c(u,) 6 else D() = 7 8 Loop 9 find w not in N' such that D(w) is a minimum 0 add w to N' update D() for all adjacent to w and not in N' : D() = min( D(), D(w) + c(w,) ) /* new is either old or known 4 shortest path w plus cost w to */ until all nodes in N' Dijkstra s algorithm: eample Step 0 4 N' u u u u uw uw D(),p(),u,u,u D(w),p(w),u 4,,, D(),p(),u D(),p(), D(),p() 4, 4, 4, u w 4
Dijkstra s algorithm: eample () Resulting shortest-path tree u: u w Resulting forwarding table in u: destination w link (u,) (u,) (u,) (u,) (u,) Dijkstra s algorithm, discussion Algorithm compleit: n nodes each iteraon: need to check all nodes, w, not in N n(n+)/ comparisons: O(n ) more efficient implementaons possible: O(nlogn) Oscillaons possible: e.g., link cost = amount of carried traffic A +e D 0 0 B 0 e C e initiall +e A 0 D B 0 +e 0 C recompute routing 0 A +e D B 0 0 +e C recompute +e A 0 D B 0 +e e C recompute
Distance Vector Algorithm Bellman- Ford Equaon (dnamic programming) Define d () := cost of least- cost path to Then d () = min {c(,) + d () } where min is taken oer all neighbors of Bellman- Ford eample u w Clearl, d () =, d () =, d w () = B-F equation sas: d u () = min { c(u,) + d (), c(u,) + d (), c(u,w) + d w () } = min { +, +, + } = 4 Node that achiees minimum is net hop in shortest path forwarding table 6
Distance Vector Algorithm D () = esmate of least cost to Node knows each neighbor : c(,) Node maintains distance ector D = [D (): є N ] Node also maintains its neighbors distance ectors For each neighbor, maintains D = [D (): є N ] Distance ector algorithm (4) Basic idea: From me- to- me, each node sends its own distance ector esmate to neighbors Asnchronous When a node receies new DV esmate neighbor, it updates its own DV using B- F equaon: D () min {c(,) + D ()} for each node N Under minor, natural conditions, the estimate D () conerge to the actual least cost d () 7
Distance Vector Algorithm () Iterae, asnchronous: each local iteraon caused b: local link cost change DV update message neighbor Distributed: each node nofies neighbors onl when its DV changes neighbors then nof their neighbors if necessar Each node: wait for (change in local link cost or msg neighbor) recompute estimates if DV to an dest has changed, notif neighbors D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table 0 7 node table 0 node table 7 0 0 0 7 0 time D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 7 8
D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table 0 7 0 0 0 0 7 0 0 node table 0 7 0 0 0 0 7 0 0 node table 7 0 0 7 0 0 0 0 0 time D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 7 Distance Vector: link cost changes Link cost changes: node detects local link cost change updates routing info, recalculates distance ector if DV changes, notif neighbors 4 0 good news traels fast At time t 0, detects the link-cost change, updates its DV, and informs its neighbors. At time t, receies the update and updates its table. It computes a new least and sends its neighbors its DV. At time t, receies s update and updates its distance table. s least costs do not change and hence does not send an message to. 9
Distance Vector: link cost changes Link cost changes: good news traels fast bad news traels slow - count to infinit problem! 44 iterations before algorithm stabilies: see tet Poisoned reerse: 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 ia Z) will this completel sole count to infinit problem? 60 4 0 Comparison of LS and DV algorithms Message compleit LS: with n nodes, E links, O(nE) msgs sent DV: echange between neighbors onl conergence me aries Speed of Conergence LS: O(n ) algorithm requires O(nE) msgs ma hae oscillaons DV: conergence me aries ma be roung loops count- to- infinit problem Robustness: what happens if router malfuncons? LS: node can aderse incorrect link cost each node computes onl its own table DV: DV node can aderse incorrect path cost each node s table used b others error propagate thru network 0
Hierarchical Roung Our routing stud thus far - idealiation all routers identical network flat not true in practice scale: with 00 million desnaons: can t store all dest s in roung tables! roung table echange would swamp links! administrae autonom internet = network of networks each network admin ma want to control roung in its own network Hierarchical Roung aggregate routers into regions, autonomous sstems (AS) routers in same AS run same roung protocol intra- AS roung protocol routers in different AS can run different intra- AS roung protocol Gatewa router Direct link to router in another AS
Interconnected ASes c a b AS a c d b Intra-AS Routing algorithm AS Forwarding table Inter-AS Routing algorithm a c b AS forwarding table configured b both intra- and inter- AS roung algorithm intra- AS sets entries for internal dests inter- AS & intra- As sets entries for eternal dests Inter- AS tasks suppose router in AS receies datagram desned outside of AS: router should forward packet to gatewa router, but which one? AS must:. learn which dests are reachable through AS, which through AS. propagate this reachabilit info to all routers in AS Job of inter- AS roung! c a b AS a c d b AS a c b AS