Updated: Mar 1, 2019
The SPF algorithm only runs to find the shortest path to each node within an area. Since OSPF allows a hierarchical design, we can have more than one area in an OSPF domain (with area 0 being the backbone area). The summary LSA is essentially used to describe destinations that are outside an area but still within the OSPF AS. These LSAs are originated by the ABR (which sits between two connecting areas, with one or more legs in each area).
Consider R1 in this case. It knows about every other node/router in area 0, however that is where its eyesight ends. It has no knowledge of what lies beyond with the help of type-1 and type-2 LSAs. This is just how OSPF was implemented - every router only knows about every other router in the same area and runs the SPF algorithm to determine the shortest path to each router. There are various reasons for this – to reduce the amount of flooding in an area, to reduce the time taken for SPF to run (which will naturally increase with more routers in an area), to reduce the amount of memory consumed on a router. Remember that the bigger the area, the more type-1 LSAs a router has to maintain, which means a bigger OSPF database, which means more memory is consumed.
Taking all this into account, there needed to be a way to get information outside an area into another area. This is what the summary LSA is used for. A summary LSA is flooded throughout the OSPF domain and includes all networks outside the area (but within the OSPF AS), the subnet mask for each network, the router ID of the ABR and the metric of the ABR to reach that particular network.
How does OSPF now calculate the shortest path to the networks described in a summary LSA? It uses SPF to calculate the shortest path to the ABR and adds the ABRs metric to reach the network - this gives the final metric to reach the network. Sounds a lot of like a distance vector type routing protocol calculation doesn’t it? That is because it is. And this distance vector like property of OSPF (for networks outside of a routers local area) is why the golden rule of area 0 being the transit area when traffic needs to go from one area to another area was put in place for OSPF. Because of this distance vector behavior, OSPF is susceptible to routing loops. The golden rule avoids that.
You can zoom into a type-3 LSA by using the command ‘show ip ospf database summary <network>’. Alternatively, you can use ‘show ip ospf database summary adv-router <router ID of ABR>’ to list out all the networks at once.
Let’s pick one network to understand how the final metric is obtained via an example.
R1 receives this LSA and it understands that the ABR, R3, knows about a network outside my area (area 0) and R3s metric to reach this network is 65. R1 now knows that it needs to get to R3 to get to the external network. The SPF algorithm would have already determined what is the shortest path to R3 (which, in this case, is via R2). To get to R2, the metric is 64, for R2 to get to R3 the metric is 64. Adding all of these, we get a total metric of 193 for R1 to reach 220.127.116.11/24. Let’s take a look at the RIB to confirm this:
Another simple way to determine the cost to an ABR/ASBR, use the command ‘show ip ospf border-routers’.