Brad Karp UCL Computer Science

Slides:



Advertisements
Similar presentations
Single Source Shortest Paths
Advertisements

CS138A Single Source Shortest Paths Peter Schröder.
1 Graphs: Traversal Searching/Traversing a graph = visiting the vertices of a graph by following the edges in a systematic way Example: Given a highway.
1 Greedy 2 Jose Rolim University of Geneva. Algorithmique Greedy 2Jose Rolim2 Examples Greedy  Minimum Spanning Trees  Shortest Paths Dijkstra.
1 LINK STATE PROTOCOLS (contents) Disadvantages of the distance vector protocols Link state protocols Why is a link state protocol better?
Routing - I Important concepts: link state based routing, distance vector based routing.
Jim Anderson Comp 122, Fall 2003 Single-source SPs - 1 Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph.
Shortest Paths Definitions Single Source Algorithms –Bellman Ford –DAG shortest path algorithm –Dijkstra All Pairs Algorithms –Using Single Source Algorithms.
1 8-ShortestPaths Shortest Paths in a Graph Fundamental Algorithms.
1 Relates to Lab 4. This module covers link state routing and the Open Shortest Path First (OSPF) routing protocol. Dynamic Routing Protocols II OSPF.
Graph Algorithms: Shortest Path We are given a weighted, directed graph G = (V, E), with weight function w: E R mapping.
Shortest Paths Definitions Single Source Algorithms
Link-State Routing Reading: Sections 4.2 and COS 461: Computer Networks Spring 2011 Mike Freedman
Dijkstra’s Algorithm Slide Courtesy: Uwash, UT 1.
1 Shortest Path Algorithms. 2 Routing Algorithms Shortest path routing What is a shortest path? –Minimum number of hops? –Minimum distance? There is a.
1 Relates to Lab 4. This module covers link state routing and the Open Shortest Path First (OSPF) routing protocol. Dynamic Routing Protocols II OSPF.
Delivery, Forwarding and
Graphs – Shortest Path (Weighted Graph) ORD DFW SFO LAX
Jim Anderson Comp 122, Fall 2003 Single-source SPs - 1 Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Algorithm Course Dr. Aref Rashad February Algorithms Course..... Dr. Aref Rashad Part: 6 Shortest Path Algorithms.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph. Want to compute a shortest path for each possible.
The single-source shortest path problem (SSSP) input: a graph G = (V, E) with edge weights, and a specific source node s. goal: find a minimum weight (shortest)
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
4: Network Layer4b-1 OSPF (Open Shortest Path First) r “open”: publicly available r Uses Link State algorithm m LS packet dissemination m Topology map.
Spring 2000CS 4611 Routing Outline Algorithms Scalability.
Spring Routing: Part I Section 4.2 Outline Algorithms Scalability.
Network Layer (2). Review Physical layer: move bits between physically connected stations Data link layer: move frames between physically connected stations.
CS 6401 Intra-domain Routing Outline Introduction to Routing Distance Vector Algorithm.
CSE 421 Computer Networks. Network Layer 4-2 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside.
CSE 373: Data Structures and Algorithms Lecture 21: Graphs V 1.
1 Relates to Lab 4. This module covers link state routing and the Open Shortest Path First (OSPF) routing protocol. Dynamic Routing Protocols II OSPF.
CS 5565 Network Architecture and Protocols
Dynamic Routing Protocols II OSPF
Instructor Materials Chapter 5: Dynamic Routing
Single-Source Shortest Path
Link-State Routing Protocols
Dynamic Routing Protocols part2
Intra-Domain Routing Jacob Strauss September 14, 2006.
Routing: Distance Vector Algorithm
Chapter 5: Dynamic Routing
Minimum Spanning Trees
Dynamic Routing Protocols II OSPF
SINGLE-SOURCE SHORTEST PATHS
CS 3700 Networks and Distributed Systems
Link-State Routing Protocols
Graphs Chapter 11 Objectives Upon completion you will be able to:
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Announcement 2: A 2 hour midterm (open book) will be given on March (Tuesday) during the lecture time. 2018/12/4.
Page 620 Single-Source Shortest Paths
Intradomain Routing Outline Introduction to Routing
CS 640: Introduction to Computer Networks
2018/12/27 chapter25.
Advanced Algorithms Analysis and Design
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
CS 3700 Networks and Distributed Systems
Lecture 13 Algorithm Analysis
Computer Networking Lecture 10: Intra-Domain Routing
Link-State Routing Protocols
Slide Courtesy: Uwash, UT
Lecture 13 Algorithm Analysis
Advanced Algorithms Analysis and Design
CSE 373 Data Structures and Algorithms
Slide Courtesy: Uwash, UT
EE 122: Intra-domain routing: Distance Vector
Graph Algorithms: Shortest Path
Topological Sorting Minimum Spanning Trees Shortest Path
EE 122: Intra-domain routing: Link State
Presentation transcript:

