OSPF summarization is a routing feature that networking vendors like Cisco, Juniper, Palo Alto Networks, and Huawei support. OSPF summarization help reduce the size of the routing tables and OSPF routing traffic across the OSPF routing domain. This technique can be applied to both inter-area and external routes.

What is OSPF Summarization?

OSPF summarization is a feature that is used to reduce or summarize intra-area/inter-area routes of an area or external routes redistributed by an AS Boundary Router (ASBR) into OSPF.

In the rest of this guide, we use the network diagram in Figure 1. The network consists of five routers. Two routers are in EIGRP 12 autonomous system, and four routers are included in the OSPF routing domain.

 

Figure 1 – Network topology of the routing domain used in this tutorial

Here are the initial configurations of the routers.

Router R1 Router R2 Router R3 Router R4 Router R5

Router R2 is redistributing EIGRP 12 routes into OSPF, as shown in the show ip route ospf command output below.

R3# show ip route ospf



omitted output


      10.0.0.0/8 is variably subnetted, 15 subnets, 2 masks
O E2     10.0.0.0/24 [110/20] via 10.0.123.2, 00:01:41, GigabitEthernet0/2
O E2     10.0.1.0/24 [110/20] via 10.0.123.2, 00:01:41, GigabitEthernet0/2
O E2     10.0.2.0/24 [110/20] via 10.0.123.2, 00:01:41, GigabitEthernet0/2
O E2     10.0.3.0/24 [110/20] via 10.0.123.2, 00:01:41, GigabitEthernet0/2
O E2     10.0.12.0/24 [110/20] via 10.0.123.2, 00:01:41, GigabitEthernet0/2
O        10.0.20.0/24 [110/2] via 10.0.134.4, 00:01:52, GigabitEthernet0/4
O        10.0.21.0/24 [110/2] via 10.0.134.4, 00:01:52, GigabitEthernet0/4
O        10.0.22.0/24 [110/2] via 10.0.134.4, 00:01:52, GigabitEthernet0/4
O        10.0.23.0/24 [110/2] via 10.0.134.4, 00:01:52, GigabitEthernet0/4

How Does OSPF Summarization Work for Internal and External OSPF Routes?

Before discussing how OSPF summarization work with internal and external routes, we created two aggregate routes: 10.0.20.0/22 on R3 consolidating for area 0′ subnets 10.0.20.0/24, 10.0.21.0/24, 10.0.22.0/24, and 10.0.23.0/24, and 10.0.0.0/22 on R2 to condense external networks redistributed by R2 except subnet 10.0.12.0/24.

Summarizing internal OSPF routes can be done on Area Border Routers (ABRs) only. The ABR should at least have one route matching the summary route’s IP address.

The ABR creates an aggregate address for one or more routes in a particular area and advertises the summary route, instead of the area’s routes matching it, in Type 3 LSAs to all areas connected to that ABR.

For example, router R3 creates one LSA entry for the 10.0.20.0/22 summary route in the Type 3 LSAs associated with areas 23 and 35, as illustrated in the next show ip ospf database summary command output.

R3# show ip ospf database summary 10.0.20.0

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Summary Net Link States (Area 23)

  LS age: 1441
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0xD43F
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 2 


                Summary Net Link States (Area 35)

  LS age: 1441
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0xD43F
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 2 

The ABR adds an OSPF intra-area routing table entry for the summary route with null0 as the exit interface in order to prevent possible routing loops, as you see in the routing table of R3.

R3# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 16 subnets, 4 masks
O E2     10.0.0.0/24 [110/20] via 10.0.123.2, 00:31:25, GigabitEthernet0/2
O E2     10.0.1.0/24 [110/20] via 10.0.123.2, 00:31:25, GigabitEthernet0/2
O E2     10.0.2.0/24 [110/20] via 10.0.123.2, 00:31:25, GigabitEthernet0/2
O E2     10.0.3.0/24 [110/20] via 10.0.123.2, 00:31:25, GigabitEthernet0/2
O E2     10.0.12.0/24 [110/20] via 10.0.123.2, 00:31:25, GigabitEthernet0/2
O        10.0.20.0/22 is a summary, 00:31:25, Null0
O        10.0.20.0/25 [110/2] via 10.0.134.4, 00:27:22, GigabitEthernet0/4
O        10.0.21.0/24 [110/2] via 10.0.134.4, 00:31:25, GigabitEthernet0/4
O        10.0.22.0/24 [110/2] via 10.0.134.4, 00:31:25, GigabitEthernet0/4
O        10.0.23.0/24 [110/2] via 10.0.134.4, 00:31:25, GigabitEthernet0/4

In other words, the ABR announces the summary route using the Type 3 LSA of each area the router is attached to.

