CS 35- Computer Networks : Routing Algorithms Professor Patrick Tranor 0//3 Lecture 3
Reminders The due date for Homework was moved to Thursda. Reason: Allow ou to attend toda s lecture. Project is still due in one week. Absolutel no etensions will be given.
Last Time Subnets provide granularit for address assignment and ease management. What is 9.68.8.0? 9.68.3.0? 9.68.8.0: 000000 00000 0000000 00000000 9.68.3.0: 000000 00000 0000000 00000000 What is NAT? DHCP? What are some securit issues associated with ICMP messages? 3
Chapter 4: Network Laer 4. Introduction 4. Virtual circuit and datagram networks 4.3 What s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing 4
Interpla between routing and forwarding routing algorithm routing algorithm determines end-end-path through network local forwarding table header 000 00 0 00 output link 3 forwarding table determines local forwarding at this router value in arriving packet s header 0 3 5
Graph abstraction 5 u v 3 3 w 5 Graph: G = (N,E) N = set of routers = { u, v, w,,, } E = set of links ={ (u,v), (u,), (v,), (v,w), (,w), (,), (w,), (w,), (,) } Aside: Graph abstraction is useful in other network contets Eample: PP, where N is set of peers and E is set of TCP connections 6
Graph abstraction: costs u 5 v 3 3 w 5 c(, ) = cost of link (, ) - e.g., c(w,) = 5 cost could alwas be, or inversel related to bandwidth, or inversel related to congestion Cost of path (,, 3,, p ) = c(, ) + c(, 3 ) + + c( p-, p ) Question: What s the least-cost path between u and? Routing algorithm: algorithm that finds least-cost path 7
What are the costs? We will speak ver generall about the idea of link cost. Some potential eamples include: Bandwidth/Speed Phsical Length Monetar Cost Polic Configurations 8
Routing Algorithm classification Global or decentralied information? Global: all routers have complete topolog, link cost info link state algorithms Decentralied: router knows phsicallconnected neighbors, link costs to neighbors iterative process of computation, echange of info with neighbors Static or dnamic? Static: routes change slowl over time Dnamic: routes change more quickl periodic update in response to link cost changes Load Sensitive or Insensitive Respond to traffic conditions distance vector algorithms 9
Chapter 4: Network Laer 4. Introduction 4. Virtual circuit and datagram networks 4.3 What s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing IPv6 0
A Link-State Routing Algorithm Dijkstra s algorithm net topolog, 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 Notation: c(,): link cost from node to ; = 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 definitivel known
Dijsktra s Algorithm Initialiation: 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 0 add w to N' update D(v) for all v adjacent to w and not in N' : D(v) = min( D(v), D(w) + c(w,v) ) 3 /* new cost to v is either old cost to v or known 4 shortest path cost to w plus cost from w to v */ 5 until all nodes in N' Notation: c(,): link cost from node to ; = 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 definitivel known
Dijkstra s algorithm: eample Step 0 3 4 5 N' u u u uv uvw uvw D(v),p(v),u,u,u D(w),p(w) 5,u 4, 3, 3, D(),p(),u D(),p(), D(),p() 4, 4, 4, 5 u v 3 3 w 5 3
Dijkstra s algorithm: eample () Resulting shortest-path tree from u: v w u Resulting forwarding table in u: destination v w link (u,v) (u,) (u,) (u,) (u,) 4
Dijkstra s algorithm, discussion Algorithm compleit: n nodes each iteration: need to check all nodes, w, not in N n(n+)/ comparisons: O(n ) more efficient implementations possible: O(nlogn) Oscillations possible: e.g., link cost = amount of carried traffic D A +e 0 0 0 e B C A +e 0 D 0 +e C 0 B D A 0 +e 0 0 C +e B A +e 0 D 0 +e C 0 B e initiall given these costs, find new routing. resulting in new costs given these costs, find new routing. resulting in new costs given these costs, find new routing. resulting in new costs 5
Chapter 4: Network Laer 4. Introduction 4. Virtual circuit and datagram networks 4.3 What s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing IPv6 6
Distance Vector Algorithm Bellman-Ford Equation (dnamic programming) Define d () := cost of least-cost path from to Then: d () = min {c(,v) + d v () } v cost from neighbor v to destination cost to neighbor v min taken over all neighbors v of 7
Bellman-Ford eample 5 Clearl, d v () = 5, d () = 3, d w () = 3 u v 3 3 w Node that achieves minimum is net hop in shortest path forwarding table 5 B-F equation sas: d u () = min { c(u,v) + d v (), c(u,) + d (), c(u,w) + d w () } = min { + 5, + 3, 5 + 3} = 4 8
Distance Vector Algorithm D () = estimate of least cost from to Node knows cost to each neighbor v: c(,v) Node maintains distance vector D = [D (): є N ] Node also maintains its neighbors distance vectors For each neighbor v, maintains D v = [D v (): є N ] 9
Distance vector algorithm (4) Basic idea: Each node periodicall sends its own distance vector estimate to neighbors When a node receives new DV estimate from neighbor, it updates its own DV using B-F equation: D () min v {c(,v) + D v ()} for each node N Under natural conditions, the estimate D () converge to the actual least cost d () 0
Distance Vector Algorithm (5) Iterative, asnchronous: each local iteration caused b: local link cost change DV update message from neighbor Distributed: each node notifies neighbors onl when its DV changes neighbors then notif their neighbors if necessar Each node: wait for (change in local link cost or msg from neighbor) recompute estimates if DV to an dest has changed, notif neighbors
D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = node table from cost to 0 7 from cost to 0 3 0 7 0 D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 3 node table from cost to 0 7 node table cost to from 7 0 time
D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 3 node table cost to cost to cost to from 0 7 from 0 3 0 7 0 from 0 3 0 3 0 node table from cost to 0 from cost to 0 7 0 7 0 from cost to 0 3 0 3 0 7 node table cost to cost to cost to 0 7 0 3 from 7 0 from 0 3 0 from 0 3 0 3
Distance Vector: link cost changes Link cost changes: node detects local link cost change updates routing info, recalculates distance vector if DV changes, notif neighbors 4 50 good news travels fast At time t 0, detects the link-cost change, updates its DV, and informs its neighbors. At time t, receives the update from and updates its table. It computes a new least cost to and sends its neighbors its DV. At time t, receives s update and updates its distance table. s least costs do not change and hence does not send an message to. 4
Distance Vector: link cost changes Link cost changes: good news travels fast bad news travels slowl - count to infinit problem! 44 iterations before algorithm stabilies: see tet 60 4 50 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) will this completel solve count to infinit problem? 5
The DV Convergence Problem Before the link cost changes, costs are: D()=4, D()=, D()=, D()=5 What does see as the shortest route to when c(,)=60? Georgia Tech 60 4 50 D() = min{c(,) + D(), c(,) + D()} = min{60+0, +5} = 6 What happens at node after this? D() = min{c(,) + D(), c(,) + D()} = min{50+0, +6} = 7 Round and round it goes (44 times, to be eact) US Falcon - Information Assurance 6
Comparison of LS and DV algorithms Message compleit LS: with n nodes, E links, O(nE) msgs sent DV: echange between neighbors onl convergence time varies Speed of Convergence LS: O(n ) algorithm requires O(nE) msgs ma have oscillations DV: convergence time varies ma be routing loops Robustness: what happens if router malfunctions? LS: DV: node can advertise incorrect link cost each node computes onl its own table DV node can advertise incorrect path cost each node s table used b others error propagate thru network count-to-infinit problem 7
Chapter 4: Network Laer 4. Introduction 4. Virtual circuit and datagram networks 4.3 What s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing IPv6 8
Hierarchical Routing Our routing stud thus far - idealiation all routers identical network flat not true in practice scale: with 600 million destinations: can t store all dest s in routing tables! administrative autonom Internet = network of networks each network admin ma want to control routing in its own network routing table echange would swamp links! 9
Hierarchical Routing aggregate routers into regions, autonomous sstems (AS) routers in same AS run same routing protocol Gatewa router Direct link to router in another AS intra-as routing protocol routers in different AS can run different intra-as routing protocol 30
Interconnected ASes 3c 3a 3b AS3 a c d b Intra-AS Routing algorithm AS Inter-AS Routing algorithm a c AS b Forwarding table is configured b both intraand inter-as routing algorithm Forwarding table Intra-AS sets entries for internal dests Inter-AS & Intra-As sets entries for eternal dests 3
Inter-AS tasks Suppose router in AS receives datagram for which the dest is outside of AS Router should forward packet towards one of the gatewa routers, but which one? AS needs:. to learn which dests are reachable through AS and which through AS3. to propagate this reachabilit info to all routers in AS Job of inter-as routing! 3c other networks 3b 3a AS3 a AS c d b a AS c b other networks 3
Eample: Setting forwarding table in router d Suppose AS learns (via inter-as protocol) that subnet is reachable via AS3 (gatewa c) but not via AS. Inter-AS protocol propagates reachabilit info to all internal routers. Router d determines from intra-as routing info that its interface I is on the least cost path to c. Puts in forwarding table entr (,I). other networks 3c 3a 3b AS3 a AS c d b a AS c b other networks 33
Eample: Choosing among multiple ASes Now suppose AS learns from the inter-as protocol that subnet is reachable from AS3 and from AS. To configure forwarding table, router d must determine towards which gatewa it should forward packets for dest. This is also the job on inter-as routing protocol! 3c other networks 3b 3a AS3 a AS c d? b a AS c b other networks 34
Eample: Choosing among multiple ASes Now suppose AS learns from the inter-as protocol that subnet is reachable from AS3 and from AS. To configure forwarding table, router d must determine towards which gatewa it should forward packets for dest. This is also the job on inter-as routing protocol! Hot potato routing: send packet towards closest of two routers. Learn from inter-as protocol that subnet is reachable via multiple gatewas Use routing info from intra-as protocol to determine costs of least-cost paths to each of the gatewas Hot potato routing: Choose the gatewa that has the smallest least cost Determine from forwarding table the interface I that leads to least-cost gatewa. Enter (,I) in forwarding table 35
Net Time Read Sections 4.6 and 4.7 Internet Routing and Multicast Project - Due net Tuesda 36