Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer (contd.) Routing

Similar presentations


Presentation on theme: "Network Layer (contd.) Routing"— Presentation transcript:

1 Network Layer (contd.) Routing

2 Packet transfer in network
source message M application transport network link physical segment Ht M Ht datagram Ht Hn M Hn frame Ht Hn Hl M link physical Encapsulation switch destination network link physical Ht Hn M message application transport network link physical Ht Hn Hl M M Ht Hn M Ht M Ht Hn M router Ht Hn Hl M Lecture 3

3 Network-Layer Functions
Forwarding: move packets from router’s input to router output Image courtesy: Network Layer

4 Routing Routing Goal: determine “good” paths
Image courtesy: Routing Goal: determine “good” paths (sequences of routers) through network from source to dest. application transport network data link physical application transport network data link physical ?? 1. Send data 2. Receive data ?? ??

5 Routing: Graph formulation
Graph abstraction for the routing problem: graph nodes are routers graph edges are physical links links have properties: delay, capacity, $ cost, policy u y x w v z 2 1 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) }

6 Graph abstraction: costs
u y x w v z 2 1 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 (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Network Layer

7 Key Desired Properties of a Routing Algorithm
Simplicity Robustness Optimality find good path (for user/provider) Robustness: a network is expected to run continuously for many years, with changes in topology and traffic Optimality: depends on whose point of view: users: networks

8 Routing Design Space Routing has a large design space
- Robustness - Optimality - Simplicity Routing has a large design space who decides routing? source routing: end hosts make decision network routing: networks make decision how many paths from source s to destination d? multi-path routing single path routing will routing adapt to network traffic demand? adaptive routing static routing

9 Routing Design Space: example network routing
- Robustness - Optimality - Simplicity Routing has a large design space who decides routing? source routing: end hosts make decision network routing: networks/routers make decision - Based on information available from the network how many paths from source s to destination d? multi-path routing single path routing will routing adapt to network traffic demand? adaptive routing static routing

10 Routing Algorithm design based on available information
Global or decentralized information? Global: all routers have complete topology, link cost info “link state” algorithms Decentralized: router knows physically-connected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms u y x w v z 2 1 3 5 Network Layer

11 Link state (LS) routing algorithm
Network Layer

12 Link-State Routing Algorithm
Network topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info Problem Given a topology, link costs, and a source-destination (S-D) pair, determine a route from S to D so that the route has the minimum cost (i.e., is the shortest). Solution: Dijkstra’s shortest-path algorithm u y x w v z 2 1 3 5 Network Layer

13 A Link-State Routing Algorithm: Dijkstra’s Algorithm
Parameters: 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 Network Layer

14 Dijkstra’s algorithm: example
u y x w v z 2 1 3 5 Shortest paths: u  x: 1,u u  v: 2,u u  y: 2,x u  w: 3,y u  z: 4,y Step 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 Network Layer

15 Dijkstra’s algorithm: example (2)
Resulting shortest-path tree from u: Shortest paths: u  x: 1,u u  v: 2,u u  y: 2,x u  w: 3,y u  z: 4,y u y x w v z Resulting forwarding table in u: v x y w z (u,v) (u,x) destination link Network Layer

16 Dijkstra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v
if v adjacent to u then D(v) = c(u,v) 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' : D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known shortest path cost to w plus cost from w to v */ 15 until all nodes in N' Network Layer

17 Let’s solve this example!
Determine shortest paths from R1 to all other nodes with corresponding predecessor nodes! Network Layer

18 Distance Vector routing algorithm
Network Layer

19 Distance Vector Routing
Practically entire network topology (each link state) may not be known accurately Only the information to a direct neighbor may be known Distance-vector routing algorithm operates by Each router trusting its direct neighbors Each router maintain a table (vector) estimating the best known distance to each destination which line to use to get there Tables (vectors) are updated by exchanging information with the direct neighbors

20 Distance Vector Routing: Basic Idea
At node i, the basic update rule where - di denotes the distance estimation from i to the destination, - N(i) is set of neighbors of node i, and - dij is the distance of the direct link from i to j - dj denotes the distance estimation feedback from j to i Based on Bellman-Ford algorithm destination j i

21 Distance Vector Algorithm
Each node: wait for (change in local link cost or msg from neighbor) recompute estimates if DV to any dest has changed, notify neighbors Iterative & Distributed neighbors then notify their neighbors and so on… Network Layer

22 D-V Algorithm example z y x node x table x y z x y z 0 2 7 ∞ from
from cost to node y table cost to x z 1 2 7 y x y z x y from z node z table cost to x y z x ∞ ∞ ∞ from y z 7 1 time Initially: Network Layer

23 z y x Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 node x table x y z x y z from cost to cost to x y z x 2 3 from y z node y table cost to x z 1 2 7 y x y z x y from z node z table cost to x y z x ∞ ∞ ∞ from y z 7 1 time Network Layer

24 z y x node x table x y z x y z 0 2 7 ∞ from cost to cost to x y z x
from cost to cost to x y z x from y z node y table cost to cost to x z 1 2 7 y x y z x y z x x y from y from z z node z table cost to cost to x y z x y z x x ∞ ∞ ∞ from y from y z z 7 1 time Network Layer

25 z y x node x table x y z x y z 0 2 7 ∞ from cost to cost to cost to
from cost to cost to cost to x y z x y z x x from y from y z z node y table cost to cost to cost to x z 1 2 7 y x y z x y z x y z x x x y from y from from y z z z node z table cost to cost to cost to x y z x y z x y z x x x ∞ ∞ ∞ from y from y from y z z z 7 1 time Network Layer

26 Distance Vector: link cost changes
node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors x z 1 4 50 y At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. “good news travels fast” At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z. Network Layer

27 Distance-Vector Algorithms: Link cost changes
A goes down or line between A and B is down Bad news propagate slowly This is called the counting-to-infinity problem Distances to A

28 Solution: Split Horizon Hack
Actual distance to a destination is not reported on the line on which packets to that destination are sent. Instead these distances are reported as “infinity: Poisoned reverse” Will this completely solve count-to-infinity problem? B D A C C tells D the truth about its distance to A, but lies to B and says the distance is infinity.

29 A topology where split horizon fails
Suppose that D becomes unreachable from C. A and B are reporting infinite distances to C, but they are reporting distances of length 2 to each other. A and B will count to infinity.

30 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(n2) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies 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 through network Network Layer


Download ppt "Network Layer (contd.) Routing"

Similar presentations


Ads by Google