ROUTING PROTOCOLS PART II ET4187/ET5187 Advanced Telecommunication Network 2 Open Shortest Path First (OSPF) 3 RFC 2328 OSPF is a link state protocol OSPF provides a number of features not found in distance vector protocols. Support for these features has made OSPF a widely-deployed routing protocol in large networking environments. In fact, RFC 1812 – Requirements for IPv4 Routers, lists OSPF as the only required dynamic routing protocol. Link State Routing Based on Dijkstra’ s Shortest-Path-First algorithm. Each router starts by knowing: Each router advertises to the entire network (flooding): Prefixes of its attached networks. Links to its neighbors. Prefixes of its directly connected networks. Active links to its neighbors. Each router learns: A complete topology of the network (routers, links). Each router computes shortest path to each destination. In a stable situation, all routers have the same graph, and compute the same paths. Link state routing: graphical illustration Global view: b 3 a a’s view: 3 a d b 6 b d’s view: c c 1 a c’s view: 2 c 6 a b’s view: 3 1 2 d c b 1 c 2 d 6 Collecting all views yield a global & complete view of the network! Operation of a Link State Routing protocol Received LSAs Link State Database Dijkstra’s Algorithm LSAs are flooded to other interfaces IP Routing Table Link State Routing: Properties Each node requires complete topology information Link state information must be flooded to all nodes Guaranteed to converge Distance Vector vs. Link State Routing With distance vector routing, each node has information only about the next hop: Node A: to reach F go to B Node B: to reach F go to D Node D: to reach F go to E Node E: go directly to F Distance vector routing makes poor routing decisions if directions are not completely correct (e.g., because a node is down). A B C D E If parts of the directions incorrect, the routing may be incorrect until the routing algorithms has re-converged. F Distance Vector vs. Link State Routing In link state routing, each node has a complete map of the topology A If a node fails, each node can calculate the new route B C D E A F A Difficulty: All nodes need to have a consistent view of the network A B C D E B C D E A F B C D E B C D E A F B C D E F F A F B C D E F Distance Vector vs. Link State Routing Link State • • • • • • Vectoring Topology information is flooded within the routing domain Best end-to-end paths are computed locally at each router. Best end-to-end paths determine next-hops. • Based on minimizing some notion of distance Works only if policy is shared and uniform Examples: OSPF, IS-IS • • • • • Each router knows little about network topology Only best next-hops are chosen by each router for each destination network. Best end-to-end paths result from composition of all nexthop choices Does not require any notion of distance Does not require uniform policies at all routers Examples: RIP, BGP Dynamic Routing Protocols Open Shortest Path First OSPF terminology 12 OSPF areas OSPF networks are divided into a collection of areas. An area consists of a logical grouping of networks and routers. The area can coincide with geographic or administrative boundaries. Each area is assigned a 32-bit area ID. 13 Subdividing the network provides the following benefits: Within an area, every router maintains an identical topology database describing the routing devices and links within the area. Areas limit the potentially explosive growth in the number of link state updates. These routers have no knowledge of topologies outside the area. They are only aware of routes to these external destinations. This reduces the size of the topology database maintained by each router. Most LSAs are distributed only within an area. Areas reduce the CPU processing required to maintain the topology database. The SPF algorithm is limited to managing changes within the area. 14 Backbone area and area 0 All OSPF networks contain at least one area, this area is known as area 0 or the backbone area Additional areas can be created based on network topology or other design requirements. In networks containing multiple areas, the backbone physically connects to all other areas. OSPF expects all areas to announce routing information directly into the backbone. The backbone then announces this information into other areas 15 16 Intra-area, area border, and AS boundary routers Intra-area routers Area border routers (ABR) This class of router is logically connected to two or more areas. One area must be the backbone area. An ABR is used to interconnect areas. They maintain a separate topology database for each attached area. ABRs also execute separate instances of the SPF algorithm for each area. AS boundary routers (ASBR) This class of router is logically located entirely within an OSPF area. Intra-area routers maintain a topology database for their local area. It is located at the periphery of an OSPF internetwork. It functions as a gateway exchanging reachability between the OSPF network and other routing environments ASBRs are responsible for announcing AS external link advertisements through the AS. Each router is assigned a 32-bit router ID (RID). The RID uniquely identifies the device. One popular implementation assigns the RID from the lowest-numbered IP address configured on the router. 17 Physical network types Point-to-point: Point-to-point networks directly link two routers. Multi-access: Multi-access networks support the attachment of more than two routers. Broadcast networks: have the capability of simultaneously directing a packet to all attached routers. Non-broadcast networks: do not have broadcasting capabilities. This capability uses an address that is recognized by all devices. Ethernet and token-ring LANs are examples of OSPF broadcast multi-access networks. Each packet must be specifically addressed to every router in the network. X.25 and frame relay networks are examples of OSPF non-broadcast multiaccess networks. Point-to-multipoint: Point-to-multipoint networks are a special case of multi-access, non-broadcast networks. In a point-to-multipoint network, a device is not required to have a direct connection to every other device. This is known as a partially meshed environment. 18 Neighbor routers and adjacencies Routers that share a common network segment establish a neighbor relationship on the segment. Routers must agree on the following information to become neighbors: Area ID: The routers must belong to the same OSPF area. Authentication: If authentication is defined, the routers must specify the same password. Hello and dead intervals: The routers must specify the same timer intervals used in the Hello protocol. Stub area flag: The routers must agree that the area is configured as a stub area. After two routers have become neighbors, an adjacency relationship can be formed between the devices. Neighboring routers are considered adjacent when they have synchronized their topology databases. This occurs through the exchange of link state information. 19 Designated and backup designated router The exchange of link state information between neighbors can create significant quantities of network traffic. To reduce the total bandwidth required to synchronize databases and advertise link state information, a router does not necessarily develop adjacencies with every neighboring device: Multi-access networks: Adjacencies are formed between an individual router and the (backup) designated router. Point-to-point networks: An adjacency is formed between both devices. 20 Designated and backup designated router (cont.) Each multi-access network elects a designated router (DR) and backup designated router (BDR). The DR performs two key functions on the network segment: The BDR forms the same adjacencies as the designated router. It forms adjacencies with all routers on the multi-access network. This causes the DR to become the focal point for forwarding LSAs. It generates network link advertisements listing each router connected to the multi-access network. It assumes DR functionality when the DR fails. Each router is assigned an 8-bit priority, indicating its ability to be selected as the DR or BDR. A router priority of zero indicates that the router is not eligible to be selected. The priority is configured on each interface in the router. 21 The relationship between neighbors. No adjacencies are formed between routers that are not selected to be the DR or BDR. 22 Link state database The link state database is also called the topology database. It contains the set of link state advertisements describing the OSPF network and any external connections. Each router within the area maintains an identical copy of the link state database. 23 Link state advertisements and flooding LSAs are exchanged between adjacent OSPF routers. This is done to synchronize the link state database on each device. When a router generates or modifies an LSA, it must communicate this change throughout the network. The router starts this process by forwarding the LSA to each adjacent device. Upon receipt of the LSA, these neighbors store the information in their link state database and communicate the LSA to their neighbors. This store and forward activity continues until all devices receive the update. This process is called reliable flooding. 24 Two steps taken to ensure this flooding doesn’t overloading the network with excessive quantities of LSA traffic: Each router stores the LSA for a period of time If, during that time, a new copy of the LSA arrives, the router replaces the stored version. However, if the new copy is outdated, it is discarded. To ensure reliability, each link state advertisement must be acknowledged. Multiple acknowledgements can be grouped together into a single acknowledgement packet. If an acknowledgement is not received, the original link state update packet is retransmitted. 25 Five types of information contained in link state advertisements: Router LSAs It describes the state of the router's interfaces (links) within the area. Generated by every OSPF router. The advertisements are flooded throughout the area. Network LSAs It lists the routers connected to a multi-access network. Generated by the DR on a multi-access segment. The advertisements are flooded throughout the area. 26 Summary LSAs (Type-3 and Type-4) It generated by an ABR. Two types of summary link advertisements: Type-3 summary LSAs describe routes to destinations in other areas within the OSPF network (inter-area destinations). Type-4 summary LSAs describe routes to ASBRs. Summary LSAs are used to exchange reachability information between areas. Normally, information is announced into the backbone area. The backbone then injects this information into other areas. AS external LSAs It describes routes to destinations external to the OSPF network. They are generated by an ASBR. The advertisements are flooded throughout all areas in the OSPF network. 27 OSPF link state advertisements Example Network 10.1.1.2 .1 4 .2 .2 3 2 • Metric is in the range [0 , 216] • Metric can be asymmetric 3 .6 1 .5 .3 5 .6 10.1.7.0 / 24 .4 .3 .3 1 .4 .2 .5 .5 10.1.5.0/24 10.1.2.3 • Link costs are called Metric .4 10.1.4.0 / 24 10.1.1.0 / 24 Router IDs can be selected independent of interface addresses, but usually chosen to be the smallest interface address 2 10.1.3.0 / 24 .1 10.1.7.6 10.1.4.4 10.1.6.0 / 24 10.1.1.1 10.1.5.5 Link State Advertisement (LSA) 10.1.1.1 10.1.1.2 10.1.1.0 / 24 3 2 .2 .2 .4 .4 .4 .3 .5 .3 .3 .5 10.1.5.5 The LSA of router 10.1.1.1 is as follows: Link State ID: 10.1.1.1 Advertising Router: Number of links: 10.1.1.1 = Router ID 3 = 2 links plus router itself Description of Link 1: Description of Link 2: Description of Link 3: Link ID = 10.1.1.2, Metric = 4 Link ID = 10.1.2.2, Metric = 3 Link ID = 10.1.1.1, Metric = 0 .6 .5 10.1.5.0/24 10.1.2.3 .6 10.1.7.0 / 24 10.1.4.0 / 24 10.1.6.0 / 24 .1 .2 10.1.3.0 / 24 4 .1 10.1.7.6 10.1.4.4 = Router ID Network and Link State Database 10.1.1.1 10.1.1.0 / 24 Each router has a database which contains the LSAs from all other routers .2 .2 .4 10.1.4.0 / 24 .4 .4 .3 .5 .3 .3 .6 10.1.7.0 / 24 10.1.6.0 / 24 .1 .2 10.1.7.6 10.1.4.4 10.1.3.0 / 24 .1 10.1.1.2 .6 .5 .5 10.1.5.0/24 10.1.5.5 10.1.2.3 LS Type Link StateID Adv. Router Checksum LS SeqNo LS Age Router-LSA 10.1.1.1 10.1.1.1 0x9b47 0x80000006 0 Router-LSA 10.1.1.2 10.1.1.2 0x219e 0x80000007 1618 Router-LSA 10.1.2.3 10.1.2.3 0x6b53 0x80000003 1712 Router-LSA 10.1.4.4 10.1.4.4 0xe39a 0x8000003a 20 Router-LSA 10.1.5.5 10.1.5.5 0xd2a6 0x80000038 18 Router-LSA 10.1.7.6 10.1.7.6 0x05c3 0x80000005 1680 OSPF Packet Format OSPF Message IP header OSPF Message Header OSPF packets are not carried as UDP payload! OSPF has its own IP protocol number: 89 TTL: set to 1 (in most cases) Body of OSPF Message Message Type Specific Data LSA LSA Header Destination IP: neighbor’s IP address or 224.0.0.5 (ALLSPFRouters) or 224.0.0.6 (AllDRouters) LSA LSA Data ... ... LSA OSPF Packet Format OSPF Message Header 2: current version is OSPF V2 version 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 Authentication passwd = 1: Authentication passwd = 2: Body of OSPF Message type message length source router IP address ID of the Area from which the packet originated Area ID checksum authentication type authentication authentication 32 bits 64 cleartext password 0x0000 (16 bits) KeyID (8 bits) Length of MD5 checksum (8 bits) Nondecreasing sequence number (32 bits) 0: no authentication 1: Cleartext password 2: MD5 checksum (added to end packet) Prevents replay attacks OSPF LSA Format LSA Link Age LSA Header LSA Header LSA Data Link Type Link State ID advertising router link sequence number checksum length Link ID Link 1 Link Data Link Type #TOS metrics Metric Link ID Link 2 Link Data Link Type #TOS metrics Metric Discovery of Neighbors Routers multicasts OSPF Hello packets on all OSPFenabled 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 Neighbor discovery and database synchronization Scenario: Router 10.1.10.2 restarts Discovery of adjacency 10.1.10.1 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 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 Database Description: Sequence = X+1 Sends empty database description Database description of 10.1.10.2 Regular LSA exchanges 10.1.10.1 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 10.1.10.2 explicitly requests each LSA from 10.1.10.1 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 not new changes. Acknowledgements of LSA-updates: explicit ACK, or implicit via reception of an LSA-Update Question: If a new node comes up, it could build the database from regular LSA-Updates (rather than exchange of database description). What role do the database description packets play?