1
play

1 Graph abstraction: costs 5 c(x,x) = cost of link (x,x) 3 v w - PDF document

Network Layer Goals: Overview: understand principles last time behind network layer network layer services services: virtual circuit and datagram forwarding networks routing (path selection) IP: Internet Protocol


  1. Network Layer Goals: Overview: � understand principles � last time behind network layer � network layer services services: � virtual circuit and datagram � forwarding networks � routing (path selection) � IP: Internet Protocol � dealing with scale � (what’s inside a router?) � (how a router works) � (how a router works) � t d � today � advanced topics: IPv6, � routing algorithms (multicast) • Link state � instantiation and • Distance Vector implementation in the • Hierarchical routing Internet � routing in the Internet • RIP • OSPF • BGP � (broadcast and multicast routing) 29/9-09 Datakommunikation - Jonny Pettersson, UmU Interplay between routing and forwarding routing algorithm local forwarding table header value output link 0100 3 0101 2 0111 2 1001 1 value in arriving packet’s header 1 0111 2 3 29/9-09 Graph abstraction 5 3 v w 5 2 u z 2 1 3 1 x 2 y y 1 1 Graph: G = (N,E) Graph: G = (N E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (u,w), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections 29/9-09 Datakommunikation - Jonny Pettersson, UmU 1

  2. Graph abstraction: costs 5 • c(x,x’) = cost of link (x,x’) 3 v w 5 - e.g., c(w,z) = 5 2 u z 2 1 3 • cost could always be 1, or 1 2 inversely related to bandwidth, x x y y 1 or inversely related to l l d congestion 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 ) Question: What’s the least-cost path between u and z ? Routing algorithm: algorithm that finds least-cost path 29/9-09 Datakommunikation - Jonny Pettersson, UmU Routing Algorithm classification Global or decentralized Static or dynamic? information? Static: Global: � routes change slowly over time � all routers have complete topology, link cost info Dynamic: � “link state” algorithms link state algorithms � routes change more quickly � routes change more quickly � Decentralized: � periodic update � router knows physically- � in response to link cost connected neighbors, link changes costs to neighbors � iterative process of computation, exchange of info with neighbors � “distance vector” algorithms 29/9-09 Datakommunikation - Jonny Pettersson, UmU Link State � Förutsättning � Varje nod kan kolla om närmsta granne är uppe/nere och kan kostnaden för varje länk � Basidé � Alla noder vet hur de ska nå närmsta granne, låt alla veta det (alla får komplett bild) � Beror av två mekanismer • Tillförlitlig spridning av link-state information • Beräkning av vägar från summan av all ackumulerad information 29/9-09 Datakommunikation - Jonny Pettersson, UmU 2

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

  4. Dijkstra’s algorithm, discussion Algorithm complexity: n nodes � each iteration: need to check all nodes, w, not in N � n(n+1)/2 comparisons: O(n 2 ) � more efficient implementations possible: O(nlogn) Oscillations possible: p � e.g., link cost = amount of carried traffic A A A A 1 1+e 2+e 0 0 2+e 2+e 0 D B D B D B D 0 B 0 1+e 1 0 0 1+e 1 0 e 0 0 1 1+e 0 e C C C C 1 1 e … recompute … recompute … recompute initially routing 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector Algorithm (1) Bellman-Ford Equation Define d x (y) := cost of least-cost path from x to y Then d x (y) = min {c(x,v) + d v (y) } where min is taken over all neighbors of x 29/9-09 Datakommunikation - Jonny Pettersson, UmU Bellman-Ford example (2) 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 3 v w 5 2 B-F equation says: u z 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 c(u,w) + d w (z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table 29/9-09 Datakommunikation - Jonny Pettersson, UmU 4

  5. Distance Vector Algorithm (3) � D x (y) = estimate of least cost from x to y � Node x knows cost to each neighbor v: c(x,v) � Node x maintains � Node x maintains � Distance vector: D x = [D x (y): y є N ] � Node x also maintains its neighbors’ distance vectors � For each neighbor v, x maintains D v = [D v (y): y є N ] 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance vector algorithm (4) Basic idea: � From time-to-time, each node sends its own distance vector estimate to neighbors � Asynchronous � 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 equation: D x (y) ← min v {c(x,v) + D v (y)} for each node y � N � Under minor, natural conditions, the estimate D x (y) converge to the actual least cost d x (y) 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector Algorithm (5) Iterative, asynchronous: Each node: each local iteration caused by: � local link cost change wait for (change in local link cost or msg from neighbor) � DV update message from neighbor Distributed: recompute estimates � each node notifies neighbors only when its DV changes if DV to any dest has � neighbors then notify changed, notify neighbors their neighbors if necessary Exempel på tavlan 29/9-09 Datakommunikation - Jonny Pettersson, UmU 5

  6. Distance Vector: link cost changes Link cost changes: 1 � node detects local link cost change y 4 1 � updates routing info, recalculates x z distance vector 50 � if DV changes, notify neighbors At time t 0 , y detects the link-cost change, updates its DV, and informs its neighbors “good news At time t 1 , z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV travels fast” At time t 2 , y receives z ’s update and updates its distance table. y ’s least costs do not change and hence y does not send any message to z 29/9-09 Datakommunikation - Jonny Pettersson, UmU Distance Vector: link cost changes Link cost changes: � good news travels fast 60 y � bad news travels slow - 4 1 “count to infinity” problem! x z 50 � 44 iterations before algorithm stabilizes: see text text Poissoned reverse: � 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 via Z) � will this completely solve count to infinity problem? 29/9-09 Datakommunikation - Jonny Pettersson, UmU Comparison of LS and DV algorithms Message complexity Robustness: what happens if router malfunctions? � LS: with n nodes, E links, O(nE) msgs sent LS: � DV: exchange between � node can advertise neighbors only incorrect link cost � convergence time varies � each node computes only � each node computes only its own table Speed of Convergence DV: � LS: O(n 2 ) algorithm requires O(nE) msgs � DV node can advertise incorrect path cost � may have oscillations � each node’s table used by � DV: convergence time varies others � may be routing loops • error propagate thru � count-to-infinity problem network 29/9-09 Datakommunikation - Jonny Pettersson, UmU 6

Recommend


More recommend