1
play

1 A Link-State Routing Algorithm Dijsktras Algorithm Dijkstras - PDF document

Interplay between routing and Network Layer forwarding Goals: Overview: understand principles last time routing algorithm behind network layer network layer services services: virtual circuit and datagram local forwarding


  1. Interplay between routing and Network Layer forwarding Goals: Overview: � understand principles � last time routing algorithm behind network layer � network layer services services: � virtual circuit and datagram local forwarding table � forwarding networks header value output link � routing (path selection) � IP: Internet Protocol 0100 3 � dealing with scale � (what’s inside a router?) 0101 2 � (how a router works) � (how a router works) � t d � today 0111 2 1001 1 � advanced topics: IPv6, � routing algorithms (multicast) • Link state � instantiation and • Distance Vector value in arriving implementation in the • Hierarchical routing packet’s header Internet � routing in the Internet 1 0111 • RIP • OSPF 2 3 • BGP � (broadcast and multicast routing) 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Graph abstraction Graph abstraction: costs 5 5 • c(x,x’) = cost of link (x,x’) 3 v w 3 v w 5 2 5 - e.g., c(w,z) = 5 2 u z 2 1 u z 2 3 1 3 • cost could always be 1, or 1 1 2 x y y 2 inversely related to bandwidth, x x y y 1 1 Graph: G = (N,E) Graph: G = (N E) or inversely related to l l d 1 congestion N = set of routers = { u, v, w, x, y, z } Cost of path (x 1 , x 2 , x 3 ,…, x p ) = c(x 1 ,x 2 ) + c(x 2 ,x 3 ) + … + c(x p-1 ,x p ) E = set of links ={ (u,v), (u,x), (u,w), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Question: What’s the least-cost path between u and z ? Remark: Graph abstraction is useful in other network contexts Routing algorithm: algorithm that finds least-cost path Example: P2P, where N is set of peers and E is set of TCP connections 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Datakommunikation - Jonny Pettersson, UmU Link State Routing Algorithm classification Global or decentralized Static or dynamic? � Förutsättning information? Static: � Varje nod kan kolla om närmsta granne är Global: � routes change slowly over uppe/nere och kan kostnaden för varje länk time � all routers have complete topology, link cost info Dynamic: � Basidé � “link state” algorithms link state algorithms � routes change more quickly � routes change more quickly � � Alla noder vet hur de ska nå närmsta granne, låt Decentralized: � periodic update alla veta det (alla får komplett bild) � router knows physically- � in response to link cost � Beror av två mekanismer connected neighbors, link changes costs to neighbors • Tillförlitlig spridning av link-state information � iterative process of • Beräkning av vägar från summan av all ackumulerad computation, exchange of information info with neighbors � “distance vector” algorithms 29/9-09 29/9-09 Datakommunikation - Jonny Pettersson, UmU Datakommunikation - Jonny Pettersson, UmU 1

  2. A Link-State Routing Algorithm Dijsktra’s Algorithm Dijkstra’s algorithm Notation: 5 1 Initialization: 3 � net topology, link costs 2 N' = {u} � c(x,y): link cost from node v w 5 3 for all nodes v 2 known to all nodes x to y; = ∞ if not direct u z 4 if v adjacent to u 2 1 � accomplished via “link neighbors 3 5 then D(v) = c(u,v) 1 state broadcast” 2 � D(v): current value of cost x y 6 else D(v) = ∞ 1 � all nodes have same info � all nodes have same info of path from source to f p th f m s t 7 7 � computes least cost paths dest. v 8 Loop from one node (‘source”) to 9 find w not in N' such that D(w) is a minimum � p(v): predecessor node all other nodes 10 add w to N' along path from source to v � gives forwarding table 11 update D(v) for all v adjacent to w and not in N' : � N': set of nodes whose for that node 12 D(v) = min( D(v), D(w) + c(w,v) ) least cost path definitively � iterative: after k 13 /* new cost to v is either old cost to v or known known 14 shortest path cost to w plus cost from w to v */ iterations, know least cost 15 until all nodes in N' path to k dest.’s 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Datakommunikation - Jonny Pettersson, UmU Forward Search Algorithm Dijkstra’s algorithm, discussion Algorithm complexity: n nodes � Två listor – bekräftade (C) och möjliga (T) � each iteration: need to check all nodes, w, not in N � n(n+1)/2 comparisons: O(n 2 ) 1. Confirm = {s} � more efficient implementations possible: O(nlogn) 2. Kalla senaste till C adderade nod NEXT 3. För varje granne till NEXT beräkna kostnaden som summan Oscillations possible: p av kostnaden från s till NEXT och NEXT till granne av kostnaden från s till NEXT och NEXT till granne � e.g., link cost = amount of carried traffic (a) Om grannen ej finns i C eller T, lägg i T (b) Om grannen finns i T och den nya kostnaden är A A A A lägre, uppdatera 1 1+e 2+e 0 0 2+e 2+e 0 D B D B D B D 4. Om T är tom avbryt, annars ta den med lägst kostnad i T och 0 0 B 1+e 1 0 0 1+e 1 e 0 flytta till C samt hoppa till 2 0 0 1 e 1+e 0 C C C C 1 1 e … recompute … recompute … recompute Exempel på tavlan initially routing 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector Algorithm (1) Bellman-Ford example (2) 5 Bellman-Ford Equation Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 3 v w Define 5 2 B-F equation says: u z d x (y) := cost of least-cost path from x to y 2 1 3 1 d u (z) = min { c(u,v) + d v (z), 2 x x y y c(u,x) + d x (z), ( ) d ( ) 1 1 Then c(u,w) + d w (z) } = min {2 + 5, 1 + 3, d x (y) = min {c(x,v) + d v (y) } 5 + 3} = 4 Node that achieves minimum is next where min is taken over all neighbors of x hop in shortest path ➜ forwarding table 29/9-09 29/9-09 Datakommunikation - Jonny Pettersson, UmU Datakommunikation - Jonny Pettersson, UmU 2

  3. Distance Vector Algorithm (3) Distance vector algorithm (4) Basic idea: � D x (y) = estimate of least cost from x to y � From time-to-time, each node sends its own � Node x knows cost to each neighbor v: distance vector estimate to neighbors c(x,v) � Asynchronous � Node x maintains � Node x maintains � When a node x receives new DV estimate from � When a node x receives new DV estimate from neighbor v , it updates its own DV using B-F � Distance vector: D x = [D x (y): y є N ] equation: � Node x also maintains its neighbors’ D x (y) ← min v {c(x,v) + D v (y)} for each node y � N distance vectors � For each neighbor v, x maintains � Under minor, natural conditions, the estimate D v = [D v (y): y є N ] D x (y) converge to the actual least cost d x (y) 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector Algorithm (5) Distance Vector: link cost changes Iterative, asynchronous: Each node: Link cost changes: 1 each local iteration caused � node detects local link cost change y 4 1 by: � updates routing info, recalculates x z � local link cost change wait for (change in local link distance vector 50 cost or msg from neighbor) � DV update message from � if DV changes, notify neighbors neighbor At time t 0 , y detects the link-cost change, updates its DV, Distributed: and informs its neighbors recompute estimates “good � each node notifies neighbors only when its DV news At time t 1 , z receives the update from y and updates its table. changes It computes a new least cost to x and sends its neighbors its DV travels if DV to any dest has � neighbors then notify fast” changed, notify neighbors At time t 2 , y receives z ’s update and updates its distance table. their neighbors if y ’s least costs do not change and hence y does not send any necessary message to z Exempel på tavlan 29/9-09 Datakommunikation - Jonny Pettersson, UmU 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector: link cost changes Comparison of LS and DV algorithms Link cost changes: Message complexity Robustness: what happens � good news travels fast 60 if router malfunctions? � LS: with n nodes, E links, y � bad news travels slow - 4 1 O(nE) msgs sent LS: “count to infinity” problem! x z � DV: exchange between 50 � node can advertise � 44 iterations before neighbors only incorrect link cost algorithm stabilizes: see � convergence time varies � each node computes only � each node computes only text text its own table Speed of Convergence Poissoned reverse: DV: � LS: O(n 2 ) algorithm requires � If Z routes through Y to O(nE) msgs � DV node can advertise get to X : incorrect path cost � may have oscillations � Z tells Y its (Z’s) distance � each node’s table used by to X is infinite (so Y won’t � DV: convergence time varies route to X via Z) others � may be routing loops � will this completely solve • error propagate thru � count-to-infinity problem count to infinity problem? network 29/9-09 29/9-09 Datakommunikation - Jonny Pettersson, UmU Datakommunikation - Jonny Pettersson, UmU 3

Recommend


More recommend