15 Routing

35
1 Shortest-Path Routing Reading: Sections 4.2 and 4.3.4 COS 461: Computer Networks Spring 2006 (MW 1:30-2:50 in Frien 10!" #enni$er %e&$or 'e )*ing +ssist nt: Mike W wr,oni k *ttp: www.)s.prin)eton.eu )ourses r)*i/e spring06 )os46

description

routing

Transcript of 15 Routing

  • Shortest-Path RoutingReading: Sections 4.2 and 4.3.4COS 461: Computer NetworksSpring 2006 (MW 1:30-2:50 in Friend 109)

    Jennifer RexfordTeaching Assistant: Mike Wawrzoniak http://www.cs.princeton.edu/courses/archive/spring06/cos461/

  • Goals of Todays LecturePath selection

    Minimum-hop and shortest-path routingDijkstra and Bellman-Ford algorithmsTopology change

    Using beacons to detect topology changesPropagating topology or path informationRouting protocols

    Link state: Open Shortest Path FirstDistance vector: Routing Information Protocol

  • What is Routing?A famous quotation from RFC 791

    A name indicates what we seek.An address indicates where it is.A route indicates how we get there. -- Jon Postel

  • Forwarding vs. RoutingForwarding: data plane

    Directing a data packet to an outgoing linkIndividual router using a forwarding tableRouting: control plane

    Computing paths the packets will followRouters talking amongst themselvesIndividual router creating a forwarding table

  • Why Does Routing Matter?End-to-end performance

    Quality of the path affects user performancePropagation delay, throughput, and packet lossUse of network resources

    Balance of the traffic over the routers and linksAvoiding congestion by directing traffic to lightly-loaded linksTransient disruptions during changes

    Failures, maintenance, and load balancingLimiting packet loss and delay during changes

  • Shortest-Path RoutingPath-selection model

    Destination-basedLoad-insensitive (e.g., static link weights)Minimum hop count or sum of link weights 3221141453

  • Shortest-Path Problem Given: network topology with link costs

    c(x,y): link cost from node x to node yInfinity if x and y are not direct neighborsCompute: least-cost paths to all nodes

    From a given source u to all other nodesp(v): predecessor node along path from source to v3221141453uvp(v)

  • Dijkstras Shortest-Path AlgorithmIterative algorithm

    After k iterations, know least-cost path to k nodesS: nodes whose least-cost path definitively known

    Initially, S = {u} where u is the source nodeAdd one node to S in each iterationD(v): current cost of path from source to node v

    Initially, D(v) = c(u,v) for all nodes v adjacent to u and D(v) = for all other nodes vContinually update D(v) as shorter paths are learned

  • Dijsktras Algorithm1 Initialization: 2 S = {u} 3 for all nodes v 4 if v adjacent to u {5 D(v) = c(u,v) 6 else D(v) = 7 8 Loop 9 find w not in S with the smallest D(w)10 add w to S 11 update D(v) for all v adjacent to w and not in S: 12 D(v) = min{D(v), D(w) + c(w,v)} 13 until all nodes in S

  • Dijkstras Algorithm Example

  • Dijkstras Algorithm Example

  • Shortest-Path TreeShortest-path tree from u

    Forwarding table at u

    link

  • Link-State RoutingEach router keeps track of its incident links

    Whether the link is up or downThe cost on the linkEach router broadcasts the link state

    To give every router a complete view of the graphEach router runs Dijkstras algorithm

    To compute the shortest paths and construct the forwarding tableExample protocols

    Open Shortest Path First (OSPF)Intermediate System Intermediate System (IS-IS)

  • Detecting Topology ChangesBeaconing

    Periodic hello messages in both directionsDetect a failure after a few missed hellos

    Performance trade-offs

    Detection speedOverhead on link bandwidth and CPULikelihood of false detectionhello

  • Broadcasting the Link StateFlooding

    Node sends link-state information out its linksAnd then the next node sends out all of its links except the one where the information arrivedXACBD(a)XACBD(b)XACBD(c)XACBD(d)

  • Broadcasting the Link StateReliable flooding

    Ensure all nodes receive link-state information and that they use the latest versionChallenges

    Packet lossOut-of-order arrivalSolutions

    Acknowledgments and retransmissionsSequence numbersTime-to-live for each packet

  • When to Initiate FloodingTopology change

    Link or node failureLink or node recoveryConfiguration change

    Link cost changePeriodically

    Refresh the link-state informationTypically (say) 30 minutesCorrects for possible corruption of the data

  • ConvergenceGetting consistent routing information to all nodes

    E.g., all nodes having the same link-state databaseConsistent forwarding after convergence

    All nodes have the same link-state databaseAll nodes forward packets on shortest pathsThe next router on the path forwards to the next hop3221141453

  • Transient DisruptionsDetection delay

    A node does not detect a failed link immediately and forwards data packets into a blackholeDepends on timeout for detecting lost hellos3221141453

  • Transient DisruptionsInconsistent link-state database

    Some routers know about failure before othersThe shortest paths are no longer consistentCan cause transient forwarding loops3221141453322114143

  • Convergence DelaySources of convergence delay

    Detection latencyFlooding of link-state informationShortest-path computationCreating the forwarding tablePerformance during convergence period

    Lost packets due to blackholes and TTL expiryLooping packets consuming resourcesOut-of-order packets reaching the destinationVery bad for VoIP, online gaming, and video

  • Reducing Convergence DelayFaster detection

    Smaller hello timersLink-layer technologies that can detect failuresFaster flooding

    Flooding immediatelySending link-state packets with high-priorityFaster computation

    Faster processors on the routersIncremental Dijkstra algorithmFaster forwarding-table update

    Data structures supporting incremental updates

  • Scaling Link-State RoutingOverhead of link-state routing

    Flooding link-state packets throughout the networkRunning Dijkstras shortest-path algorithmIntroducing hierarchy through areas

    Area 0Area 1Area 4areaborderrouter

  • Bellman-Ford AlgorithmDefine distances at each node x

    dx(y) = cost of least-cost path from x to yUpdate distances based on neighbors

    dx(y) = min {c(x,v) + dv(y)} over all neighbors v3221141453uvwxyzstdu(z) = min{c(u,v) + dv(z), c(u,w) + dw(z)}

  • Distance Vector Algorithm c(x,v) = cost for direct link from x to v

    Node x maintains costs of direct links c(x,v)Dx(y) = estimate of least cost from x to y

    Node x maintains distance vector Dx = [Dx(y): y N ]Node x maintains its neighbors distance vectors

    For each neighbor v, x maintains Dv = [Dv(y): y N ]Each node v periodically sends Dv to its neighbors

    And neighbors update their own distance vectorsDx(y) minv{c(x,v) + Dv(y)} for each node y NOver time, the distance vector Dx converges

  • Distance Vector AlgorithmIterative, asynchronous: each local iteration caused by: Local link cost change Distance vector update message from neighbor

    Distributed:Each node notifies neighbors only when its DV changesNeighbors then notify their neighbors if necessary

    Each node:

  • Distance Vector Example: Step 0AEFCDB23641113Optimum 1-hop paths

    Table for ADstCstHopA0AB4BCDE2EF6F

    Table for BDstCstHopA4AB0BCD3DEF1F

    Table for CDstCstHopABC0CD1DEF1F

    Table for DDstCstHopAB3BC1CD0DEF

    Table for EDstCstHopA2ABCDE0EF3F

    Table for FDstCstHopA6AB1BC1CDE3EF0F

  • Distance Vector Example: Step 2Optimum 2-hop pathsAEFCDB23641113

    Table for ADstCstHopA0AB4BC7FD7BE2EF5E

    Table for BDstCstHopA4AB0BC2FD3DE4FF1F

    Table for CDstCstHopA7FB2FC0CD1DE4FF1F

    Table for DDstCstHopA7BB3BC1CD0DEF2C

    Table for EDstCstHopA2AB4FC4FDE0EF3F

    Table for FDstCstHopA5BB1BC1CD2CE3EF0F

  • Distance Vector Example: Step 3Optimum 3-hop pathsAEFCDB23641113

    Table for ADstCstHopA0AB4BC6ED7BE2EF5E

    Table for BDstCstHopA4AB0BC2FD3DE4FF1F

    Table for CDstCstHopA6FB2FC0CD1DE4FF1F

    Table for DDstCstHopA7BB3BC1CD0DE5CF2C

    Table for EDstCstHopA2AB4FC4FD5FE0EF3F

    Table for FDstCstHopA5BB1BC1CD2CE3EF0F

  • Distance Vector: Link Cost ChangesLink cost changes:Node detects local link cost change Updates the distance table If cost change in least cost path, notify neighbors

    algorithmterminatesgoodnews travelsfast

  • Distance Vector: Link Cost ChangesLink cost changes:Good news travels fast Bad news travels slow - count to infinity problem!

    algorithmcontinueson!

  • Distance Vector: Poison ReverseIf Z routes through Y to get to X :Z tells Y its (Zs) distance to X is infinite (so Y wont route to X via Z)Still, can have problems when more than 2 routers are involved

    algorithmterminates

  • Routing Information Protocol (RIP)Distance vector protocol

    Nodes send distance vectors every 30 seconds or, when an update causes a change in routingLink costs in RIP

    All links have cost 1Valid distances of 1 through 15 with 16 representing infinitySmall infinity smaller counting to infinity problemRIP is limited to fairly small networks

    E.g., used in the Princeton campus network

  • Comparison of LS and DV algorithmsMessage complexityLS: with n nodes, E links, O(nE) messages sent DV: exchange between neighbors only

    Convergence time variesSpeed of ConvergenceLS: O(n2) algorithm requires O(nE) messagesDV: convergence time varies

    May be routing loopsCount-to-infinity problemRobustness: what happens if router malfunctions?LS: Node can advertise incorrect link costEach node computes only its own tableDV:DV node can advertise incorrect path costEach nodes table used by others (error propagates)

  • ConclusionsRouting is a distributed algorithm

    React to changes in the topologyCompute the shortest pathsTwo main shortest-path algorithms

    Dijkstra link-state routing (e.g., OSPF and IS-IS)Bellman-Ford distance vector routing (e.g., RIP)Convergence process

    Changing from one topology to anotherTransient periods of inconsistency across routersNext time: policy-based path-vector routing

    Reading: Section 4.3.3