Brad Karp UCL Computer Science Link State Routing Brad Karp UCL Computer Science CS 6007/GC15/GA07 12th March, 2008

Outline Link State Approach to Routing Finding Links: Hello Protocol Building a Map: Flooding Protocol Healing after Partitions: Bringing up Adjacencies Finding Routes: Dijkstra’s Shortest-Path-First Algorithm Properties of Link State Routing

Link State Approach to Routing Finding shortest paths in graph is classic theory problem Classic centralized single-source shortest paths algorithm: Dijkstra’s Algorithm requires map of entire network Link State Routing: push a copy of whole network map to every router each router learns link state database each router runs Dijkstra’s algorithm locally

Finding Links: Hello Protocol Each router configured to know its interfaces On each interface, every period P transmit a hello packet containing sender’s ID list of neighbors from which sender has heard hello during period D D > P (e.g., D = 3P) Link becomes up if have received hello containing own ID on it in last period D Link becomes down if no such hello received in last period D Screens out unidirectional links

Building a Map: Flooding Protocol Whenever node becomes up or becomes down, flood announcement to whole network two link endpoint addresses metric for link (configured by administrator) sequence number Sequence number stored in link state database; incremented on every changed announcement prevents old link states from overwriting new ones Upon receiving new link state message on interface i: if link not in database, add it, flood elsewhere if link in database, and seqno in message higher than one in database, write into database, flood elsewhere if link in database and seqno in message lower than one in database, send link state from database on interface i

Outline Link State Approach to Routing Finding Links: Hello Protocol Building a Map: Flooding Protocol Healing after Partitions: Bringing up Adjacencies Finding Routes: Dijkstra’s Shortest-Path-First Algorithm Properties of Link State Routing

Healing Network Partitions Recall example from Distance Vector routing where network partitions Consider flooding behavior when partitions heal A B 2 1 1 1 C 1 1 1 1 1 1 D 1 E 2

Healing Network Partitions (II) D detects link (D, E), floods link state to A A and D may still think link (C, E) exists! If first time link (D, E) comes up, how will A learn about links (B, E), (B, C)? Flooding to report changes only in neighboring links not always sufficient! Bringing up adjacencies: when link comes up, routers at ends exchange short summaries (link endpoints, sequence numbers) of their whole databases routers then request missing or newer entries from one another saves bandwidth; real LS database entries contain more than link endpoints, seqnos 1 A B 2 1 1 1 1 C 1 1 1 D 1 E 2

Outline Link State Approach to Routing Finding Links: Hello Protocol Building a Map: Flooding Protocol Healing after Partitions: Bringing up Adjacencies Finding Routes: Dijkstra’s Shortest-Path-First Algorithm Properties of Link State Routing

Link State Database  Routing Table After flooding each router holds map of entire network graph in memory Need to transform network map into routing table How: single-source shortest paths algorithm Router views itself as source s, 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 an edge weight, w(u, v) Series of edges is a path, whose cost is sum of edges’ weights Single-source shortest paths: seek path with least cost from s to all other vertices Data structures: [v] is predecessor of v: [v] is vertex before v along shortest path from s to v d[v] is shortest path estimate: least cost found from s to v so far Assume all edge weights nonnegative (Doesn’t make sense for a link to have negative cost…)

