Presentation is loading. Please wait.

Presentation is loading. Please wait.

13 –Routing Protocols Network Layer4-1. Network Layer4-2 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd.

Similar presentations


Presentation on theme: "13 –Routing Protocols Network Layer4-1. Network Layer4-2 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd."— Presentation transcript:

1 13 –Routing Protocols Network Layer4-1

2 Network Layer4-2 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004. A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following:  If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!)  If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2004 J.F Kurose and K.W. Ross, All Rights Reserved

3 Network Layer4-3 1 2 3 0111 value in arriving packet’s header routing algorithm local forwarding table header value output link 0100 0101 0111 1001 32213221 Interplay between routing and forwarding

4 Network Layer4-4 u y x wv z 2 2 1 3 1 1 2 5 3 5 Graph: G = (N,E) 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) } Graph abstraction Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections

5 Network Layer4-5 Graph abstraction: costs u y x wv z 2 2 1 3 1 1 2 5 3 5 c(x,x’) = cost of link (x,x’) - e.g., c(w,z) = 5 cost could always be 1, or inversely related to bandwidth, or inversely related to 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

6 Network Layer4-6 A Link-State Routing Algorithm Dijkstra’s algorithm r net topology, link costs known to all nodes m accomplished via “link state broadcast” m all nodes have same info r computes least cost paths from one node (‘source”) to all other nodes m gives forwarding table for that node r iterative: after k iterations, know least cost path to k dest.’s Notation:  c(x,y): link cost from node x to y; = ∞ if not direct neighbors  D(v): current value of cost of path from source to dest. v  p(v): predecessor node along path from source to v  N': set of nodes whose least cost path definitively known

7 Network Layer4-7 Dijsktra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes j 4 if j adjacent to u 5 then D(j) = c(u,j) 6 else D(j) = ∞ 7 8 Loop 9 find m not in N' such that D(m) is a minimum 10 add m to N' 11 update D(j) for all j adjacent to m and not in N' : 12 D(j) = min( D(j), D(m) + c(m,j) ) 13 /* new cost to j is either old cost to j or known 14 shortest path cost to m plus cost from m to j */ 15 until all nodes in N' u y x wv z 2 2 1 3 1 1 2 5 3 5

8 Network Layer4-8 Dijkstra’s algorithm: example Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) 2,u D(w),p(w) 5,u 4,x 3,y D(x),p(x) 1,u D(y),p(y) ∞ 2,x D(z),p(z) ∞ 4,y u y x wv z 2 2 1 3 1 1 2 5 3 5

9 Network Layer4-9 Dijkstra’s algorithm, discussion Algorithm complexity: n nodes r each iteration: need to check all nodes, w, not in N r n(n+1)/2 comparisons: O(n 2 ) r more efficient implementations possible: O(nlogn)

10 Network Layer4-10 Distance Vector Algorithm (1) Bellman-Ford Equation (dynamic programming) 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

11 Network Layer4-11 Bellman-Ford example (2) u y x wv z 2 2 1 3 1 1 2 5 3 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 d u (z) = min { c(u,v) + d v (z), c(u,x) + d x (z), 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 B-F equation says:

12 Network Layer4-12 Distance Vector Algorithm (3) r D x (y) = estimate of least cost from x to y r Distance vector: D x = [D x (y): y є N ] r Node x knows cost to each neighbor v: c(x,v) r Node x maintains D x = [D x (y): y є N ] r Node x also maintains its neighbors’ distance vectors m For each neighbor v, x maintains D v = [D v (y): y є N ]

13 Network Layer4-13 Distance vector algorithm (4) Basic idea: r Each node periodically sends its own distance vector estimate to neighbors r When a node x receives new DV estimate from neighbor, 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 the actual least cost d x (y)

14 Network Layer4-14 Distance Vector Algorithm (5) Iterative, asynchronous: each local iteration caused by: r local link cost change r DV update message from neighbor Distributed: r each node notifies neighbors only when its DV changes m neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute estimates if DV to any dest has changed, notify neighbors Each node:

15 Network Layer4-15 Example using DVs x z 1 2 7 y x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to node x table

16 Network Layer4-16 x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z ∞∞ ∞∞∞ cost to x y z x y z ∞∞∞ 710 cost to ∞ 2 0 1 ∞ ∞ ∞ time x z 1 2 7 y node x table node y table node z table

17 Network Layer4-17 x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z 0 2 3 from cost to x y z x y z ∞∞ ∞∞∞ cost to x y z x y z ∞∞∞ 710 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 x y z x y z 0 2 7 from 2 0 1 7 1 0 time x z 1 2 7 y node x table node y table node z table y 2 0 1 x y z x z 0 2 7 from 3 1 0 D x (z) = min{c(x,y) + D y (z), c(x,z) + D z (z)} = min{2+1, 7+0} = 3 D x (y) = min{c(x,y) + D y (y), c(x,z) + D z (y)} = min{2+0, 7+1} = 2

18 Network Layer4-18 x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z ∞∞ ∞∞∞ cost to x y z x y z 0 2 7 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 7 from cost to x y z x y z ∞∞∞ 710 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time x z 1 2 7 y node x table node y table node z table D x (y) = min{c(x,y) + D y (y), c(x,z) + D z (y)} = min{2+0, 7+1} = 2 D x (z) = min{c(x,y) + D y (z), c(x,z) + D z (z)} = min{2+1, 7+0} = 3

19 Network Layer4-19 Comparison of LS and DV algorithms Message complexity r LS: with n nodes, E links, O(nE) msgs sent r DV: exchange between neighbors only m convergence time varies Speed of Convergence r LS: O(n 2 ) algorithm requires O(nE) msgs m may have oscillations r DV: convergence time varies m may be routing loops m count-to-infinity problem Robustness: what happens if router malfunctions? LS: m node can advertise incorrect link cost m each node computes only its own table DV: m DV node can advertise incorrect path cost m each node’s table used by others error propagate thru network


Download ppt "13 –Routing Protocols Network Layer4-1. Network Layer4-2 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd."

Similar presentations


Ads by Google