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) � what’s inside a router? 0100 3 � dealing with scale � IP: Internet Protocol 0101 2 � how a router works � 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 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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 2 inversely related to bandwidth, x y 1 Graph: G = (N,E) 1 or inversely related to 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 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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 uppe/nere och kan kostnaden för varje länk � all routers have complete over time topology, link cost info � Basidé Dynamic: � “link state” algorithms � Alla noder vet hur de ska nå närmsta granne, låt � routes change more Decentralized: alla veta det (alla får komplett bild) � router knows physically- quickly connected neighbors, link � Beror av två mekanismer � periodic update costs to neighbors • Tillförlitlig spridning av link-state information � in response to link � iterative process of • Beräkning av vägar från summan av all ackumulerad cost changes computation, exchange of information info with neighbors � “distance vector” algorithms 23/4-07 23/4-07 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 of path from source to 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 path to k dest.’s 15 until all nodes in N' 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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: 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 4. Om T är tom avbryt, annars ta den med lägst kostnad i T och B D B D 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 Exempel på tavlan … recompute … recompute initially routing 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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 y c(u,x) + d x (z), 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 23/4-07 23/4-07 Datakommunikation - Jonny Pettersson, UmU Datakommunikation - Jonny Pettersson, UmU 2

  3. Distance Vector Algorithm (3) Distance vector algorithm (4) � D x (y) = estimate of least cost from x to y Basic idea: � Each node periodically sends its own distance � Distance vector: D x = [D x (y): y є N ] vector estimate to neighbors � Node x knows cost to each neighbor v: � When a node x receives new DV estimate from c(x,v) neighbor, it updates its own DV using B-F equation: � Node x maintains D x = [D x (y): y є N ] D x (y) ← min v {c(x,v) + D v (y)} for each node y ∊ N � Node x also maintains its neighbors’ distance vectors � Under minor, natural conditions, the estimate D x (y) converge to the actual least cost d x (y) � For each neighbor v, x maintains D v = [D v (y): y є N ] 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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 23/4-07 Datakommunikation - Jonny Pettersson, UmU 23/4-07 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 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 23/4-07 23/4-07 Datakommunikation - Jonny Pettersson, UmU Datakommunikation - Jonny Pettersson, UmU 3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend