Link State & OSPF Spring 2013 CE 151 - Advanced Networks 1 Administrativia • Static Routing lab – – • How are the labs going? – • Cruzio… I’m waiting to hear back NMO Software Development for Cisco Advanced Services… waiting for applications Expect more from campus network operations group… Next week – – • I will start upgrades of VMs today… will send e-mail w/ new password when done Opportunities – – – • Wording problems VM stability issues Link Layer lab due Wednesday, 4/24 Link-State Routing quiz Thursday, 4/25 Project proposal due Tuesday 4/30 – – – Spring 2013 Topic Draft outline What you need to investigate CE 151 - Advanced Networks 2 Routing Introduction • Remember… delivery of IP packets implemented by two processes – Forwarding – Routing • Dynamic routing process is a distributed computation – Triggered by topology changes – Processing defined by a routing protocol – Output of the computation is forwarding state • Goal of computation is convergence – After finite sequence of topology changes – Process should terminate updates to forwarding state – Forwarding state should be correct • Loop-free (after convergence vs. instantaneous) • With desired characteristics: performance, possibly conform to policy Spring 2013 3 CE 151 - Advanced Networks “Fate-sharing” Principle • “The fate-sharing model suggests that it is acceptable to lose the state information associated with an entity if, at the same time, the entity itself is lost.” Dave Clark, “Design Philosophy of the DARPA Internet Protocols”, SIGCOMM ‘88. • Benefits – Ensures the failure of any single component of an internet does not invalidate state located elsewhere in the internet – Localizing the effects of any failures – More robust system • Internet routing architecture co-locates – Forwarding state – Routing process that computes the state • Compared with virtual-circuit routing? Spring 2013 4 CE 151 - Advanced Networks Routing Protocol • A set of algorithms and messages that are used to exchange topology information and populate the forwarding table with the routing protocol’s choice of best paths. • Purpose: – Discover remote subnets – Maintain up-to-date forwarding tables – Choose the best path to destination subnets • Components of a routing protocol: – Algorithm: • Procedures for – Processing routing information – Selecting best-paths • The data structures needed for these steps. – Routing protocol messages: • Discover neighboring routers • Exchange topology information Spring 2013 5 CE 151 - Advanced Networks Classifying Routing Protocols • Function: – Intra-domain/Interior Gateway Protocol (IGP) – Inter-domain/Exterior Gateway Protocol (EGP) • Algorithm… distinguished by information exchanged: – Distance-Vector – Link-State – Path-Vector Spring 2013 6 CE 151 - Advanced Networks Functional Classification • An autonomous system (AS) or routing domain is a region of the Internet that is administered by a single entity – UCSC’s network – IBM’s corporate network – AT&T’s ISP network Ethernet Router Ethernet Autonomous System 1 Router Router • Routing inside an AS – Focus is on performance Ethernet – Popular protocols: RIP, OSPF, IS-IS – Called intra-domain or internal gateway (IGP) routing • Routing between ASs – Focus is on policy – Popular protocol: BGP – Called inter-domain or external gateway (EGP) routing Spring 2013 7 Ethernet CE 151 - Advanced Networks Router Router Ethernet Autonomous System 2 Router Ethernet How ensure correct routes? • Recall requirement for correctness of routing protocol – Loop-free – Desired path characteristics • Two strategies for ensuring correctness – Use identical algorithm for selecting paths • Share minimal topology information • Use identical path selection algorithm at all nodes • Used for IGP/Intra-domain routing • Use link-state or distance vector protocol – Use custom (private) algorithm for selecting paths • Share full path information • Use policy-specific path selection algorithm at each node • Used for EGP/Inter-domain routing • Use path-vector protocol Spring 2013 CE 151 - Advanced Networks 8 Algorithm Classification • Distance-Vector – Vectors of destination and distance sent to neighbors • – – – – • Destination in terms of a network prefix Distance in terms of a metric: hop count, delay, bandwidth Use Distributed Bellman-Ford path selection algorithm Popular protocol: Routing Information Protocol (RIP) Link-State – Flood description of your links (link state) • – – – “Tell the rest of the network about your neighbors” Links described by • • • “Tell your neighbors about the rest of the network” End-point routers of subnet in internet Cost of subnet: delay, bandwidth Use Dijkstra path selection algorithm Popular protocol: Open Shortest Path First (OSPF) Path-Vector – – – Routes advertised as full-paths Paths described by sequence of ASs Popular protocol is Border Gateway Routing Protocol (BGP) Spring 2013 9 CE 151 - Advanced Networks Destination-Based Forwarding • Internet routing uses a single path per destination • Destination-based forwarding is a restricted version of single-path • A path through a node to a destination… • …must be an extension of the path from the node to the destination. • This is coming back to haunt us… Spring 2013 CE 151 - Advanced Networks 10 Review • The Internet implements a distributed routing architecture that is triggered by topology change events. • Convergence of routing in the Internet depends on the stability of the network topology for a sufficient period of time. • The Fate-Sharing Principle – “It is acceptable to lose the state information associated with an entity if, at the same time, the entity itself is lost.” – Ensures the failure of any single component of an internet does not invalidate state located elsewhere in the internet – Localizing the effects of any failures – Results in a more robust system – Achieved in Internet by co-locating • Forwarding state • Routing process that computes the state Spring 11 2013 CE 151 - Advanced Networks Review • An Autonomous System (AS) is a region of the Internet that is administered by a single entity and follows a single routing policy. • Functional classification of routing protocols – IGP - routing inside an AS • Share minimal topology information • Use identical path selection algorithm at all nodes • Optimize performance – EGP - routing between ASs • Share full path information • Use custom path selection algorithm at each node to implement desired policies • Enforce policies Spring 12 2013 CE 151 - Advanced Networks Review • Algorithmic classification of routing protocols – Distance-vector • Send vectors of distances to destinations to neighbors • “Tell your neighbors about the rest of the network” • “Distributed computation” – Link-state • Flood description of your links to all routers • “Tell the rest of the network about your neighbors” • “Distributed database” – Path-vector • Distance-vector with full paths Spring 2013 CE 151 - Advanced Networks 13 Review • Destination-based forwarding – A path through a node to a destination… must be an extension of the path from the node to the destination – Tends concentrates traffic on a subset of the network topology. Spring 2013 CE 151 - Advanced Networks 14 Link-State Spring 2013 CE 151 - Advanced Networks 15 Routing Algorithms • Distance-Vector – Vectors of destination and distance sent to neighbors • • – Destination in terms of a network prefix – Distance in terms of a metric: hop count, delay, bandwidth – Use Distributed Bellman-Ford path selection algorithm – Popular protocol: Routing Information Protocol (RIP) Link-State – Flood description of your links (link state) • – “Tell the rest of the network about your neighbors” Links described by • • • “Tell your neighbors about the rest of the network” End-point routers of subnet in internet Cost of subnet: delay, bandwidth – Use Dijkstra path selection algorithm – Popular protocol: Open Shortest Path First (OSPF) Path-Vector – Routes advertised as full-paths – Paths described by sequence of ASs – Popular protocol is Border Gateway Routing Protocol (BGP) Spring 2013 CE 151 - Advanced Networks 16 Routing Algorithms • Distance-Vector – Vectors of destination and distance sent to neighbors • • – Destination in terms of a network prefix – Distance in terms of a metric: hop count, delay, bandwidth – Use Distributed Bellman-Ford path selection algorithm – Popular protocol: Routing Information Protocol (RIP) Link-State – Flood description of your links (link state) • – “Tell the rest of the network about your neighbors” Links described by • • • “Tell your neighbors about the rest of the network” End-point routers of subnet in internet Cost of subnet: delay, bandwidth – Use Dijkstra path selection algorithm – Popular protocol: Open Shortest Path First (OSPF) Path-Vector – Routes advertised as full-paths – Paths described by sequence of ASs – Popular protocol is Border Gateway Routing Protocol (BGP) Spring 2013 CE 151 - Advanced Networks 17 How ensure correct routes? • Recall requirement for correctness of routing protocol – Loop-free – Desired path characteristics • Two strategies for ensuring correctness – Use identical algorithm for selecting paths • • • • Share minimal topology information Use identical path selection algorithm at all nodes Used for IGP/Intra-domain routing Use link-state or distance vector protocol – Use custom (private) algorithm for selecting paths • • • • Spring 2013 Share full path information Use policy-specific path selection algorithm at each node Used for EGP/Inter-domain routing Use path-vector protocol CE 151 - Advanced Networks 18 How ensure correct routes? • Recall requirement for correctness of routing protocol – Loop-free – Desired path characteristics • Two strategies for ensuring correctness – Use identical algorithm for selecting paths • • • • Share minimal topology information Use identical path selection algorithm at all nodes Used for IGP/Intra-domain routing Use link-state or distance vector protocol – Use custom (private) algorithm for selecting paths • • • • Spring 2013 Share full path information Use policy-specific path selection algorithm at each node Used for EGP/Inter-domain routing Use path-vector protocol CE 151 - Advanced Networks 19 Link-State Protocols • Are Interior-Gateway Protocols (IGPs) • Exchange link-state information – Pair of routers connected by a subnet – Cost of subnet (hop count, delay, etc.) • Conceptually, very simple… Spring 2013 CE 151 - Advanced Networks 20 Link-State Protocols • Maintains a topology database of all the links it has heard of – Initialize with the subnets it is connected to. • Floods link-state updates describing its directly connected subnets, including any changes to these links. – “Tell the rest of the network about your neighbors” • Participates in the flooding of link-state updates from other routers. • On update of its topology database – Runs a shortest-path algorithm on the database to compute routes • Dijkstra is most efficient – Updates its forwarding table with any changes. Spring 2013 CE 151 - Advanced Networks 21 Characterizing Link State Link-State • # updates per link change? – One. • How far propagate updates? – Flooded to all nodes. • One update, global distribution. • Scaling problems due to flooding • As we’ll see next lecture, the characteristics of distance vector… – …are very different – …hint at a much better solution Spring 2013 CE 151 - Advanced Networks 22 Dijstra Shortest-Path Algorithm • Breadth-first search of paths, by increasing path cost, for best paths to all destinations. Terminate when path has been found for all destinations. • Maintain two sets – Destinations for which shortest paths have been found. • Permanently labeled destinations P • Initialize with self – Destinations for which candidate shortest paths have been found. • Temporarily labeled destinations T • Initialize with my neighbors. • Iterate – Move shortest path in T, say for destination D, to P – Add routes for D’s neighbors, that are extensions of the path to T, to T if they are shorter than the current path in T for each neighbor. The “relaxation” step. – Repeat until a route has been added to P for all destinations Spring 2013 CE 151 - Advanced Networks 23 More formally… • E is the set of edges. • wij is the weight of the link between nodes i and j. • P and T… see previous slide. • P and T entries are triples, <d, p, w>: – d is the destination – p is the predecessor – w is the link weight Spring 2013 CE 151 - Advanced Networks 24 Dijkstra… path cost B,2 C, 7 2 3 2 3 2 A,0 D, F, E, 2 2 6 1 4 G, H, B,2 C, A,0 E,4 G,5 B,2 A,0 D, F, A,0 E,4 C, E,4 A,0 H, C, E,4 D, A,0 H,8 B,2 A,0 G,5 H, C,9 E,4 G,5 C,9 E,4 D, F,6 G,5 B,2 F,6 D, F, G, B,2 H, C, G,5 Spring 2013 B,2 D, F,6 H,8 D,10 F,6 H,8 CE 151 - Advanced Networks 25 Translating to a Protocol • Dijkstra requires a “centralized” implementation – Maintain a full graph of the network, on an event-driven basis – Re-compute routes as the graph changes – Flood changes to your links • “Brute-force” protocol. – Straight-forward, easy to understand – Inefficient… lots of overhead Spring 2013 CE 151 - Advanced Networks 26 Review • Dijkstra – Iterates on “next shortest path” – Requires centralized computation • LS protocols – Is an IGP – Implements a centralized routing model – Floods link-state updates describing current state of its links • “Tell the rest of the network about your neighbors” – Use Dijkstra algorithm because it is most efficient shortest-path algorithm Spring 2013 CE 151 - Advanced Networks 27 The Challenge of Internet Routing • Independent routing computations at each router… • Need to compute paths that… – Support destination-based forwarding – Are shortest – Are loop-free • This is trickier than it looks… Spring 2013 CE 151 - Advanced Networks 28 Examples illustrating challenges of distributed routing… Spring 2013 CE 151 - Advanced Networks 29 Correct solution depends on combination of routing algorithm and algebra used for metrics. Spring 2013 CE 151 - Advanced Networks 30 OSPF Spring 2013 CE 151 - Advanced Networks 31 OSPF • OSPF = Open Shortest Path First • The most widely used routing protocol • The complexity of OSPF is significant • History: – – – – – Spring 2013 1989: RFC 1131 OSPF Version 1 1991: RFC1247 OSPF Version 2 1994: RFC 1583 OSPF Version 2 (revised) 1997: RFC 2178 OSPF Version 2 (revised) 1998: RFC 2328 OSPF Version 2 (current version) CE 151 - Advanced Networks 32 What We Cover… • Messages • Router IDs • Flooding process • Metrics • Designated routers • Areas Spring 2013 CE 151 - Advanced Networks 33 OSPF Messages • An OSPF message can contain one of five packet types. • OSPF is embedded directly in an IP frame (doesn’t use UDP) – Protocol field is set to 89 (OSPF) – Destination address is typically set to one of two multicast addresses: • 224.0.0.5 (“AllSPFRouters”… Hello messages) or • 224.0.0.6 (“AllDRouters”… routing info to “Designated Routers”). • If the OSPF packet is encapsulated in an Ethernet frame, the destination MAC address is also a multicast address: – 01-00-5E-00-00-05 or 01-00-5E-00-00-06 Spring 2013 CE 151 - Advanced Networks 34 OSPF Packet Types • Hello: Used to establish and maintain adjacency with other OSPF routers. • DBD: The database description (DBD) packet contains an abbreviated list of the sending router’s link-state database and is used by receiving routers to check against the local link-state database. • LSR: Receiving routers can then request more information about any entry in the DBD by sending a link-state request (LSR). • LSU: Link-state update (LSU) packets are used to reply to LSRs and to announce new information. LSUs contain seven different types of linkstate advertisements (LSA). • LSAck: When an LSU is received, the router sends a link-state acknowledgment (LSAck) to confirm receipt of the LSU. Spring 2013 CE 151 - Advanced Networks 35 OSPF Message Header OSPF Message Header 2: current version is OSPF V2 Message types: 1: Hello (tests reachability) 2: Database description 3: Link Status request 4: Link state update 5: Link state acknowledgement Standard IP checksum taken over entire packet Body of OSPF Message version message length type source router IP address Area ID authentication type checksum authentication authentication 32 bits Authentication passwd = 1: 64 cleartext password Authentication passwd = 2: 0x0000 (16 bits) KeyID (8 bits) Length of MD5 checksum (8 bits) Nondecreasing sequence number (32 bits) Spring 2013 CE 151 - Advanced Networks ID of the Area from which the packet originated 0: no authentication 1: Cleartext password 2: MD5 checksum (added to end packet) Prevents replay attacks 36 RouterIDs • Router ID Router ID plays an important role in OSPF – Uniquely identifies each router in a routing domain – Used in Designated Router election process (explained later) • Router ID is an IP address of a router • Cisco routers use following algorithm to determine Router ID Router ID – IP address configured with OSPF router-id command – If not configured, use highest IP address of a loopback interface – If no loopback interfaces, use highest active IP address of physical interface • Advantage of loopback interface is it cannot fail Spring 2013 Router ID Router ID Router ID CE 151 - Advanced Networks Router ID 37 OSPF Hello Packets • Used to – Discover OSPF neighbors and establish neighbor adjacencies – Elect the Designated Router and Backup Designated Router on multiaccess networks such as Ethernet and Frame Relay – Negotiate • Hello interval (e.g. 10 sec on Ethernet segments) • Dead interval: time to declare neighbor down (4x Hello interval) • Network type • Five network types – – – – – Spring 2013 Point-to-point Point-to-multipoint Broadcast multiaccess (Ethernet) Nonbroadcast multiaccess (Frame Relay) Virtual links CE 151 - Advanced Networks 38 OSPF LSU Packets • Link State Update (LSU) packets – Used for OSPF routing updates – Contain one or more LSAs • Link State Advertisements (LSAs) – Contain route information for destination networks – There are 11 types of LSAs Spring 2013 CE 151 - Advanced Networks 39 Link State Advertisement (LSA) 10.10.10.1 10.10.10.2 .1 • The LSA of router 10.10.10.1 is as follows: .2 10.1.1.0 / 24 .2 10 . 1. 2. 0 /2 4 10.10.10.1 = can be Router ID 10.10.10.1 = Router ID 3 = 2 links plus router itself 10.1.4.0 / 24 10.1.3.0 / 24 .1 • Link State ID: • Advertising Router: • Number of links: .2 .3 .3 .3 • Description of Link 1: Link ID = 10.1.1.1, Metric = 4 • Description of Link 2: Link ID = 10.1.2.1, Metric = 3 • Description of Link 3: Link ID = 10.10.10.1, Metric = 0 10.1.5.0/24 10.10.10.3 Each router sends its LSA to all routers in the network (using a method called reliable flooding) Spring 2013 CE 151 - Advanced Networks 40 LSA Format LSA Link Age Link State ID LSA Header LSA Header LSA Data Link Type advertising router link sequence number checksum length Link ID Link Data Link 1 Link Type #TOS metrics Metric Link ID Link Data Link 2 Link Type #TOS metrics Spring 2013 CE 151 - Advanced Networks Metric 41 OSPF Metrics • The OSPF metric is called cost. The following passage is from RFC 2328: – A cost is associated with the output side of each router interface. This cost is configurable • RFC 2328 does not specify which values should be used to determine the cost. • In Cisco IOS – – – Spring 2013 Link cost is 108 ÷ link bandwidth. Reference bandwidth (108) can be changed with auto-cost referencebandwidth Modify link bandwidth value with bandwidth CE 151 - Advanced Networks 42 Link State Database • The collection of all LSAs is called the link-state database • Each router has and identical link-state database – Useful for debugging: Each router has a complete description of the network • If neighboring routers discover each other for the first time, they will exchange their link-state databases • The link-state databases are synchronized using reliable flooding Spring 2013 CE 151 - Advanced Networks 43 Link State Database 10.10.10.2 .2 .2 .4 10.1.1.0 / 24 .4 10.1.4.0 / 24 .6 10.1.7.0 / 24 .4 .6 . 1. 4 /2 10 4 10 /2 .1 2. 0 10.1.6.0 / 24 .2 10.1.3.0 / 24 .1 Each router has a database which contains the LSAs from all other routers 10.10.10.6 .0 .1 10.10.10.4 .8 10.10.10.1 .3 .5 .3 .3 .5 .5 10.1.5.0/24 10.10.10.2 10.10.10.5 LS Type Link StateID Adv. Router Checksum LS SeqNo LS Age Router-LSA 10.1.10.1 10.1.10.1 0x9b47 0x80000006 0 Router-LSA 10.1.10.2 10.1.10.2 0x219e 0x80000007 1618 Router-LSA 10.1.10.3 10.1.10.3 0x6b53 0x80000003 1712 Router-LSA 10.1.10.4 10.1.10.4 0xe39a 0x8000003a 20 Router-LSA 10.1.10.5 10.1.10.5 0xd2a6 0x80000038 18 Router-LSA 10.1.10.6 10.1.10.6 0x05c3 0x80000005 1680 Spring 2013 CE 151 - Advanced Networks 44 Neighbor Discovery • Router multicasts OSPF Hello packets on all OSPF-enabled interfaces. • If two routers share a link, they can become neighbors, and establish an adjacency 10.1.10.1 10.1.10.2 Scenario: Router 10.1.10.2 restarts OSPF Hello OSPF Hello: I heard 10.1.10.2 • After becoming a neighbor, routers exchange their link state databases Spring 2013 CE 151 - Advanced Networks 45 Neighbor discovery and database synchronization 10.1.10.1 Discovery of adjacency Scenario: Router 10.1.10.2 restarts 10.1.10.2 OSPF Hello OSPF Hello: I heard 10.1.10.2 After neighbors are discovered the nodes exchange their databases Database Description: Sequence = X Sends database description. (description only contains LSA headers) Acknowledges receipt of description Spring 2013 Database Description: Sequence = X, 5 LSA headers = Router-LSA, 10.1.10.1, 0x80000006 Router-LSA, 10.1.10.2, 0x80000007 Router-LSA, 10.1.10.3, 0x80000003 Router-LSA, 10.1.10.4, 0x8000003a Router-LSA, 10.1.10.5, 0x80000038 Router-LSA, 10.1.10.6, 0x80000005 Database Description: Sequence = X+1, 1 LSA header= Router-LSA, 10.1.10.2, 0x80000005 Sends empty database description Database description of 10.1.10.2 Database Description: Sequence = X+1 CE 151 - Advanced Networks 46 Regular LSA exchanges 10.1.10.1 10.1.10.2 Link State Request packets, LSAs = Router-LSA, 10.1.10.1, Router-LSA, 10.1.10.2, Router-LSA, 10.1.10.3, Router-LSA, 10.1.10.4, Router-LSA, 10.1.10.5, Router-LSA, 10.1.10.6, 10.1.10.1 sends requested LSAs Link State Update Packet, LSAs = Router-LSA, 10.1.10.1, 0x80000006 Router-LSA, 10.1.10.2, 0x80000007 Router-LSA, 10.1.10.3, 0x80000003 Router-LSA, 10.1.10.4, 0x8000003a Router-LSA, 10.1.10.5, 0x80000038 Router-LSA, 10.1.10.6, 0x80000005 10.1.10.2 explicitly requests each LSA from 10.1.10.1 10.1.10.2 has more recent value for 10.0.1.6 and sends it to 10.1.10.1 (with higher sequence number) Link State Update Packet, LSA = Router-LSA, 10.1.1.6, 0x80000006 Spring 2013 CE 151 - Advanced Networks 47 Dissemination of LSA-Update • A router sends and refloods LSA-Updates, whenever the topology or link cost changes. (If a received LSA does not contain new information, the router will not flood the packet) • Exception: Infrequently (every 30 minutes), a router will flood LSAs even if there are no new changes. • Acknowledgements of LSA-updates: – explicit ACK, or – implicit via reception of an LSA-Update Spring 2013 CE 151 - Advanced Networks 48 Why Designated Routers? • Large number of adjacencies – Full mesh of adjacencies – n(n - 1)/2 adjacencies • Excessive load from flooding LSAs Spring 2013 CE 151 - Advanced Networks 49 Electing Designated Router • OSPF elects a Designated Router (DR) on multiaccess networks • DR is collection and distribution point for LSAs on network • Backup Designated Router (BDR) also elected for case where DR fails 224.0.0.5 224.0.0.6 Spring 2013 CE 151 - Advanced Networks 50 Electing Designated Router • Election held through exchange of Hello messages • DR/BDR election criteria – DR is router with highest interface priority – BDR is router with second-highest interface priority – If interface priorities are equal, use Router ID Spring 2013 CE 151 - Advanced Networks 51 Electing Designated Router • Further elections only occur on failure of DR/BDR • On DR failure – BDR promoted to DR – New BDR elected • On BDR failure – New BDR elected • Live (B)DR not replaced by election. – If DR dies • BDR replaces DR • Election held to replace BDR – If BDR dies • Election held to replace BDR Spring 2013 CE 151 - Advanced Networks 52 OSPF Areas • An OSPF Area is a set of routers that share link state information • Goal is to address scalability problem with OSPF flooding • Area 0 is the backbone area – All areas must be connected to he backbone area – Best practice to use area 0 in single-area OSPF – Eases conversion to multi-area Spring 2013 CE 151 - Advanced Networks 53 Review • OSPF message types – – – – – Hello - establish and maintain adjacency with OSPF routers DataBase Description (DBD) - summary of my database Link-State Request (LSR) - request for detailed entry Link-State Update (LSU) - response to LSR Link-State Ack (LSAck) - acknowledge receipt of LSU • Router IDs… – Uniquely identifies each router in a routing domain – Used in Designated Router election process – Best practice is to use loopback interface... it can’t fail Spring 2013 CE 151 - Advanced Networks 54 Review • OSPF metrics… – “Cost is associated with the output side of each router interface.” – In IOS is 108 / link bandwidth (inversely proportional to bandwidth) • Designated routers… – Mitigate impact of “full-mesh” on # of adjacencies in topology (n(n-1)/2) – DR is collection and distribution point for LSAs on network • OSPF deals with scaling problem by using “areas,” area 0 is the backbone. Spring 2013 CE 151 - Advanced Networks 55