Network Layer Network Layer Mobile network Gl b l Global ISP P Data Link Layer Data Link Layer Home network Regional ISP Yanmin Zhu Institutional network D p Department of Computer tm t f C mp t Science and Engineering 1 Network Layer
Network Layer Network Layer Network Layer Network Layer 1 Introduction 1 I d i 5 Routing algorithms 5 R i l i h 2 Virtual circuit and Link state d t datagram networks t ks Distance Vector Distance Vector Hierarchical routing 3 What’s inside a 6 Routing in the 6 Routing in the router router Internet 4 IP: Internet RIP Protocol Protocol OSPF Datagram format BGP IPv4 addressing g 7 Broadcast and B d d ICMP multicast routing IPv6 4-2 Network Layer
Network Layer Network Layer Interplay between routing, forwarding routing algorithm ti l ith local forwarding table header value output link 0100 3 0101 2 0111 2 1001 1 value in arriving value in arriving packet’s header 1 0111 2 3 4-3 Network Layer
Network Layer Network Layer Graph abstraction Graph abstraction 5 5 3 v w 5 2 u z 2 1 3 1 2 x y Graph: G = (N,E) Graph: G = (N E) 1 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 Example: P2P, where N is set of peers and E is set of TCP connections 4-4 Network Layer
Network Layer Network Layer Graph abstraction: costs Graph abstraction: costs 5 5 • c(x,x’) = cost of link (x,x’) 3 v w 5 2 2 - e.g., c(w,z) = 5 e.g., c(w,z) 5 u z 2 1 3 • cost could always be 1, or 1 2 x y y inversely related to bandwidth inversely related to bandwidth, 1 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 ? Q ti Wh t’ th l t t th b t d ? Routing algorithm: algorithm that finds least-cost path 4-5 Network Layer
Network Layer Network Layer Routin Routing Algorithm classification Al orithm classification Global or decentralized G o a or c ntra z Static or dynamic? Static or dynamic? information? Static: Global: routes change slowly routes change slowly all routers have complete over time topology, link cost info Dynamic: Dynamic: “link state” algorithms link state algorithms Decentralized: routes change more q quickly y router knows physically- p y y connected neighbors, link periodic update costs to neighbors in response to link n response to l nk iterative process of iterative process of cost changes computation, exchange of info with neighbors “distance vector” algorithms “di t t ” l ith 4-6 Network Layer
Network Layer Network Layer Network Layer Network Layer 1 Introduction 1 I d i 5 Routing algorithms 5 R i l i h 2 Virtual circuit and Link state d t datagram networks t ks Distance Vector Distance Vector Hierarchical routing 3 What’s inside a 6 Routing in the 6 Routing in the router router Internet 4 IP: Internet RIP Protocol Protocol OSPF Datagram format BGP IPv4 addressing g 7 Broadcast and B d d ICMP multicast routing IPv6 4-7 Network Layer
Network Layer Network Layer Link State: Big Picture Link-State: Big Picture Each node E h d measures 5 cost to every neighbor 3 v w 5 5 2 Each node sends table 2 u 1 z 3 3 of neighbors 1 to all nodes 2 x x y y 1 Every node computes computes routing path 1-8 Introduction
Network Layer Network Layer A Link State Routin A Link-State Routing Algorithm Al orithm Dijk Dijkstra’s algorithm ’ l i h Notation: N i net topology, link costs c(x,y): link cost from node known to all nodes known to all nodes x to y; = x to y; = ∞ if not direct if not direct accomplished via “link neighbors state broadcast” D(v): current value of cost D(v): current value of cost all nodes have same info of path from source to computes least cost paths dest. v from one node ( source ) to from one node (‘source”) to p(v): predecessor node ( ) d d all other nodes along path from source to v gives forwarding table N : set of nodes whose N': set of nodes whose for that node f th t d least cost path definitively iterative: after k known iterations, know least cost , path to k dest.’s 4-9 Network Layer
Network Layer Network Layer Dijsktra’s Al orithm Dijsktra s Algorithm 1 Initialization: 1 Initialization: 2 N' = {u} 3 for all nodes v 4 4 if v adjacent to u 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' 15 until all nodes in N 4-10 Network Layer
Network Layer Network Layer Dijkstra’s al orithm: example Dijkstra s algorithm: example D(v),p(v) D(v) p(v) D(w) p(w) D(w),p(w) D(x),p(x) D(x) p(x) D(y) p(y) D(y),p(y) Step Step N N' D(z) p(z) D(z),p(z) 2,u 5,u 1,u ∞ 0 u ∞ 2,u 4,x 2,x 1 ux ∞ 2 2,u 3 3,y 2 2 uxy 4,y 3,y 3 uxyv 4,y 4 uxyvw 4 y 4,y 5 uxyvwz 5 5 3 v w 5 2 u z 2 1 3 1 2 x y y 1 4-11 Network Layer
Network Layer Network Layer Dijkstra’s al orithm: example (2) Dijkstra s algorithm: example (2) Resulting shortest-path tree from u: v w u z x y y Resulting forwarding table in u: destination link (u,v) v x (u,x) ( ) y (u,x) (u x) (u,x) w w z (u,x) 4-12 Network Layer
Network Layer Network Layer Dijkstra’s al orithm discussion Dijkstra s algorithm, discussion Algorithm complexity: n nodes g p y each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n 2 ) more efficient implementations possible: O(nlogn) Oscillations possible: p e.g., link cost = amount of carried traffic A A A A 1 1+e 2+e 0 0 2+e 2+e 0 D B D D B B D B 0 0 1+e 1 0 0 1+e 1 e e 0 0 0 0 0 0 1 1 e e 1+ 1+e 0 0 C C C C C 1 1 e … recompute … recompute … recompute initially initially routing 4-13 Network Layer
Network Layer Network Layer Network Layer Network Layer 1 Introduction 1 I d i 5 Routing algorithms 5 R i l i h 2 Virtual circuit and Link state d t datagram networks t ks Distance Vector Distance Vector Hierarchical routing 3 What’s inside a 6 Routing in the 6 Routing in the router router Internet 4 IP: Internet RIP Protocol Protocol OSPF Datagram format BGP IPv4 addressing g 7 Broadcast and B d d ICMP multicast routing IPv6 4-14 Network Layer
Network Layer Network Layer Distance Vector: Rational Distance Vector: Rational B ll Bellman-Ford Equation (dynamic programming) F d E (d ) Define d x (y) := cost of least-cost path from x to y Then d x (y) = min {c(x,v) + d v (y) } x y v y v where min is taken over all neighbors v of x where min is taken over all neighbors v of x 4-15 Network Layer
Network Layer Network Layer Bellman Ford example Bellman-Ford example 5 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 3 v w 5 2 B-F equation says: u z 2 1 3 d u (z) = min { c(u,v) + d v (z), 1 2 x y y c(u,x) + d x (z), 1 c(u,w) + d w (z) } = min {2 + 5 = min {2 + 5, 1 + 3, 5 + 3} = 4 } Node that achieves minimum is next hop in shortest path ➜ forwarding table hop in shortest path ➜ forwarding table 4-16 Network Layer
Network Layer Network Layer Distance Vector: Big Picture Distance Vector: Big Picture u’s distance vector v’s v s 5 5 dest cost next hop p 3 v w 5 5 v 2 v 2 u 2 z 1 3 3 x 1 x 1 2 x y w i f inf - 1 1 y y inf inf - - des cos next des cos next des cos next t t hop t t hop t t hop u 2 U V v x 2 X x x z inf f - w 3 W w w y Inf - y y z Inf - z z v’s x’s w’s 4-17 Network Layer
Network Layer Network Layer Distance Vector Algorithm Distance Vector Algorithm D x (y) = estimate of least cost from x to y D ( ) f l f Node x knows cost to each neighbor v: g c(x,v) Node x maintains distance vector D x = Node x maintains distance vector D x [D x (y): y є N ] Node x also maintains its neighbors’ Node x also maintains its neighbors distance vectors For each neighbor v x maintains For each neighbor v, x maintains D v = [D v (y): y є N ] 4-18 Network Layer
Recommend
More recommend