Networks G22.2262-001
Total Page:16
File Type:pdf, Size:1020Kb
Data Communication & Networks G22.2262-001 Session 7 - Main Theme Networks: Part II Routing Algorithms and Routing Protocol Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 Agenda Routing Strategies Interplay Between Routing and Forwarding Graph Abstraction Routing Algorithm Classification Link-State Routing (LS) Algorithm Distance Vector (DV) Algorithm Comparison of LS and DV Algorithms Hierarchical Routing Interconnected ASes Inter-AS Tasks Intra-AS Routing Internet Inter-AS Routing – Border Gateway Protocol Why Different Intra- and Inter-AS Routing? 2 1 Part I Routing Strategies 3 Routing Strategies Fixed Flooding Random Adaptive 4 2 Fixed Routing Single permanent route for each source to destination pair Determine routes using a least cost algorithm Route fixed, at least until a change in network topology 5 Fixed Routing Tables 6 3 Flooding No network info required Packet sent by node to every neighbor Incoming packets retransmitted on every link except incoming link Eventually a number of copies will arrive at destination Each packet is uniquely numbered so duplicates can be discarded Nodes can remember packets already forwarded to keep network load in bounds Can include a hop count in packets 7 Flooding Examples 8 4 Properties of Flooding All possible routes are tried Very robust At least one packet will have taken minimum hop count route Can be used to set up virtual circuit All nodes are visited Useful to distribute information (e.g. routing) 9 Random Routing Node selects one outgoing path for retransmission of incoming packet Selection can be random or round robin Can select outgoing path based on probability calculation No network info needed Route is typically not least cost nor minimum hop 10 5 Adaptive Routing Used by almost all packet switching networks Routing decisions change as conditions on the network change Failure Congestion Requires info about network Decisions more complex Tradeoff between quality of network info and overhead Reacting too quickly can cause oscillation Reacting too slowly to be relevant 11 Part II Interplay Between Routing and Forwarding 12 6 Interplay Between Routing & Forwarding routing algorithm local forwarding table header value output link 0100 3 0101 2 0111 2 1001 1 value in arriving packet’s header 0111 1 3 2 13 Part III Graph Abstration 14 7 Graph Abstraction 5 v 3 w 2 5 u 2 1 3 z 1 x y 2 Graph: G = (N,E) 1 N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (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 15 Graph Abstraction: Costs 5 • c(x,x’) = cost of link (x,x’) v 3 w 2 5 - e.g., c(w,z) = 5 u 2 1 3 z • cost could always be 1, or 1 inversely related to bandwidth, x y 2 1 or inversely related to congestion Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Question: What’s the least-cost path between u and z ? Routing algorithm: algorithm that finds least-cost path 16 8 Part IV Routing Algorithm Classification 17 Routing Algorithm Classification Global or decentralized Static or dynamic? information? Static: Global: routes change slowly all routers have complete over time topology, link cost info Dynamic: “link state” algorithms routes change more Decentralized: quickly router knows physically- periodic update connected neighbors, link costs to neighbors in response to link iterative process of computation, cost changes exchange of info with neighbors 18 “distance vector” algorithms 9 Part V Link-State Routing Algorithm 19 Link-State Routing Algorithm Dijkstra’s algorithm Notation: net topology, link costs known to c(x,y): link cost from node x all nodes to y; = ∞ if not direct accomplished via “link state neighbors broadcast” D(v): current value of cost of all nodes have same info path from source to dest. V computes least cost paths from p(v): predecessor node one node (‘source”) to all other along path from source to v nodes N': set of nodes whose least gives forwarding table for that cost path definitively known node iterative: after k iterations, know least cost path to k dest.’s 20 10 Dijsktra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 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) ) 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' 21 Dijkstra’s Algorithm: Example Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z) 0 u 2,u 5,u 1,u ∞ ∞ 1 ux 2,u 4,x 2,x ∞ 2 uxy 2,u 3,y 4,y 3 uxyv 3,y 4,y 4 uxyvw 4,y 5 uxyvwz 5 v 3 w 2 5 u 2 1 3 z 1 x y 2 1 22 11 Dijkstra’s Algorithm: Discussion Algorithm Complexity:n nodes each iteration: need to check all nodes, w, not in N 2 n(n+1)/2 comparisons: O(n ) more efficient implementations possible: O(nlogn) Oscillations Possible: e.g., link cost = amount of carried traffic 1 A A A A 1+e 2+e 0 0 2+e 2+e 0 D B 0 0 D 1+e 1 B D 0 0 B D 1+e 1 B 0 e 0 0 1 1+e 0 e C C C C 1 1 e …recompute …recompute …recompute initially 23 routing Part VI Distance Vector Algorithm 24 12 Distance Vector Algorithm Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors of x 25 Bellman-Ford Example 5 Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 v 3 w 2 5 u 2 1 B-F equation says: 3 z 1 d (z) = min { c(u,v) + d (z), x y 2 u v 1 c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table 26 13 Distance Vector Algorithm (cont.) Dx(y) = estimate of least cost from x to y Distance vector: Dx = [Dx(y): y є N ] Node x knows cost to each neighbor v: c(x,v) Node x maintains Dx = [Dx(y): y є N ] Node x also maintains its neighbors’ distance vectors For each neighbor v, x maintains Dv = [Dv(y): y є N ] 27 Distance Vector Algorithm (cont.) Basic Idea: Each node periodically sends its own distance vector estimate to neighbors When node a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N Under minor, natural conditions, the estimate Dx(y) converge the actual least cost dx(y) 28 14 Distance Vector Algorithm (cont.) Iterative, asynchronous: Each node: each local iteration caused by: wait for (change in local link local link cost change cost of msg from neighbor) DV update message from neighbor recompute estimates Distributed: Each node notifies if DV to any dest has neighbors only when its changed, notify neighbors DV changes neighbors then notify their neighbors if 29 necessary D (z) = min{c(x,y) + Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} x = min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)} node x table = min{2+1 , 7+0} = 3 cost to cost to cost to x y z x y z x y z x 0 2 7 x 0 2 3 x 0 2 3 y ∞∞ ∞ y 2 0 1 y from from 2 0 1 z z from ∞∞ ∞ 7 1 0 z 3 1 0 node y table cost to cost to cost to x y z x y z y x y z 2 1 x ∞ ∞∞ x 0 2 7 x 0 2 3 x z y 2 0 1 y 2 0 1 y 7 from 2 0 1 from from z ∞∞ ∞ z 7 1 0 z 3 1 0 node z table cost to cost to cost to x y z x y z x y z x ∞∞ ∞ x 0 2 7 x 0 2 3 y y 2 0 1 y 2 0 1 from ∞∞ ∞ from from z z z 71 0 3 1 0 3 1 0 time 30 15 Distance Vector: Link Cost Changes 1 y Link cost changes: 4 1 x z node detects local link cost change 50 updates routing info, recalculates distance vector if DV changes, notify neighbors At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. “good news At time t1, z receives the update from y and updates its table. travels It computes a new least cost to x and sends its neighbors its DV.