Link State Routing Stefano Vissicchio UCL Computer Science CS 335/GZ
Reminder: Intra-domain Routing Problem Shortest paths problem: What path between two vertices offers minimal sum of edge weights? Classic graph algorithms find single-source shortest paths when the entire graph is known centrally Dijkstra s Algorithm, Bellman-Ford Algorithm Typically, no central knowledge of entire graph Each router only knows its own interfaces addresses
Reminder: Distance Vector (DV) Approach Shortest paths problem: What path between two vertices offers minimal sum of edge weights? but turned into a distributed algorithm Classic graph algorithms find single-source shortest paths when the entire graph is known centrally Dijkstra s Algorithm, Bellman-Ford Algorithm Typically, no central knowledge of entire graph Each router only knows its own interfaces addresses 3
Link State (LS) Approach Shortest paths problem: What path between two vertices offers minimal sum of edge unmodified, weights? but run on every router Classic graph algorithms find single-source shortest paths when the entire graph is known centrally Dijkstra s Algorithm, Bellman-Ford Algorithm Typically, no central knowledge of entire graph Each router only knows its own interfaces addresses 4
Link State Approach: Share the Map! Dijkstra s algorithm takes a weighted graph as input it is a centralized algorithm Link State routing protocols instruct routers to collectively build a map of the whole network each router shares its local information each router stores the map in a link state database each router runs Dijkstra s algorithm locally 5
Comparison between LS and DV principles Distance Vector principle: tell everything you know to your neighbours dump routing tables to neighbours Link State principle: tell everybody what you know about your neighbourhood flood local information network-wide 6
Agenda We deepen how Link State routing protocols work. Sharing the map Finding links: Hello protocol Building the map: Flooding protocol Dealing with failures and partitions. Computing paths 3. Properties of Link State Routing 7
Routers periodically say hello Each router runs a Hello Protocol transmits a hello packet on each interface, every time period P A hello packet contains: sender ID a list of neighbours from which sender has heard hello on that interface during period D > P e.g., D=3P 8
Routers establish adjacencies Routers need to know who to share the map with they establish logical links called adjacencies used to exchange LS messages Hello messages enable adjacencies to be built between neighbouring routers the adjacency is up if each of the two routers has received a hello message with its own ID, in the last period D the adjacency is down otherwise 9
Routers spread news on their neighbourhood Goal: build a map and keep it updated whenever a link in the LS map comes up or goes down, the map should be changed To this end, information is flooded LS routers run a Flooding Protocol a router detecting a topology change sends a link state advertisement (LSA) to all its neighbours over the established adjacencies
Flooding enables to build the network map An LSA contains: ID of the advertising router a sequence number information on every local link, including router ID of the other endpoint and link metric message parameters: LS age, type, etc. Routers store received LSAs in a link-state database the LSDB keeps all the most recent LSAs routers flood new LSAs in the database
Routers flood information about adjacencies If link was not previously in database or LSA seq. no. > stored seq. no then:. store the LSA in the database. send the LSA out of all interfaces except the one it arrived on else if LSA seq. no. < stored seq. no then: send the stored LSA back to that neighbour (it s out of date) else ignore the LSA (we ve already heard it).
Agenda We deepen how Link State routing protocols work. Sharing the map Finding links: Hello protocol Building the map: Flooding protocol Dealing with failures and partitions. Computing paths 3. Properties of Link State Routing 3
LS: No bouncing after link failures LS distributes complete information on the network no ambiguity on valid paths à no bouncing When a link fails, the network map is updated flood that link is down, everyone recalculates paths A D B E C 4
LS: No count to infinity Flooding also implies no count to infinity When the network partitions, each router will end up with a map of its connected component computes paths on that sub-map A D B E C 5
Can LS always heal partitions efficiently? Consider flooding behavior when partition heals Link D-E is restored Link C-E fails nearly at the same time A D B E C 6
Some cases seem tricky D detects link (D, E) is now up, and floods LSAs to A but A and D may still think link (C, E) exists! If this is the first time link (D, E) comes up, how will A and D learn about links (B, E) and (B, C)? A D B E C 7
Periodic state refreshes are inadequate OSPF sends new LSAs every 3 mins, even for unmodified links sent often à too much overhead sent not so often à too slow A D B E C 8
Let s think about the real problem Problem: A, D do not know the state of remote links think about (B,C) Root cause: flooding news for neighbouring links is not always sufficient A D B E C 9
Routers briefly sync on new adjacencies! Solution: Routers exchange LS database summaries when they form new adjacencies upon new adjacency, routers exchange lists of (link endpoints, sequence numbers) LS databases contain much more information à summaries save bandwidth each router then requests missing or newer entries anything new is flooded to all the other neighbours
Agenda We deepen how Link State routing protocols work. Sharing the map Finding links: Hello protocol Building the map: Flooding protocol Dealing with failures and partitions. Computing paths 3. Properties of Link State Routing
Link State Database à Routing Table After flooding, routers need to transform their map into a routing table How? Single-source shortest paths algorithm Given a graph, the algorithm computes path with least cost from s to all other vertices In LS, each router views itself as source s, and all other routers as destinations
Shortest Paths: Definitions Each router is a vertex, v V Each link is an edge, e E, also written (u, v) Each link metric maps to an edge weight, w(u, v) A path is a sequence of edges Path cost is sum of edges weights 3
Shortest Paths: Definitions Data structures: π[v] is predecessor of v: π[v] is vertex before v along current shortest path from s to v d[v] is shortest path estimate: least cost found from s to v so far 4
Shortest Paths: Initialization When we start, we know little: no cost estimate for any path from s to any other vertex no predecessor of v along shortest path from s to any v ini#alize-single-source(v, s) for each vertex v V do d[v] ß π[v] ß NULL d[s] = 5
Shortest Paths Building Block: Relaxation Relaxation of an edge: Suppose we have current estimates d[u], d[v] of shortest path cost from s to u and v Does it reduce the cost of the shortest path from s to v to reach v via edge (u, v)? relax(u, v, w) if d[v] > d[u] + w(u, v): d[v] ß d[u] + w(u, v) π[v] ß u 6
Relaxation: Example Suppose d[u] = 5 d[v] = 9 w(u, v) = relax(u, v, w) computes: is d[v] > d[u] + w(u, v)? is 9 > 5 +? u v 5 9 relax(u, v) u v 5 7 Yes, so reaching v via (u, v) reduces path cost d[v] ß d[u] + w(u, v) π[v] ß u 7
Dijkstra s Algorithm: Overall Strategy. Maintain running estimates of costs of shortest paths to all vertices (initially all infinity). Keep a set S of vertices that are finished ; shortest paths to these vertices already found (initially empty) 3. Pick the unfinished vertex v with smallest shortest path cost estimate 4. Add v to set S 5. Relax all edges leaving v 6. Repeat from 3. [Note: only correct for graphs where edge weights are not negative!] 8
Dijkstra s Algorithm: Pseudocode Dijkstra(V, E, w, s) ini#alize-single-source(v, s) S ß extract-min(q): Q ß V return vertex v from Q while Q do that has minimal shortestpath estimate d[v]; u ß extract-min(q) S ß S {u} remove v from Q for each vertex v that neighbors u relax(u, v, w) 9
Dijkstra s Algorithm: Example s 5 u 3 x 9 7 4 v y 6 s 5 u 3 5 x 9 7 4 v y 6 s: source d[i]: number inside of vertex i π[b]: if (a, b) is red, then π[b] = a members of set S: blue vertices members of priority queue Q: grey vertices 3
Dijkstra s Algorithm Example (cont d) 3 5 u v y x 3 5 7 6 4 9 3 8 7 5 v y x 3 5 7 4 9 6 u 4 8 7 5 u v y x 3 5 7 4 9 6 s 9 8 7 5 v y x 3 5 7 4 9 6 u s s s 7 8 9
Dijkstra s Algorithm Example (cont d) s 5 u 8 3 5 x 9 7 4 v 9 7 y 6 s 5 u 8 3 5 x 9 7 4 v 9 7 y 6 At termination, we know shortest-path routes from s to all other routers Shortest-path tree, rooted at s 3
Dijkstra s Algorithm: Pseudocode Dijkstra(V, E, w, s) ini#alize-single-source(v, s) S ß extract-min(q): Q ß V return vertex v from Q while Q do that has minimal shortestpath estimate d[v]; u ß extract-min(q) S ß S {u} remove v from Q for each vertex v that neighbors u relax(u, v, w) 33
Dijkstra s Algorithm: Efficiency Implement Q with binary heap total cost to insert V entries into Q: O(V) Cost of all extract-min() calls is O(V log V) cost of single call: O(log N), if N items in Q V calls, since the initial size of Q is V Cost of all relax() is O(E log V) cost of single call: O(log V) each call reduces d[] value for one vertex in Q at most E calls 34
Dijkstra s Algorithm: Efficiency (cont d) Total algorithm cost: O((V + E) log V) or O(E log V) when all vertices are reachable from the source Dijsktra runs in POLYNOMIAL time! fast in practice Also, note that most networks are sparse graphs E << V à Dijkstra algorithm is almost linear 35
Agenda We deepen how Link State routing protocols work. Sharing the map Finding links: Hello protocol Building the map: Flooding protocol Dealing with failures and partitions. Computing paths 3. Properties of Link State Routing 36
Link State Routing: Properties At first glance, flooding status of all links seems costly cost reasonable for hundreds of routers vanilla LS doesn t scale indefinitely e.g., for thousands of nodes yet, scalability can be improved with hierarchy In practice, LS has won over DV LS is more commonly used, especially in large (ISP) networks, where routing is critical DV rarely used except in small networks e.g., enterprise ones 37
Performance Comparison with Distance Vector LS has more guarantees and better performance than DV no loops after flooding, provided all nodes have consistent link state databases flooding à faster convergence after topology changes However, LS is also more complex to implement than DV sequence numbers crucial to protect against stale announcements adjacencies have to be established and maintained link state database is needed 38
Disclaimer: The real world is more complex Yet, LS does not solve all problems e.g., transient loops during convergence Such problems are relevant in practice connectivity is of utmost relevance: 99.999% uptime à max downtime: 5.6 minutes / year They attracted many industrial and research efforts Loop Free Alternate (LFA) and all its variants progressive metric increment 39
Disclaimer: The real world is more complex Also, network operators face more requirements avoid congestion, enforce firewall traversal, Routers primitives and Traffic Engineering (TE) techniques enable routing on non-shortest paths Big players started to develop their own routing systems even centralized: Google B4 [3], Microsoft SWAN [3], Google BwE [5], and this seems just an interesting beginning! 4