Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS4470 Computer Networking Protocols

Similar presentations


Presentation on theme: "CS4470 Computer Networking Protocols"— Presentation transcript:

1 CS4470 Computer Networking Protocols
1/12/2019 CS Computer Networking Protocols Routing Huiping Guo Department of Computer Science California State University, Los Angeles

2 Outline Routing algorithms Link State Distance Vector
1/12/2019 Outline Routing algorithms Link State Distance Vector 11. Routing CS4470_F17

3 Routing/Forwarding Overview
1/12/2019 Routing/Forwarding Overview Extract destination IP address field Look up IP address in the routing table Find next hop address to forward to Send datagram to the next hop 11. Routing CS4470_F17

4 Source of Route Table Information
1/12/2019 Source of Route Table Information Manual Table created by hand Useful in small networks Useful if routes never change Automatic – Routing algorithms software creates/updates tables Needed in large networks Changes routes when failures occur 11. Routing CS4470_F17

5 Graph abstraction z x u y w v
1/12/2019 Graph abstraction u y x w v z 2 1 3 5 A graph is used to formulate routing problems Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x),(u,w), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Node y is a neighbor of node x if (x,y) is in E. 11. Routing CS4470_F17

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: distance, link speed, bandwidth A path: a sequence of nodes 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, or the shortest path 11. Routing CS4470_F17

7 Routing Algorithm classification
1/12/2019 Routing Algorithm classification Global or decentralized information? Global: all routers have complete knowledge of the network topology, link cost info etc “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 11. Routing CS4470_F17

8 Link state algorithm Each router keeps track of its links
Whether the link is up or down The cost on the link Each router broadcasts the link state To give every router a complete view of the graph Each router runs Dijkstra’s algorithm To compute the shortest paths … and construct the forwarding table Example protocols Open Shortest Path First (OSPF) Intermediate System – Intermediate System (IS-IS) 11. Routing CS4470_F17

9 Dijkstra’s algorithm net topology, link costs known to all nodes
accomplished via “link state broadcast” all nodes have same info computes least cost paths from one node (‘source”) to all other nodes gives forwarding table for that node iterative: after k iterations, know least cost path to k dest.’s 11. Routing CS4470_F17

10 Dijkstra’s algorithm 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): previous node along path from source to v N': set of nodes whose least cost path definitively known 11. Routing CS4470_F17

11 Dijsktra’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' 11. Routing CS4470_F17

12 Dijkstra’s algorithm: example
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 u y x w v z 2 1 3 5 11. Routing CS4470_F17

13 Dijkstra’s algorithm: example
Resulting shortest-path tree from u: u y x w v z Resulting forwarding table in u: v x y w z (u,v) (u,x) destination link 11. Routing CS4470_F17

14 Distance Vector Algorithm
Distributed Each node receives some information from its directly attached neighbors. Each node performs a calculation and then distributes the results back to its neighbors Iterative The above process continues on until no more information is exchanged between neighbors. Asynchronous It does not require all of the nodes to operate in lockstep with each other Example protocol Routing Information Protocol (RIP) 11. Routing CS4470_F17

15 Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y C(x,v) :=link cost between x and v Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors v of x 11. Routing CS4470_F17

16 Bellman-Ford example Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
u y x w v z 2 1 3 5 B-F equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 11. Routing CS4470_F17

17 Distance Vector Algorithm
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 ] 11. Routing CS4470_F17

18 Distance vector algorithm
Basic idea: Each node periodically sends its own distance vector estimate to neighbors When 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 If node x’s distance vector has changed as a result of this update step, x will send its updated DV to each of its neighbors. Each cost estimate Dx(y) converges to the actual cost dx(y) 11. Routing CS4470_F17

19 Distance Vector Algorithm
1/12/2019 Distance Vector Algorithm Each node: wait for (change in local link cost or message from neighbor) recompute estimates if DV to any destination has changed, notify neighbors Iterative, asynchronous: each local iteration caused by: Local link cost change Distance vector update message from neighbor Distributed: Each node notifies neighbors only when its DV changes Neighbors then notify their neighbors if necessary 11. Routing CS4470_F17

20 Distance Vector Example: Step 0
1/12/2019 Distance Vector Example: Step 0 Optimum 1-hop paths E F A C D B 2 3 6 4 1 Table for A Dst Cst Hop A B 4 C D E 2 F 6 Table for B Dst Cst Hop A 4 B C D 3 E F 1 Table for C Dst Cst Hop A B C D 1 E F Table for D Dst Cst Hop A B 3 C 1 D E F Table for E Dst Cst Hop A 2 B C D E F 3 Table for F Dst Cst Hop A 6 B 1 C D E 3 F 11. Routing CS4470_F17

21 Distance Vector Example: Step 2
1/12/2019 Distance Vector Example: Step 2 Optimum 2-hop paths Table for A Dst Cst Hop A B 4 C 7 F D E 2 5 Table for B Dst Cst Hop A 4 B C 2 F D 3 E 1 A E F C D B 3 1 1 2 6 1 3 4 Table for C Dst Cst Hop A 7 F B 2 C D 1 E 4 Table for D Dst Cst Hop A 7 B 3 C 1 D E F 2 Table for E Dst Cst Hop A 2 B 4 F C D E 3 Table for F Dst Cst Hop A 5 B 1 C D 2 E 3 F 11. Routing CS4470_F17

22 Distance Vector Example: Step 3
1/12/2019 Distance Vector Example: Step 3 Optimum 3-hop paths Table for A Dst Cst Hop A B 4 C 6 E D 7 2 F 5 Table for B Dst Cst Hop A 4 B C 2 F D 3 E 1 A E F C D B 3 1 1 2 6 1 3 4 Table for C Dst Cst Hop A 6 F B 2 C D 1 E 4 Table for D Dst Cst Hop A 7 B 3 C 1 D E 5 F 2 Table for E Dst Cst Hop A 2 B 4 F C D 5 E 3 Table for F Dst Cst Hop A 5 B 1 C D 2 E 3 F 11. Routing CS4470_F17

23 Comparison of LS and DV algorithms
The two algorithms take complementary approaches towards computing routing Distance Vector Each node talks to ONLY its directly connected neighbors But it provides its neighbors with least-cost estimates from itself to ALL the notes in the network Link State Each node talks to ALL other notes (via broadcast) It tells them ONLY the costs of its directly connected links 11. Routing CS4470_F17


Download ppt "CS4470 Computer Networking Protocols"

Similar presentations


Ads by Google