The default metric advertised with the summary route is the least metric among all metrics of the routes forming the OSPF summary IP prefix.

External OSPF routes can only be condensed on ASBRs only. Unlike internal routes, external route summaries get advertised using LSAs Type 5, as illustrated in the following show ip ospf database external command output.

R2# show ip ospf database external 10.0.0.0

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-5 AS External Link States

  LS age: 2
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.0.0 (External Network Number )
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000004
  Checksum: 0x147A
  Length: 36
  Network Mask: /22
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 0

How to Calculate an OSPF Route Summary without a Calculator?

Here are the steps to calculate a summary address and subnet mask for subnets 173.16.0.0/24, 173.16.0.0/24, 173.16.0.0/24, 173.16.0.0/24, and 173.16.0.0/24.

Step 1. Determine the common bits from the left between the IP addresses of the five subnets (after converting them to binary). The common bits must be contiguous and include the first bit from the left.

Subnet IP address Binary Value
173.16.0.0 10101101 00010000 00000000 00000000
173.16.1.0 10101101 00010000 00000001 00000000
173.16.2.0 10101101 00010000 00000010 00000000
173.16.3.0 10101101 00010000 00000011 00000000
173.16.4.0 10101101 00010000 00000100 00000000

The common bits are 10101101 00010000 00000(the first 21 bits from the left).

Step 2. Complete the 21 bits with eleven 0s to obtain a 32-bit value, and then convert this value to decimal format. Thus, the summarized route is 10101101 00010000 00000000 00000000 or 173.16.0.0 in decimal format.

Step 3. Calculate the subnet mask of the summary route. The subnet masks will have the value of all 1s in the first 21 bits and the value of all 0s in the rest of the mask. It is therefore 255.255.248.0.

How to Configure OSPF Summarization on Cisco IOS?

Configuring OSPF summarization is a simple task. You can accomplish this task using either the area range or summary-address command depending on whether to summarize internal or external routes.

Internal OSPF Route Summarization

To summarize a set of OSPF routes at an ABR, use the area number range ip_prefix subnet_mask command in router configuration mode, where number is the identifier of the area containing the routes to summarize, and ip_prefix/mask pair is the summary route’s IP address/subnet mask pair. Also, OSPF allows summarizing all the area’s routes or a part of them.

Besides, the command should be issued on ABRs. Using the area range command on a router connected to one area or multiple areas not including the backbone area is useless.

The area range advertise command is identical to the area range ip_prefix subnet_mask command. Using the area range not-advertise command instructs the router to filter out the routes matched by ip_prefix and subnet_mask.

This example advertises the 10.0.20.0/22 summary route from area 0 to OSPF areas connected to router R3.

R3(config)# router ospf 1
R3(config-router)# area 0 range 10.0.20.0 255.255.252.0

To verify the summary route, we use the show ip ospf database summary command to check that router R3 generates Type 3 LSAs of the 10.0.20.0/22 route for areas 23 and 35, and the show ip route command to ensure routers in areas connected to R3 except the source area receive the summary route.

Router R3

R3# show ip ospf database summary 10.0.20.0

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Summary Net Link States (Area 23)

  LS age: 471
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000007
  Checksum: 0xC845
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 2 


                Summary Net Link States (Area 35)

  LS age: 471
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000007
  Checksum: 0xC845
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 2

Router R2

R2# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 11 subnets, 3 masks
O IA     10.0.20.0/22 [110/3] via 10.0.123.3, 00:10:41, GigabitEthernet0/3
O IA     10.0.35.0/24 [110/2] via 10.0.123.3, 00:33:31, GigabitEthernet0/3
O IA     10.0.134.0/24 [110/2] via 10.0.123.3, 00:33:31, GigabitEthernet0/3

Router R5

R5# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 10 subnets, 3 masks
O E2     10.0.0.0/24 [110/20] via 10.0.35.3, 00:34:05, GigabitEthernet0/3
O E2     10.0.1.0/24 [110/20] via 10.0.35.3, 00:34:05, GigabitEthernet0/3
O E2     10.0.2.0/24 [110/20] via 10.0.35.3, 00:34:05, GigabitEthernet0/3
O E2     10.0.3.0/24 [110/20] via 10.0.35.3, 00:34:05, GigabitEthernet0/3
O E2     10.0.12.0/24 [110/20] via 10.0.35.3, 00:34:05, GigabitEthernet0/3
O IA     10.0.20.0/22 [110/3] via 10.0.35.3, 00:11:20, GigabitEthernet0/3
O IA     10.0.123.0/24 [110/2] via 10.0.35.3, 00:34:10, GigabitEthernet0/3
O IA     10.0.134.0/24 [110/2] via 10.0.35.3, 00:34:10, GigabitEthernet0/3

