Routing 9: Intro to Routing lgorithms Last Modified: // :: PM : Netork Layer a- IP Routing each router is supposed to send each IP datagram one step closer to its Ho do they do that? Static Routing Hierarchical Routing in ideal orld ould that be enough? Well its not an ideal orld ynamic Routing Routers communicate amongst themselves to determine good routes (IMP redirect is a simple example of this) efore e cover specific routing protocols e ill cover principles of dynamic routing protocols : Netork Layer a- Routing lgorithm classification: Static or ynamic? hoice : Static or dynamic? Static: routes change sloly over time onfigured by system administrator ppropriate in some circumstances, but obvious drabacks (routes added/removed? sharing load?) Not much more to say? ynamic: routes change more quickly periodic update in response to link cost changes : Netork Layer a- Routing lgorithm classification: Global or decentralized? hoice, if dynamic: global or decentralized information? Global: all routers have complete topology, link cost info link state s ecentralized: router knos physically-connected, link costs to iterative process of computation, exchange of info ith (gossip) distance vector s : Netork Layer a- Roadmap Routing etails of Link State etails of istance Vector omparison Routing protocol Goal: determine good path (sequence of routers) thru netork from source to dest. Graph abstraction for routing s: graph nodes are routers graph edges are physical links link cost: delay, $ cost, or congestion level good path: typically means minimum cost path other definitions possible : Netork Layer a- : Netork Layer a-6
Global ynamic Routing Link-State Routing lgorithm See the big picture; ind the best Route What do you use? : Netork Layer a- ijkstra s Kno complete netork topology ith link costs for each link is knon to all nodes accomplished via link state broadcast In theory, all nodes have same info ased on info from all other nodes, each node individually computes least cost paths from one node ( source ) to all other nodes gives routing table for that node iterative: after k iterations, kno least cost path to k dest. s : Netork Layer a- Link State lgorithm: Some Notation Notation: c(i,j): link cost from node i to j. cost infinite if not direct (v): current value of cost of path from source to dest. V n(v): next hop from this source to v along the least cost path N: set of nodes hose least cost path definitively knon : Netork Layer a-9 ijsktra s lgorithm Initialization kno c(i,j) to start: N {} for all nodes v if v adjacent to then (v) c(,v) 6 else (v) infty Loop 9 find not in N such that () is a minimum (optional?) add to N update (v) for all v adjacent to and not in N: (v) min( (v), () + c(,v) ) /* ne cost to v is either old cost to v or knon shortest path cost to plus cost from to v */ until all nodes in N : Netork Layer a- ijkstra s : example Step start N (),n(),,, (),n() (),n(),,,,, (),n(), (),n(),,, : Netork Layer a- ijkstra s lgorithm gives routing table Outgoing Link n() n() n () n() n() n() : Netork Layer a-
omplexity of Link State lgorithm complexity: n nodes each iteration ind next not in N such that () is a minimum Then for that, check its best path to other s > n*(n+)/ comparisons: O(n ) more efficient implementations possible using a heap: O(nlogn) : Netork Layer a- Oscillations ssume: Link cost amount of carried traffic Link cost is not symmetric and sending unit of traffic; send e units of traffic Initially start ith slightly unbalanced routes veryone goes ith least loaded, making them most loaded for next time, so everyone sitches Herding effect! +e e e Initially start ith almost equal routes +e +e and go clockise to +e +e +e +e e, and go,, go counterclockise clockise : Netork Layer a- Preventing Oscillations void link costs based on experienced load ut ant to be able to route around heavily loaded links void herding effect void all routers recomputing at the same time Not enough to start them computing at a different time because ill synchronize over time as send updates eliberately introduce randomization into time beteen hen receive an update and hen compute a ne route : Netork Layer a- istance Vector Routing lgorithm distributed: each node communicates only ith directlyattached iterative: continues until no nodes exchange info. self-terminating: no signal to stop asynchronous: nodes need not exchange info/iterate in lock step! : Netork Layer a-6 istance Vector Routing lgorithm istance Table data structure each node has its on ro for each possible column for each directlyattached neighbor to node example: in node, for dest. via neighbor : (,) distance from to, via as next hop c(,) + min { (,)} olumn only for each neighbor cost to via () x (,) Ros for each possible dest! : Netork Layer a- xample: istance Table for (ro, col) (,) (,) (,) c(,) + min { (,)} + olumn only for each neighbor cost to via () c(,) + min { (,)} + Loop back through! c(,) + min { (,)} +6 Loop back through! 6 9 Ros for each possible dest! : Netork Layer a-
istance table gives routing table istance Vector Routing: overvie cost to via () 6 9 istance table least cost Outgoing link to use, cost,,,, Routing table Iterative, asynchronous: each local iteration caused by: local link cost change message from neighbor: its least cost path change from neighbor istributed: each node notifies only hen its least cost path to any changes then notify their if necessary ach node: ait for (change in local link cost of msg from neighbor) recompute distance table if least cost path to any dest has changed, notify : Netork Layer a-9 : Netork Layer a- istance Vector lgorithm: t all nodes, : Initialization (don t start knoing link costs for all links in graph): for all adjacent nodes v: (*,v) infty /* the * operator means "for all ros" */ (v,v) c(,v) for all s, y 6 send min (y,) to each neighbor /* over all 's */ Then in steady state : Netork Layer a- istance Vector lgorithm (cont.): loop 9 ait (until I see a link cost change to neighbor V or until I receive update from neighbor V) if (c(,v) changes by d) /* change cost to all dest's via neighbor v by d */ /* note: d could be positive or negative */ for all s y: (y,v) (y,v) + d 6 else if (update received from V rt ) /* shortest path from V to some has changed */ 9 /* V has sent a ne value for its min V(,) */ /* call this received ne value is "neval" */ for the single y: (,V) c(,v) + neval if e have a ne min (,)for any send ne value of min (,) to all 6 forever : Netork Layer a- istance Vector lgorithm: example To start just kno directly connected links tell istance Vector lgorithm: example In steady state, hen have good nes tell neighbor hears nes from and (,) c(,) + min { (,)} + (,) c(,) + min { (,)} + : Netork Layer a- : Netork Layer a-
istance Vector: link cost changes istance Vector: link cost changes Link cost changes: node detects local link cost change updates distance table (line ) if cost change in least cost path, notify (lines,) Link cost changes: good nes travels fast bad nes travels slo - count to problem! 6 good nes travels fast terminates nyone see a problem? continues on! : Netork Layer a- : Netork Layer a-6 istance Vector: poisoned reverse If routes through to get to : Originally, tells its ( s) distance to is infinite (so on t route to via ) In end, tells ill this completely solve count to problem? 6 terminates igger Loops and Poison Reverse (,) (,) c(,) + min { (,)} + Loop back through! Poison reverse ill fix this tells because s route to through c(,) + min { (,)} +6 Loop back through! Poison reverse ill not fix this s route to is through but doesn t kno that so does not tell s route is through so no poison reverse ill try to send through : Netork Layer a- : Netork Layer a- ount to Infinity xample ith igger Loop ill learn bad nes ill have told because its route to is through, so on t reroute through hoever ill have told about a good route to through (cost 6) ill choose that route instead and advertise it as the ne best to (cost 6+ ); it ill be orse than the old one it advertised to (old cost ) ill propagate this updated best route to (cost ) ill propagate this ne best route to (cost ) ill update the best route to (cost 9) Last time it advertised cost 6 to It ill loop around adding each time (cost of loop) Will continue until cost advertises to is bigger than : Netork Layer a-9 omparison of LS and V s Message complexity LS: nodes send info on directly connections to all other nodes More, smaller messages V: nodes send info on best paths to all s to eer, larger messages Speed of onvergence LS: O(n ) may have oscillations V: convergence time varies may be routing loops count-to- problem Robustness: hat happens if router malfunctions? LS: node can advertise incorrect link cost each node computes only its on table V: V node can advertise incorrect path cost each node s table used by others error propagate thru netork : Netork Layer a-