Shortest Paths: Initialization When we start, we know little: no estimate of cost of any path from s to any other vertex no predecessor of v along shortest path from s to any v initialize-single-source(V, s) for each vertex v  V do d[v]  infinity [v]  NULL d[s] = 0

Shortest Paths Building Block: Relaxation Suppose we have current estimates d[u], d[v] of shortest path cost from s to u and v Does it reduce cost of shortest path from s to v to reach v via (u, v)? relax(u, v, w) if d[v] > d[u] + w(u, v) then d[v]  d[u] + w(u, v) [v]  u

Relaxation: Example Suppose relax(u, v, w) computes: d[u] = 5 d[v] = 9 w(u, v) = 2 relax(u, v, w) computes: d[v] ?> d[u] + w(u, v) 9 ?> 5 + 2 Yes, so reaching v via (u, v) reduces path cost d[v] = d[u] + w(u, v) [v] = u u v 2 5 9 relax(u, v) u v 2 5 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) Repeatedly pick the unfinished vertex v with least shortest path cost estimate Add v to set S Relax all edges leaving v N.B. only correct for graphs where edge weights nonnegative!

Dijkstra’s Algorithm: Pseudocode Dijkstra(V, E, w, s) initialize-single-source(V, s) S   Q  V while Q   do u  extract-min(Q) S  S  {u} for each vertex v that neighbors u do relax(u, v, w) extract-min(Q): return vertex v in Q with minimal shortest-path estimate d[v]

Dijkstra’s Algorithm: Example u v u v 1 1   10  10 10 9 9 2 3 2 3 s 4 6 s 4 6 7 7   5  5 5 2 2 x y x y s: source d[i]: number inside of vertex i [b]: if (a, b) red, then [b] = a members of set S: blue-shaded vertices members of priority queue Q: non-shaded vertices

Dijkstra’s Algorithm Example (cont’d) u v u v 1 1 10  8 14 10 10 9 9 2 3 2 3 s 4 6 s 4 6 7 7 5  5 7 5 5 2 2 x y x y u v u v 1 1 8 9 8 13 10 10 9 9 2 3 2 6 3 6 s 4 s 4 7 7 5 7 5 7 5 5 2 2 x y x y

Dijkstra’s Algorithm Example (cont’d) u v u v 1 1 8 9 8 9 10 10 9 9 2 3 2 3 s 6 s 6 4 4 7 7 5 7 5 7 5 5 2 2 x y x y At termination, know shortest-path routes from s to all other routers Shortest-path tree, rooted at s

Dijkstra’s Algorithm: Efficiency Most networks are sparse graphs far fewer edges than O(N2) Implement Q with binary heap for N items in heap, cost of extract-min() is O(log2 N) Begin with |V| entries in Q, call extract-min() once for each Cost: O(Vlog2 V) Total cost to insert |V| entries into Q: O(V) Each call to relax() reduces d[] value for vertex in Q Cost: O(log2 V) At most |E| calls to relax() Total cost: O((V + E) log2 V), or O(E log2 V) when all vertices reachable from source

Outline Link State Approach to Routing Finding Links: Hello Protocol Building a Map: Flooding Protocol Healing after Partitions: Bringing up Adjacencies Finding Routes: Dijkstra’s Shortest-Path-First Algorithm Properties of Link State Routing

Link State Routing: Properties At first glance, flooding status of all links seems costly It is! Doesn’t scale to thousands of nodes without other tricks, namely hierarchy (more when we discuss BGP) Cost reasonable for networks of hundreds of routers In practice, for intra-domain routing, LS has won, and DV no longer used LS: after flooding, no loops in routes, provided all nodes have consistent link state databases LS: flooding offers fast convergence after topology changes LS more complex to implement than DV Sequence numbers crucial to protect against stale announcements Bringing up adjacencies Maintains both link state database and routing table