Internet Routing Protocol Lecture Intra-domain Routing dvanced Sytem Topic Lent Term, 8 Timothy G. Griffin Computer Lab Cambridge UK Shortet Path Generalize ditance to weighted etting igraph G = (V,E) with weight function w: E R (aigning real value to edge) Weight of path p = v v v k i k! w( p) = " w( vi, vi + ) i= Shortet path = a path of the minimum weight Some lide of thi lecture are taken from lon Efrat Introduction to algorithm.
Shortet-Path Problem Shortet-Path problem Single-ource (ingle-detination). Find a hortet path from a given ource (vertex ) to each of the vertice. Single-pair. Given two vertice, find a hortet path between them. Solution to ingle-ource problem olve thi problem efficiently, too. ll-pair. Find hortet-path for every pair of vertice. ynamic programming algorithm. Negative Weight and Cycle? Negative edge are OK, a long a there are no negative weight cycle (otherwie path with arbitrary mall length would be poible) Shortet-path can have no cycle (otherwie we could improve them by removing cycle) ny hortet-path in graph G can be no longer than n edge, where n i the number of vertice
Relaxation For each vertex v in the graph, we maintain v.d(), the etimate of the hortet path from, initialized to at the tart Relaxing an edge (u,v) mean teting whether we can improve the hortet path to v found o far by going through u u v 9 Relax(u,v) u v u v 6 Relax(u,v) 6 u v Relax (u,v,g) if v.d() > u.d()+g.w(u,v) then v.etd(u.d()+g.w(u,v)) v.etparent(u) ijktra' lgorithm Non-negative edge weight Greedy, imilar to Prim' algorithm for MST Like breadth-firt earch (if all weight =, one can imply ue BFS) Ue Q, a priority queue T keyed by v.d() (BFS ued FIFO queue, here we ue a PQ, which i reorganized whenever ome d decreae) Baic idea maintain a et S of olved vertice at each tep elect "cloet" vertex u, add it to S, and relax all edge from u 3
ijktra Peudo Code Input: Graph G, tart vertex ijktra(g,) for each vertex u G.V() u.etd( ) 3 u.etparent(nil) 4.etd() S // Set S i ued to explain the algorithm 6 Q.init(G.V()) // Q i a priority queue T while not Q.iEmpty() 8 u Q.extractMin() 9 S S {u} for each v u.adjacent() do Relax(u, v, G) Q.modifyKey(v) relaxing edge ijktra Example ijktra(g,) for each vertex u G.V() u.etd( ) 3 u.etparent(nil) 4.etd() S 6 Q.init(G.V()) while not Q.iEmpty() 8 u Q.extractMin() 9 S S {u} for each v u.adjacent() do Relax(u, v, G) Q.modifyKey(v) u v 3 9 4 6 x y u v 3 9 4 6 x y 4
ijktra Example () ijktra(g,) for each vertex u G.V() u.etd( ) 3 u.etparent(nil) 4.etd() S 6 Q.init(G.V()) while not Q.iEmpty() 8 u Q.extractMin() 9 S S {u} for each v u.adjacent() do Relax(u, v, G) Q.modifyKey(v) u v 8 4 3 9 4 6 x y u v 8 3 3 9 4 6 x y ijktra Example (3) ijktra(g,) for each vertex u G.V() u.etd( ) 3 u.etparent(nil) 4.etd() S 6 Q.init(G.V()) while not Q.iEmpty() 8 u Q.extractMin() 9 S S {u} for each v u.adjacent() do Relax(u, v, G) Q.modifyKey(v) u v 8 9 3 9 4 6 x y u v 8 9 3 9 4 6 x y
ijktra Running Time Extract-Min executed V time ecreae-key executed E time Time = V T Extract-Min + E T ecreae-key T depend on different Q implementation Q T(Extract- Min) T(ecreae- Key) Total array Ο(V) Ο() Ο(V ) binary heap Ο(lg V) Ο(lg V) Ο(E lg V) Fibonacci heap Ο(lg V) Ο() (amort.) Ο(V lgv + E) Bellman-Ford lgorithm ijktra doen t work when there are negative edge: Intuition we can not be greedy any more on the aumption that the length of path will only increae in the future Bellman-Ford algorithm detect negative cycle (return fale) or return the hortet path-tree 6
Bellman-Ford lgorithm Bellman-Ford(G,) for each vertex u G.V() u.etd( ) 3 u.etparent(nil) 4.etd() for i to G.V() - do 6 for each edge (u,v) G.E() do Relax (u,v,g) 8 for each edge (u,v) G.E() do 9 if v.d() > u.d() + G.w(u,v) then return fale return true Bellman-Ford Example 6 6 t x - 8-3 -4 9 y z t x 6-4 8-3 -4 9 y z 6 6 8 8 t x 6 - -3-4 9 y z t x - 4-3 -4 9 y z
Bellman-Ford Example 6 8 t x - 4-3 -4 9 y z Bellman-Ford running time: ( V -) E + E = Θ(VE) RIP RIP = Routing Information Protocol oe not cale well, deigned for mall LN I a ditance vector protocol Very imple, eay to configure, eay to implement I mot widely ued routing protocol Read the code! http://www.quagga.net/ 6 8
RIP Hitory eveloped at Xerox PRC in early 98 Reimplemented in Berkeley UNIX 988 : Standardized in RFC 8 994 : RIP-, RFC 3 Support CIR addreing uthentication 99 : RIPng for IPv6, RFC 8 RIP Routing Table etination Next Hop Metric Net Net B Net C, Hot 3 efault Router irect Router Router 3 detination i either a network, a hot, or a gateway of lat reort The next hop i either a directly connected network or a directly connected router Meaure how many hop away i the detination 8 9
Baic RIP Protocol et. B C Metric 3 Periodically exchange lit of detination and metric with all neighboring router RIP router exchange their entire ditance vector every 3 econd et. E F Metric 9 Baic RIP Protocol (cont.) Trut your neighbor... Receive et. Metric m dd et. Nxt Hop Metric From Neighbor N Neighbor N N m + c to RIP table Replace current entry with et. Nxt Hop Metric N m + c NO Ye I et. in my RIP Table? Ye I N my next hop for et. and m + c i not the current metric? NO c in RIP table Ye I m + c le than current metric for et.?
Counting to Infinity (and beyond!) B C B B- Fail 3,B 3,, inf 3, B 3,B,_,_ C Target network 4,C,C 6,C,C,C 4,C,C 6,C,C,C 4,, 6, 6, 6,,_,_,_,_,_ From RFC 8 OSPF OSPF =Open Shortet Path Firt eveloped to addre hortcoming of RIP ha rapid, loop-free convergence doe not count to infinity Link metric between and 6,3, no limit on path metric I a link tate protocol Ha reputation for being complex Scale well efined in RFC 4 (99), 83 (994), 8 (99), 38 (998).
Link State atabae B B C ME 8 8 C 8 Each Router ha a databae repreenting the entire network that i contructed from the local knowledge at each router E 3 Building OSPF Routing Table ME B 8 8 ijktra 3 C 3 E et. Nxt Hop Metric B C E 3 3 Compute locally uing Link State atabae! 4
That Eay! Not o fat! RIP RFC 8 : 33 page OSPF RFC 38 : 44 page Much of thi complexity i related to the ynchronization of the ditributed, replicated link tate databae. Plu network modeling. itance Vector v. Link State. Hierarchical OSPF 3
Scalability: OSPF rea LS databae unique within an area rea ecentralize adminitration Reduce memory uage per router Reduce bandwidth ued by flooding rea rea rea 3... rea K Special OSPF protocol to exchange route between area. Thi i a ditance vector protocol! Link-tate v. vectoring Link tate ha fater convergence, but require more memory, CPU, and meage overhead Vectoring require few reource, but convergence can be very low. Counting to infinity can be a problem. Both protocol can induce tranient forwarding loop during convergence Thi i one of the iue addreed by Cico EIGRP. 8 4