Interpla tra routing e forwarding routing algorithm local forwarding table header value output link 000 00 0 00 value in arriving packet s header 0 Network Laer 4-
Grafi Grafo: G = (N,E) u v w N = insieme di routers = { u, v, w,,, } E = insieme di links ={ (u,v), (u,), (v,), (v,w), (,w), (,), (w,), (w,), (,) } Nota: astraione utile anche in altri contesti Esempio: PP, dove N e l insieme di peers e E le connessioni TCP Network Laer 4-
Costi u v w c(, ) = costo del link ( - e.g., c(w,) = cost could alwas be, or inversel related to bandwid or inversel related to congestion Costo del cammino (,,,, p ) = c(, ) + c(, ) + + c( p-, p ) Question: qual e il cammino di costo minimo tra u and? Routing algorithm: algorithm that finds least-co Network Laer 4-
Classificaione dei Routing Algorithm Global or decentralied information? Global: all routers have complete topolog, link cost info link state algorithms Decentralied: router knows phsicall-connected neighbors, link costs to neighbors iterative process of computation, echange of info with neighbors distance vector algorithms Network Laer 4-4
A Link-State Routing Algorithm Dijkstra s algorithm net topolog, link costs known to all nodes accomplished via link state broadcast all nodes have same info computes least cost paths one node ( source ) to all other nodes gives forwarding table for that node iterative: after k iterations, know least cost path to k dest. s Notation: c(,): link cost node to ; = if not direct neighbors D(v): current value of cost of path source to dest. v p(v): predecessor node along path source to v N': set of nodes whose least cost path definitivel known Network Laer 4-
Dijsktra s Algorithm Initialiation: N' = {u} for all nodes v 4 if v adjacent to u then D(v) = c(u,v) 6 else D(v) = 7 8 Loop 9 find w not in N' such that D(w) is a minimum 0 add w to N' update D(v) for all v adjacent to w and not in N' : D(v) = min( D(v), D(w) + c(w,v) ) /* new cost to v is either old cost to v or known 4 shortest path cost to w plus cost w to v */ until all nodes in N' Network Laer 4-6
Network Laer 4-7 Dijkstra s algorithm: eample Step 0 4 N' u u u uv uvw uvw D(v),p(v),u,u,u D(w),p(w),u 4,,, D(),p(),u D(),p(), D(),p() 4, 4, 4, u w v
Dijkstra s algorithm: eample () Resulting shortest-path tree u: u v w Resulting forwarding table in u: destination link v w (u,v) (u,) (u,) (u,) (u,) Network Laer 4-8
Vettori Distana Bellman-Ford Equation Definiamo d () := cost of least-cost path to Allora d () = min {c(,v) + d v () } v dove min e' su tutti i vicini v of Network Laer 4-9
Bellman-Ford eample u v w E' chiaro che d v () =, d () =, d w () = L'equaione B-F dice: d u () = min {c(u,v) + d v (), c(u,) + d (),c(u,w) + d w ()} = min { +, +, + } = 4 Il nodo che ottiene il minimo e' il prossimo hop nella tabella di inoltro Network Laer 4-0
Vettori Distane D () = estimate of least cost to Distance vector: D = [D (): є N ] Node knows cost to each neighbor v: c(,v) Node maintains D = [D (): є N ] Node also maintains its neighbors distance vectors For each neighbor v, maintains D v = [D v (): є N ] Network Laer 4-
Distance vector algorithm (4) Basic idea: Each node periodicall sends its own distance vector estimate to neighbors When a node receives new DV estimate neighbor, it updates its own DV using B-F equation: D () min v {c(,v) + D v ()} for each node N Under minor, natural conditions, the estimate D () converge to the actual least cost d () Network Laer 4-
Distance Vector Algorithm () Iterative, asnchronous: each local iteration caused b: local link cost change DV update message neighbor Distributed: each node notifies neighbors onl when its DV changes neighbors then notif their neighbors if necessar Each node: wait for (change in local link cost of msg neighbor) recompute estimates if DV to an dest has changed, notif neighbors Network Laer 4-
D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table cost to cost to 0 7 node table cost to 0 node table cost to 7 0 0 0 7 0 cost to 0 7 0 7 0 cost to 0 7 0 0 D ()= min{c(,)+ D (), c(,) + D ()} = min{+,7+0} = cost to 0 0 0 cost to 0 0 0 cost to 0 0 0 time 7 Network Laer 4-4