By default, the cost advertised with the summary route is the least metric among all metrics of the routes forming in the OSPF summary IP prefix.

To set the metric/cost for a summary route manually, use the the area range ip_prefix subnet_mask cost metric command, where metric is a number from 0 to 16777215.

This example advertises the 10.0.20.0/22 summary route from area 0 with a metric of 10.

R3(config)# router ospf 1
R3(config-router)# area 0 range 10.0.20.0 255.255.252.0 cost 10

The following show ip ospf database summary command output states that the summary in question is getting announced with a cost of 10.

R3# show ip ospf database summary 10.0.20.0
            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Summary Net Link States (Area 23)

  LS age: 76
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000008
  Checksum: 0x17ED
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 10 


                Summary Net Link States (Area 35)

  LS age: 76
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.20.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000008
  Checksum: 0x17ED
  Length: 28
  Network Mask: /22
        MTID: 0         Metric: 10 

External OSPF Route Summarization

OSPF allows summarizing external routes whether they are redistributed into OSPF from connected routes, static routes, or a dynamic routing protocol. The ASBR injecting those routes can be configured to advertise a summary of them instead of sharing all external routes eligible for redistribution.

To advertise a summary of a set of external routes at an ASBR into OSPF, use the summary-address ip_address mask command in router configuration mode, where ip_address is the summary address and mask the summary route’s IP subnet mask. Additionally, The command does not work on ABRs.

This example configures router R2, the only ASBR in the network, to inject an aggregate address for IP prefixes 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, and 10.0.3.0/24 into OSPF.

R2(config)# router ospf 1
R2(config-router)# summary-address 10.0.0.0 255.255.252.0

The show ip ospf database external command output states that R2 created a Type 5 LSA for the summary route.

R2# show ip ospf database external 10.0.0.0

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-5 AS External Link States

  LS age: 10
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.0.0 (External Network Number )
  Advertising Router: 2.2.2.2
  LS Seq Number: 8000000E
  Checksum: 0xFF84
  Length: 36
  Network Mask: /22
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 0

Routers R3, R4, and R5 no longer have routes to IP prefixes 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, and 10.0.3.0/24. Instead, they use the OSPF summary route in order to reach those networks, as shown in the following show ip route ospf command outputs.

Router R3

R3# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 13 subnets, 3 masks
O E2     10.0.0.0/22 [110/20] via 10.0.123.2, 00:07:16, GigabitEthernet0/2
O E2     10.0.12.0/24 [110/20] via 10.0.123.2, 00:15:39, GigabitEthernet0/2
O        10.0.20.0/22 is a summary, 00:15:39, Null0
O        10.0.20.0/24 [110/2] via 10.0.134.4, 00:15:39, GigabitEthernet0/4
O        10.0.21.0/24 [110/2] via 10.0.134.4, 00:15:39, GigabitEthernet0/4
O        10.0.22.0/24 [110/2] via 10.0.134.4, 00:15:39, GigabitEthernet0/4
O        10.0.23.0/24 [110/2] via 10.0.134.4, 00:15:39, GigabitEthernet0/4

Router R4

R4# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 14 subnets, 3 masks
O E2     10.0.0.0/22 [110/20] via 10.0.134.3, 00:07:34, GigabitEthernet0/3
O E2     10.0.12.0/24 [110/20] via 10.0.134.3, 00:15:52, GigabitEthernet0/3
O IA     10.0.35.0/24 [110/2] via 10.0.134.3, 00:15:52, GigabitEthernet0/3
O IA     10.0.123.0/24 [110/2] via 10.0.134.3, 00:15:52, GigabitEthernet0/3

Router R5

R5# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks
O E2     10.0.0.0/22 [110/20] via 10.0.35.3, 00:07:42, GigabitEthernet0/3
O E2     10.0.12.0/24 [110/20] via 10.0.35.3, 00:16:01, GigabitEthernet0/3
O IA     10.0.20.0/22 [110/11] via 10.0.35.3, 00:16:01, GigabitEthernet0/3
O IA     10.0.123.0/24 [110/2] via 10.0.35.3, 00:16:01, GigabitEthernet0/3
O IA     10.0.134.0/24 [110/2] via 10.0.35.3, 00:16:01, GigabitEthernet0/3

The cost advertised with the OSPF summary route is the lowest metric of all routes with the largest subnet mask. Cisco IOS does not allow setting a cost for an aggregate address using the summary-address command. But, you set a tag by including the tag keyword.

Finally, the summary-address ip_address mask not-advertise command prevents routes that match the ip_address /mask pair.

Related Lessons to OSPF Summarization

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.