Download presentation
Presentation is loading. Please wait.
Published byBartholomew Wilcox Modified over 8 years ago
1
@Yuan Xue (yuan.xue@vanderbilt.edu) A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their original slides that accompany the book “Computer Networking, A Top-Down Approach” All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved CS 283Computer Networks Spring 2011 Instructor: Yuan Xue
2
@Yuan Xue (yuan.xue@vanderbilt.edu) Chapter 4: Network Layer Outline Overview and Service Model 4. 1 Introduction 4.2 Virtual circuit and datagram networks Principle 4.5 Routing algorithms Link state Distance Vector Practice (in the context of Internet) 4.4 IP: Internet Protocol IP packet format/Fragmentation IP address/DHCP/NAT Routing and Forwarding in Internet Packet Forwarding 4.6 Routing protocols in Internet 4.5.3 Hierarchical Routing 4.6.1 Intra-AS Routing: RIP/OSPF 4.6.3 Inter-AS Routing: BGP Implementation 4.3 What’s inside a router Broadcast and multicast routing
3
@Yuan Xue (yuan.xue@vanderbilt.edu) Network layer application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical Deal with internetworking (multi-hop network)
4
@Yuan Xue (yuan.xue@vanderbilt.edu) Network Layer Service Models Datagram (connectionless) and VC (connection) Principle Addressing How to define ID? Aspect to consider? (Routing. Management, Scalability) How to get an address for a device (router, host) Routing Given a network (graph), which path(s) to use? Can I get a path in a distributed way? Forwarding If I know the path, how to deliver the packets along this path (in a distributed way?) Deal with heterogeneous local area networks Fragmentation/reassembly
5
@Yuan Xue (yuan.xue@vanderbilt.edu) Network Layer Deal with internetworking (multi-hop network) Service Models Principle Routing Practice (in the context of Internet) Deal with heterogeneous local area networks Fragmentation/IP packet format Addressing IP address/NAT/DHCP Routing and forwarding in Internet RIP/OSPF/BGP Router Design More than just unicast Multicast and Broadcast (both principle/practice)
6
@Yuan Xue (yuan.xue@vanderbilt.edu) Routing Algorithm Network Model Simple graph model Graph with traffic/capacity information Routing Objective Simple graph model Minimum cost (each link is associated with a cost) Shortest path (cost = number of hop) In simple graph model, the link cost is independent of the traffic routed on the link With capacity/traffic (beyond simple cost metric) Maximum throughput Minimum congestion Minimum delay Our focus is on the simple graph model (minimum cost routing) traffic-related objective (Minimum delay, maximum throughput) can be sometimes incorporated into a link cost, but special care has to be made. (more details later)
7
@Yuan Xue (yuan.xue@vanderbilt.edu) 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 Model Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections
8
@Yuan Xue (yuan.xue@vanderbilt.edu) Graph Model: 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
9
@Yuan Xue (yuan.xue@vanderbilt.edu) Routing Algorithm Centralized Link-state: Dijkstra Distributed Distance-vector: Bellman-Ford Linear/nonlinear optimization algorithms (advance topic, not covered in this class) Deal with traffic-related objective Maximum throughput Minimum congestion Minimum delay
10
@Yuan Xue (yuan.xue@vanderbilt.edu) Routing Protocol What information needs to be distributed? Distance vector (RIP) vs. Link state (OSPF) Who does the job? Source vs. Hop-by-hop routing Differ in how path information is provided during packet forwarding Source routing (used in small networks such as ad hoc wireless networks) Each packet carries in its header the complete, ordered list of the addresses of the nodes through which the packet will be routed Intermediate nodes do not need to maintain up-to-date routing table Packet header can be large, introducing overhead in packet forwarding Hop-by-hop routing (used in Internet) Information required for packet forwarding is stored in the forwarding tables at intermediate nodes Overhead in maintaining the routing/forwarding table
11
@Yuan Xue (yuan.xue@vanderbilt.edu) Chapter 4: Network Layer Outline Overview and Service Model 4. 1 Introduction 4.2 Virtual circuit and datagram networks Principle 4.5 Routing algorithms Link state Distance Vector Practice (in the context of Internet) 4.4 IP: Internet Protocol IP packet format/Fragmentation IP address/DHCP/NAT Routing and Forwarding in Internet Packet Forwarding 4.6 Routing protocols in Internet 4.5.3 Hierarchical Routing 4.6.1 Intra-AS Routing: RIP/OSPF 4.6.3 Inter-AS Routing: BGP Implementation 4.3 What’s inside a router Broadcast and multicast routing
12
@Yuan Xue (yuan.xue@vanderbilt.edu) A Link-State Routing Algorithm Dijkstra’s algorithm Information known: Each node knows global network topology + link costs all nodes have same global network information accomplished via “link state broadcast” Route computation: Each node computes the route independently computes least cost paths from one node (‘source”) to all other nodes Iterative algorithm Derives the forwarding table for that node
13
@Yuan Xue (yuan.xue@vanderbilt.edu) 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 If D(v) changed, p(v) = w 14 /* new cost to v is either old cost to v or known 15 shortest path cost to w plus cost from w to v */ 16 until all nodes in N' u y x wv z 2 2 1 3 1 1 2 5 3 5 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 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
14
@Yuan Xue (yuan.xue@vanderbilt.edu) Dijkstra’s algorithm u y x wv z Resulting shortest-path tree from u: v x y w z (u,v) (u,x) destination link Resulting forwarding table in u: 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
15
@Yuan Xue (yuan.xue@vanderbilt.edu) Dijkstra’s algorithm: discussion Algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n 2 ) Efficient implementation possible in finding the minimum cost candidate (line 9) Oscillations possible with congestion sensitive routing e.g., link cost = amount of carried traffic Example below: D A; C A; B A Solution Make link cost independent from traffic asynchronous route computation A D C B 1 1+e e 0 e 1 1 0 0 A D C B 2+e 0 0 0 1+e 1 A D C B 0 2+e 1+e 1 0 0 A D C B 2+e 0 e 0 1+e 1 initially … recompute routing … recompute
16
@Yuan Xue (yuan.xue@vanderbilt.edu) Chapter 4: Network Layer Outline Overview and Service Model 4. 1 Introduction 4.2 Virtual circuit and datagram networks Principle 4.5 Routing algorithms Link state Distance Vector Practice (in the context of Internet) 4.4 IP: Internet Protocol IP packet format/Fragmentation IP address/DHCP/NAT Routing and Forwarding in Internet Packet Forwarding 4.6 Routing protocols in Internet 4.5.3 Hierarchical Routing 4.6.1 Intra-AS Routing: RIP/OSPF 4.6.3 Inter-AS Routing: BGP Implementation 4.3 What’s inside a router Broadcast and multicast routing
17
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance Vector Algorithm 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 v of x v
18
@Yuan Xue (yuan.xue@vanderbilt.edu) Bellman-Ford example 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 Forward table B-F equation says:
19
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance Vector Algorithm Distance Vector D x (y) = estimate of least cost from x to y x maintains distance vector D x = [D x (y): y є N ] Node x: knows cost to each neighbor v: c(x,v) maintains its neighbors’ distance vectors. For each neighbor v, x maintains D v = [D v (y): y є N ] Derives its own distance vectors and records the neighbor which achieves minimum as next hop in the forwarding table
20
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance vector algorithm Basic idea: from time-to-time, each node sends its own distance vector estimate to neighbors when 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 to the actual least cost d x (y)
21
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance Vector Algorithm Iterative, asynchronous: each local iteration caused by: local link cost change DV update message from neighbor Distributed: each node notifies neighbors only when its DV changes 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:
22
@Yuan Xue (yuan.xue@vanderbilt.edu) x y z x y z 0 2 7 ∞∞∞ ∞∞∞ from cost to from x y z x y z 0 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 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 32
23
@Yuan Xue (yuan.xue@vanderbilt.edu) 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
24
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance Vector: link cost changes Link cost changes: node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors “good news travels fast” x z 1 4 50 y 1 t 0 : y detects link-cost change, updates its DV, informs its neighbors. t 1 : z receives update from y, updates its table, computes new least cost to x, sends its neighbors its DV. t 2 : y receives z’s update, updates its distance table. y’s least costs do not change, so y does not send a message to z.
25
@Yuan Xue (yuan.xue@vanderbilt.edu) Distance Vector: link cost changes Link cost changes: good news travels fast bad news travels slow - See the example “count to infinity” problem Poisoned reverse: If Z routes through Y to get to X : Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) x z 1 4 50 y 60 1. Dy(x) = 6 (via z) Routing loop! 2. Dz(x) = 7 (via y) 3. Dv(x) = 8 (via z) …..need 44 (once z realizes xz with cost 50 is the way to go) iterations to stabilize What if the cost >> 50? count to infinity!
26
@Yuan Xue (yuan.xue@vanderbilt.edu) Comparison of LS and DV algorithms LS: Need global network topology/state Centralize algorithm: each node computes only its own table independently Two steps: topology/state information distribution route computation. DV: Need only local (neighbor) information (distance vector, neighbor link cost) Distributed/collaborative algorithm: each node’s calculation depends on other nodes' calculation Integrated message exchange and route computation
27
@Yuan Xue (yuan.xue@vanderbilt.edu) Comparison of LS and DV algorithms Message complexity LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only convergence time varies Speed of Convergence LS: O(n 2 ) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies may have oscillations may be routing loops count-to-infinity problem Robustness: what happens if router malfunctions? LS: node can advertise incorrect link cost each node computes only its own table DV: DV node can advertise incorrect path cost each node’s table used by others error propagate thru network
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.