640 likes | 686 Views
Chapter 5 Network Layer: Routing. Network Layer: Protocols. Network layer functions:. Control protocols error reporting router advertizing e.g. ICMP. Control protocols - router “signaling” e.g. RSVP (ReSerVation Protocol). Forwarding protocol (e.g., IP) addressing conventions
E N D
Network Layer: Protocols Network layer functions: • Control protocols • error reporting • router advertizing e.g. ICMP Control protocols - router “signaling”e.g. RSVP(ReSerVation Protocol) • Forwarding protocol (e.g., IP) • addressing conventions • packet format • packet handling conventions • Routing protocols • path selection • e.g., RIP, OSPF, BGP forwarding Transport layer L3.5 Network layer L3 Link layer physical layer Chapter 5: Network Layer: Routing
Control: ROUTING algorithms Chapter 5: Network Layer: Routing
5 3 5 2 2 1 3 1 2 1 A D E B F C Routing Control Plane: Routing Goal: determine “good” paths (sequences of routers) thru network from sources to dest. Graph abstraction for the routing problem: • graph nodes are routers • graph edges are physical links • links have properties: delay, capacity, $ cost, policy Chapter 5: Network Layer: Routing
Key Desired Properties of a Routing Algorithm Robustness Optimality find good path (for user/provider) Simplicity Chapter 5: Network Layer: Routing
Routing Design Space Routing has a large design space who decides routing? source routing: end hosts make decision network routing: networks make decision centralized control : one node builds tables for all routers distributed control : each router builds own routing table how many paths from source s to destination d? multi-path routing (several alternatives available) single path routing will routing adapt to network traffic demand or to topology changes? dynamic routing : tables adapt to state changes static routing : tables configured manually … - Robustness - Optimality - Simplicity Chapter 5: Network Layer: Routing
Global or decentralized information? Global information: all routers have complete topology & link-cost info “link state” algorithms Decentralized information: router knows neighbors, link costs to neighbors, alldistances from neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms Centralized of distributed control? Centralized control: one central node in the network builds tables for all routers and sends to them collects data from routers Distributed control: every router builds its own table based on information exchange with other routers Routing Algorithm classification(distributed control network) Chapter 5: Network Layer: Routing
Dijkstra’s algorithm net topology, link costs known to all nodes routers flood messagesto all other routers all nodes have same info router computes least cost paths from itself/“source” to all other nodes obtains routing table for itself iterative computation: after k iterations, know best path to k destinations Notation: c(i,j): link cost from node i to j. cost infinite if not direct neighbors D(v): current value of cost of path from source to dest. V p(v): immediate predecessor node along path from source to v, N: set of nodes whose least cost path definitively known A Link-State Routing Algorithm Chapter 5: Network Layer: Routing
Dijsktra’s Algorithm 1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) , p(v)=A 6 else D(v) = ∞ 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) ) , adjust p(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 Chapter 5: Network Layer: Routing
5 3 5 2 2 1 3 1 2 1 A D B E F C Dijkstra’s algorithm: example D(B),p(B) 2,A 2,A 2,A D(D),p(D) 1,A D(C),p(C) 5,A 4,D 3,E 3,E D(E),p(E) infinity 2,D Step 0 1 2 3 4 5 start N A AD ADE ADEB ADEBC ADEBCF D(F),p(F) infinity infinity 4,E 4,E 4,E Chapter 5: Network Layer: Routing
Algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n2) more efficient implementations possible: O(nlogn) Dijkstra’s algorithm, discussion Chapter 5: Network Layer: Routing
iterative: continues until no change in node info. self-terminating: no “signal” to stop network iteration asynchronous: nodes need not exchange info/iterate in lock step! distributed: each node communicates only with directly-attached neighbors Distance Table data structure each node has its own table row for each possible destination column for each directly-attached neighbor to node example: in node X, for dest. Y via neighbor Z: distance from X to Y, via Z as next hop X = D (Y,Z) Z c(X,Z) + min {D (Y,w)} = w Distance Vector Routing Algorithms Chapter 5: Network Layer: Routing
Distance Vector Routing Basis of RIP, IGRP, EIGRP routing protocols Based on the Bellman-Ford algorithm (BFA) Conceptually, runs for each destination separately Chapter 5: Network Layer: Routing
Distance Vector Routing: Basic Idea At node i, the basic update rule where - di denotes the distance estimation from i to the destination (here assumed fixed) - N(i) is set of neighbors of node i, and - dij is the distance of the direct link from i to j;assumed positive reported by j destination … j i Chapter 5: Network Layer: Routing
Distance Table: Example 1 distance table E sends to its neighbors 7 A: 10 B: 8 C: 4 D: 2 E: 0 2 8 10 2 A D E B C Table below shows first step as seen at EAlgorithm repeats as long as there are changes E’s computed distances & routing computation @E dist. tables recv’d from neighbors: (10 8 2) E d () A B C D A B D A B D 10 15 0 7 10 / A 8 / B 7 0 17 8 destinations 4 / D 1 2 9 4 0 2 2 / D 10 8 2 E Chapter 5: Network Layer: Routing
cost to destination via E D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 1 7 2 8 1 destination 2 A D B E C E E E d (C,D) d (A,D) d (A,B) B D D c(E,B) + min {D (A,w)} c(E,D) + min {D (A,w)} c(E,D) + min {D (C,w)} = = = w w w = = = 2+3 = 5 2+2 = 4 8+6 = 14 E’s Distance Table after convergence loop! (why not 15?) Chapter 5: Network Layer: Routing
cost to destination via E D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 destination Distance table gives routing table Outgoing link to use, cost to dest A B C D A,1 D,5 D,4 D,2 destination Routing table Distance table Chapter 5: Network Layer: Routing
Iterative, asynchronous: each local iteration caused by: local link cost change message from neighbor: its least cost path to some destination changed Distributed: each node notifies neighbors only when its least cost path to any destination changes neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute distance table if least cost path to any dest has changed, notify all neighbors Distance Vector Routing: overview Each node: Chapter 5: Network Layer: Routing
Distance Vector Algorithm: At all nodes, X: 1 Initialization: 2 for all adjacent nodes v: 3 DX(*,v) = ∞ /* “*” means "for all rows" */ 4 DX(v,v) = c(X,v) 5 for all destinations, y 6 send minw DX(y,w) to each neighbor /* w over all X's neighbors */ Chapter 5: Network Layer: Routing
Distance Vector Algorithm (cont.): 8 loop 9 wait(until a link cost C(X,V) change to neighbor V 10 or until receive update from neighbor V) 11 12 if (c(X,V) changes by d) /* C(X,V)=C(X,V)+d */ 13 /* change cost to all dest's via neighbor v by adding d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: DX(y,V) = DX(y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its minw DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination Y, D (Y,V) = c(X,V) + newval 22 23 if minw DX(Y,w) for any destination Y changed, 24 send new value of minw DX(Y,w) to all neighbors 25 26 forever X Chapter 5: Network Layer: Routing
2 1 7 Y Z X X c(X,Y) + min {D (Z,w)} c(X,Z) + min {D (Y,w)} D (Y,Z) D (Z,Y) = = w w = = 2+1 = 3 7+1 = 8 X Z Y Distance Vector Algorithm: example Chapter 5: Network Layer: Routing
2 1 7 X Z Y Distance Vector Algorithm: example No Change Chapter 5: Network Layer: Routing
1 4 1 50 X Z Y Distance Vector: link cost changes Link cost changes: • node detects local link cost change • updates distance table (line 15) • if cost change in least cost path, notify neighbors (lines 23,24) • we show distance to X only algorithm terminates “good news travels fast” report 1 report 2 Chapter 5: Network Layer: Routing
60 4 1 50 X Z Y Distance Vector: link cost changes Link cost changes: • good news travels fast • bad news travels slow - “count to infinity” problem! • we show distance to X only Y Y Y algorithm continues on report 6 Qn: how does it stop? report 7 Chapter 5: Network Layer: Routing
60 4 1 50 X Z Y Distance Vector: poisoned reverse If Z routes through Y to get to X (= Z learned its best dist. to X from Y): • 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? algorithm terminates Y Y Y Y Chapter 5: Network Layer: Routing
Message complexity LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only but larger msgs Speed of Convergence LS: local computation. once all messages received DV: convergence time varies may have routing loops count-to-infinity problem Robustness:what happens if router malfunctions? LS: node can advertise incorrect link cost only routes using that link are affected DV: DV node can advertise incorrect path cost each node’s table used by others error propagates thru network Comparison of LS and DV algorithms Chapter 5: Network Layer: Routing
Broadcast and Multicast Routing Chapter 5: Network Layer: Routing
duplicate creation/transmission duplicate duplicate in-network duplication sourceduplication R3 R2 R4 R2 R4 R3 R1 R1 Broadcast Routing • Deliver packets from source to all other nodes • Source duplication is inefficient: • Source duplication: how does source determine recipient addresses Chapter 5: Network Layer: Routing
In-network duplication • Flooding: when node receives brdcst pckt, sends copy to all neighbors • Problems: cycles & broadcast storm • Controlled flooding: • Node only broadcasts packet if it hasn’t broadcast same packet before • Node keeps track of packet IDs already broadcasted • Or Reverse Path Forwarding (RPF): Node A only forwards a packet if it arrived on shortest path from source to A • Spanning tree forwarding • No redundant packets received by any node Chapter 5: Network Layer: Routing
(b) Broadcast initiated at D (a) Broadcast initiated at A A A D D G G B E E B F F c c Spanning Tree • First construct a spanning tree • Nodes forward copies only along spanning tree Chapter 5: Network Layer: Routing
A A D D G G B E B E F F c c Spanning Tree: Creation • Center node • Each node sends unicast join message to center node • Message forwarded until it arrives at a node already belonging to spanning tree; such paths build the tree 3 4 2 5 1 • Stepwise construction of spanning tree centered on E (b) Constructed spanning tree Chapter 5: Network Layer: Routing
Source-based trees Multicast Routing: Problem Statement • Goal: find a tree (or trees) connecting routers having local mcast group members • tree: not all paths between routers used • source-based: different tree from each sender to receivers • shared-tree: same tree used by all group members Shared tree Chapter 5: Network Layer: Routing
Approaches for building mcast trees Approaches: • source-based tree: one tree per source • shortest path trees • reverse path forwarding • group-shared tree: group uses one tree • minimal spanning (Steiner) • center-based trees …we first look at the basic approaches Chapter 5: Network Layer: Routing
1 i 5 4 3 6 2 Shortest Path Tree • mcast forwarding tree: tree of shortest path routes from source to all receivers • Dijkstra’s algorithm S: source LEGEND R1 R4 router with attached group member R2 router with no attached group member R5 link used for forwarding, i indicates order link added by algorithm R3 R7 R6 Chapter 5: Network Layer: Routing
Reverse Path Forwarding • rely on router’s knowledge of unicast shortest path from it to sender • each router has simple forwarding behavior: if (mcast datagram received on incoming link of shortest path from the center) then flood datagram onto all outgoing links else ignore datagram • gives broadcast behavior Chapter 5: Network Layer: Routing
Reverse Path Forwarding: example S: source LEGEND R1 R4 router with attached group member R2 router with no attached group member R5 datagram will be forwarded R3 R7 R6 datagram will not be forwarded • result is a source-specific reverse SPT • may be a bad choice with asymmetric links Chapter 5: Network Layer: Routing
Reverse Path Forwarding: pruning • forwarding tree contains subtrees with no mcast group members • no need to forward datagrams down subtree • “prune” msgs sent upstream by router with no downstream group members LEGEND S: source R1 router with attached group member R4 router with no attached group member R2 P P R5 prune message links with multicast forwarding P R3 R7 R6 Chapter 5: Network Layer: Routing
Shared-Tree: Steiner Tree • Steiner Tree: minimum cost tree connecting all routers with attached group members • problem is NP-complete • excellent heuristics exists • not used in practice: • computational complexity • information about entire network needed • monolithic: rerun algorithm whenever a router needs to join/leave Chapter 5: Network Layer: Routing
Center-based trees • single tree shared by all senders in the group • one router identified as “center” of tree • to join: • edge router sends unicast join-msg addressed to center router • join-msg “processed” by intermediate routers and forwarded towards center • join-msg either hits existing tree branch for this center, or arrives at center • path taken by join-msg becomes new branch of tree for this router Chapter 5: Network Layer: Routing
Center-based trees: an example Suppose R6 chosen as center: LEGEND R1 router with attached group member R4 3 router with no attached group member R2 2 1 R5 path order in which join messages generated R3 1 R7 R6 Chapter 5: Network Layer: Routing
Hierarchical Routing Chapter 5: Network Layer: Routing
scale: with 200 million destinations: can’t store all dest’s in routing tables! routing algorithm info exchange would swamp links! administrative autonomy internet = network of networks each network admin may want to control routing in its own network Hierarchical Routing Our routing study thus far - idealization • all routers identical • network “flat” … not true in practice Chapter 5: Network Layer: Routing
aggregate routers into regions, “autonomous systems” (AS) routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing protocols Gateway router Direct link to router(s) in another AS(es) Hierarchical Routing Chapter 5: Network Layer: Routing
Forwarding table is configured by both intra- and inter-AS routing algorithm Intra-AS sets entries for internal dest’s Inter-AS & Intra-AS sets entries for external dest’s 3a 3b 2a AS3 AS2 1a 2c AS1 2b 3c 1b 1d 1c Inter-AS Routing algorithm Intra-AS Routing algorithm Forwarding table Interconnected ASes Chapter 5: Network Layer: Routing
Suppose router in AS1 receives datagram for which dest is outside of AS1 Router should forward packet towards one of the gateway routers, but which one? AS1 needs: to learn which dests are reachable through AS2 and which through AS3 to propagate this reachability info to all routers in AS1 Job of inter-AS routing! 3a 3b 2a AS3 AS2 1a AS1 2c 2b 3c 1b 1d 1c Inter-AS tasks Chapter 5: Network Layer: Routing
Example: Setting forwarding table in router 1d • Suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 (gateway 1c) but not from AS2. • Inter-AS protocol propagates reachability info to all internal routers. • Router 1d determines from intra-AS routing info that its interface I leads to the least cost path to 1c. • Puts in forwarding table the entry (x,I). Chapter 5: Network Layer: Routing
Determine from forwarding table the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways Learn from inter-AS protocol that subnet x is reachable via multiple gateways Hot potato routing: Choose the gateway that has the smallest least cost Example: Choosing among multiple ASes • Now suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 and from AS2. • To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x. • This is also the job on inter-AS routing protocol ! • Hot potato routing: send packet towards closest of two routers. Chapter 5: Network Layer: Routing
c b b a c A.a A.c C.b B.a Intra-AS and Inter-AS routing • Gateways: • perform inter-AS routing amongst themselves • perform intra-AS routers with other routers in their AS b a a C B d A CPU network layer inter-AS, intra-AS routing in gateway A.c link layer physical layer NIC Chapter 5: Network Layer: Routing
Inter-AS routing between A and B b c a a C b B b c a d Host h1 A A.a A.c C.b B.a Intra-AS and Inter-AS routing Host h2 Intra-AS routing within AS B Intra-AS routing within AS A • We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly Chapter 5: Network Layer: Routing
Routing: Example AS B (OSPF intra AS D AS A (OSPF) routing) d E d->a2: I can reach hosts in D; my path: D Export to E: i->e: I can reach hosts in D; path: IBCD a2 a2->a1: I can reach hosts in D; path: D a1->i: I can reach hosts in D; my path: AD a1 No Exportto F i F AS C choose BCD using i2 i2->i: I can reach hosts in D; path: BCD b->i: I can reach hosts in D; my path: BCD i2 b b->i2: I can reach hosts in D; my path: BCD AS I Chapter 5: Network Layer: Routing