Network Laer: Routing Instructor: Anirban Mahanti Office: ICT 74 Email: mahanti@cpsc.ucalgar.ca Class Location: ICT Lectures: MWF :00 :0 hours Notes derived Computer Networking: A Top Down Approach Featuring the Internet, 00, rd edition, Jim Kurose, Keith Ross, Addison-Wesle. Slides are adapted the companion web site of the book, as modified b Anirban Mahanti (and Care Williamson). CPSC44: Routing Routing Algorithms Link State Distance Vector Hierarchical Routing CPSC44: Routing Interpla between routing and forwarding routing algorithm local forwarding table header value output link 000 00 0 00 value in arriving packet s header 0 CPSC44: Routing
Graph abstraction Graph: G = (N,E) u v w N = set of routers = { u, v, w,,, } E = set of links ={ (u,v), (u,), (v,), (v,w), (,w), (,), (w,), (w,), (,) } Remark: Graph abstraction is useful in other network contets Eample: PP, where N is set of peers and E is set of TCP connections CPSC44: Routing 4 Graph abstraction: costs u v w c(, ) = cost of link (, ) -e.g., c(w,) = cost could alwas be, or inversel related to bandwidth, or inversel related to congestion Cost of path (,,,, p ) = c(, ) + c(, ) + + c( p-, p ) Question: What s the least-cost path between u and? Routing algorithm: find good paths source to destination router. CPSC44: Routing Routing Algorithm Classification. Global, decentralied? Global: all routers have complete topolog, link cost info link state algorithms Decentralied: router knows about phsicall-connected neighbors Iterative, distributed computations distance vector algorithms. Static, dnamic? Static: routes change slowl over time Dnamic: routes change more quickl periodic update in response to link cost changes. Load sensitivit? Man Internet routing algos are load insensitive CPSC44: Routing 6
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 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 node to ; = if not direct neighbors D(v): current value of cost of path source to dest. v p(v): predecessor node along path source to v N': set of nodes whose least cost path definitivel known CPSC44: Routing 7 Dijsktra s Algorithm Initialiation: N' = {u} for all nodes v 4 if v adjacent to u 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) ) /* new v is either old v or known 4 shortest path w plus cost w to v */ until all nodes in N' CPSC44: Routing 8 Dijkstra s algorithm: eample Step 0 4 N' u u u uv uvw uvw D(v),p(v),u,u,u D(w),p(w),u 4,,, D(),p(),u D(),p(), D(),p() 4, 4, 4, u v w CPSC44: Routing 9
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 A +e D 0 0 B 0 e C e initiall +e A 0 D +e B 0 C 0 recompute routing 0 A +e D 0 0 B C +e recompute A +e 0 D B 0 +e 0 C recompute CPSC44: Routing 0 Distance Vector Algorithm () Bellman-Ford Equation (dnamic programming) Define d () := cost of least-cost path to Then d () = min {c(,v) + d v () } where min is taken over all neighbors of CPSC44: Routing Bellman-Ford eample () u v w Clearl, d v () =, d () =, d w () = B-F equation sas: d u () = min { c(u,v) + d v (), c(u,) + d (), c(u,w) + d w () } = min { +, +, + } = 4 Node that achieves minimum is net hop in shortest path forwarding table CPSC44: Routing 4
Distance Vector Algorithm () D () = estimate of least cost to Distance vector: D = [D (): є N ] Node knows each neighbor v: c(,v) Node maintains D Node also maintains its neighbors distance vectors For each neighbor v, maintains D v = [D v (): є N ] CPSC44: Routing Distance vector algorithm (4) Basic idea: Each node periodicall sends its own distance vector estimate to neighbors When node a node receives new DV estimate neighbor, it updates its own DV using B-F equation: D () min v {c(,v) + D v ()} for each node N Under some conditions, the estimate D () converge the actual least cost d () CPSC44: Routing 4 Distance Vector Algorithm () Iterative, asnchronous: each local iteration caused b: local link cost change DV update message neighbor Distributed: each node notifies neighbors when its DV changes neighbors then notif their neighbors if necessar Each node: wait for (change in local link cost of msg neighbor) recompute estimates if DV to an dest has changed, notif neighbors CPSC44: Routing
node table 0 7 node table node table 7 0 D () = min{c(,) + D (), c(,) + D ()} = min{+0, 7+} = 0 0 0 7 0 0 7 0 7 0 0 7 0 0 0 0 0 0 0 0 0 0 D () = min{c(,) + D (), c(,) + D ()} = min{+, 7+0} = 7 0 time CPSC44: Routing 6 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 0 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 and updates its table. It computes a new least 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. CPSC44: Routing 7 Distance Vector: link cost changes Link cost changes: good news travels fast bad news travels slow - count to infinit problem! 44 iterations before algorithm stabilies: see tet Poissoned 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? 60 4 0 CPSC44: Routing 8 6
Comparison of LS and DV algorithms Message compleit LS: with n nodes, E links, O(nE) msgs sent DV: echange between neighbors onl Speed of Convergence LS: O(n ) algorithm requires O(nE) msgs ma have oscillations DV: convergence time varies ma have routing loops count-to-infinit problem Robustness: what happens if router malfunctions? LS: node can advertise incorrect link cost each node computes onl its own table DV: DV node can advertise incorrect path cost each node s table used b others error propagate thru network CPSC44: Routing 9 Routing Algorithms Link State Distance Vector Hierarchical Routing CPSC44: Routing 0 Hierarchical Routing: Motivation Our routing stud thus far - idealiation all routers identical, network flat scale: with 00 million destinations: can t store all dest s in routing tables! routing table echange would swamp links! administrative autonom internet = network of networks each network admin ma want to control routing in its own network CPSC44: Routing 7
Hierarchical Routing aggregate routers into regions, autonomous sstems (AS) routers in same AS run same routing protocol intra-as routing protocol routers in different AS can run different intra- AS routing protocol Gatewa router Direct link to router in another AS Establishes a peering relationship Peers run an inter-as routing protocol CPSC44: Routing Interconnected ASes c a b AS a c d b Intra-AS Routing algorithm AS Forwarding table Inter-AS Routing algorithm c a b AS Forwarding table is configured b both intra- and inter-as routing algorithm Intra-AS sets entries for internal dests Inter-AS & Intra-As sets entries for eternal dests CPSC44: Routing Inter-AS tasks Obtain reachabilit information neighboring AS(s) Propagate this info to all routers within the AS All Internet gatewa routers run a protocol called BGPv4 (we will talk about this soon) c a b AS a c d b AS c a b AS CPSC44: Routing 4 8
Eample: Choosing among multiple ASes Now suppose AS learns the inter-as protocol that subnet is reachable AS and 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 inter-as protocol that subnet is reachable via multiple gatewas Use routing info 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 forwarding table the interface I that leads to least-cost gatewa. Enter (,I) in forwarding table CPSC44: Routing Hierarchical Routing Routing in the Internet CPSC44: Routing 6 Intra-AS Routing Also known as Interior Gatewa Protocols (IGP) Most common Intra-AS routing protocols: RIP: Routing Information Protocol (DV protocol) OSPF: Open Shortest Path First (Link-State) IGRP: Interior Gatewa Routing Protocol (Cisco proprietar) CPSC44: Routing 7 9
RIP ( Routing Information Protocol) Distance vector algorithm Included in BSD-UNIX Distribution in 98 Distance metric: # of hops (ma = hops) u A C B D v w destination hops u v w CPSC44: Routing 8 OSPF (Open Shortest Path First) open : publicl available Uses Link State algorithm LS packet dissemination Topolog map at each node Route computation using Dijkstra s algorithm OSPF advertisement carries one entr per neighbor router Advertisements disseminated to entire AS (via flooding) Carried in OSPF messages directl over IP (rather than TCP or UDP CPSC44: Routing 9 OSPF advanced features (not in RIP) Securit: all OSPF messages authenticated (to prevent malicious intrusion) Multiple same-cost paths allowed (onl one path in RIP) For each link, multiple cost metrics for different TOS (e.g., satellite link cost set low for best effort; high for real time) Integrated uni- and multicast support: Multicast OSPF (MOSPF) uses same topolog data base as OSPF Hierarchical OSPF in large domains. CPSC44: Routing 0 0
Hierarchical OSPF CPSC44: Routing Internet inter-as routing: BGP BGP (Border Gatewa Protocol): the de facto standard BGP provides each AS a means to:. Obtain subnet reachabilit information neighboring ASs.. Propagate the reachabilit information to all routers internal to the AS.. Determine good routes to subnets based on reachabilit information and polic. Allows a subnet to advertise its eistence to rest of the Internet: I am here CPSC44: Routing BGP basics Pairs of routers (BGP peers) echange routing info over semipermanent TCP conctns: BGP sessions Note that BGP sessions do not correspond to phsical links. When AS advertises a prefi to AS, AS is promising it will forward an datagrams destined to that prefi towards the prefi. AS can aggregate prefies in its advertisement c a b AS a AS c d b c a b AS ebgp session ibgp session CPSC44: Routing
Path attributes & BGP routes When advertising a prefi, advert includes BGP attributes. prefi + attributes = route Two important attributes: AS-PATH: contains the ASs through which the advert for the prefi passed: AS 67 AS 7 NEXT-HOP: Indicates the specific internal-as router to net-hop AS. (There ma be multiple links current AS to net-hop-as.) When gatewa router receives route advert, uses import polic to accept/decline. CPSC44: Routing 4 BGP route selection Router ma learn about more than route to some prefi. Router must select route. Elimination rules:. Local preference value attribute: polic decision. Shortest AS-PATH. Closest NEXT-HOP router: hot potato routing 4. Additional criteria CPSC44: Routing Multicast/Broadcast duplicate R duplicate creation/transmission R R R duplicate R R4 R R4 (a) (b) Source-duplication versus in-network duplication. (a) source duplication, (b) in-network duplication CPSC44: Routing 6
Network Laer Routing: summar What we ve covered: network laer services routing principles: link state and distance vector hierarchical routing Internet routing protocols RIP, OSPF, BGP what s inside a router? Net stop: the Data link laer! CPSC44: Routing 7