Configuring OSPF Route Summarization on ABR and ASBR

« 2022 June 1 »

What is OSPF route summarization?

OSPF route summarization can be configured on an Area Border Router (ABR) or an Autonomous System Boundary Router (ASBR). Route summarization works by aggregating multiple subnet prefixes into a single larger supernet prefix which is advertised to OSPF neighbors. For example, the subnets 192.168.1.0/24 and 192.168.2.0/24 can be summarized as 192.168.0.0/22. Configurations for OSPFv2 and OSPFv3 are shown in the following table.

OSPF route summarization configuration
OSPFv2 OSPFv3 for IPv4
R2>
R2>enable
R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router ospf 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 10.0.0.0 0.0.0.3 area 0
R2(config-router)#network 10.1.0.0 0.0.0.3 area 1
R2(config-router)#area 0 range 192.168.0.0 255.255.252.0  
R2(config-router)#
R2(config-router)#end
R2#
R2>
R2>enable
R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router ospfv3 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#address-family ipv4 unicast
R2(config-router-af)#area 0 range 192.168.0.0 255.255.252.0
R2(config-router-af)#
R2(config-router-af)#exit
R2(config-router)#exit
R2(config)#
R2(config)#interface Gi0/0
R2(config-if)#ospfv3 10 ipv4 area 0
R2(config-if)#exit
R2(config)#      
R2(config)#interface Gi0/1
R2(config-if)#ospfv3 10 ipv4 area 1
R2(config-if)#end
R2#

An OSPF summary route inherits the lowest cost value (best metric) which is chosen among the summarized component routes, in this example 192.168.1.0/24 and 192.168.2.0/24. However, the cost value of an OSPF summary route can also be configured. On an ABR, the example command area 0 range 192.168.0.0 255.255.252.0 cost 15 statically assigns the cost value 15 to an OSPF inter-area summary route that aggregates prefixes originated in area 0. OSPF route summarization provides the following benefits:

  • improves scalability because a smaller number of LSAs are processed in the LSDB
  • the OSPF process and SPF computation consumes less system resources of a device
  • bandwidth is conserved due to less control plane traffic

How to configure OSPF route summarization?

OSPF route summarization can be configured on an ABR (inter-area summarization) or an ASBR (external route summarization). The reason for this is that the Link State Database (LSDB) must match on all routers within the same OSPF area. Route summarization cannot be configured on an OSPF internal router which is only connected to neighbors in the same area.

Configuration on ABR

In the following example, inter-area route summarization is configured on the ABR R2. The ABR summarizes addresses in area 0, and sends the summary route 10.0.0.0/27 to R3. Once the summary address is advertised to R3, the more specific component routes are automatically suppressed.

Configuring OSPF route summarization on an ABR between two areas

Configuration:

R1
    R1#show run int Lo10 | sec int
    interface Loopback10
     ip address 10.0.0.9 255.255.255.248
     ip ospf network point-to-point
    
    R1#show run int Lo20 | sec int   
    interface Loopback20
     ip address 10.0.0.17 255.255.255.248
     ip ospf network point-to-point
     
    R1#show run int Gi0/0 | sec int 
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.0.0.1 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R1#show run | sec router
    router ospf 10
     router-id 1.1.1.1
     network 10.0.0.0 0.0.0.3 area 0
     network 10.0.0.8 0.0.0.7 area 0
     network 10.0.0.16 0.0.0.7 area 0
    
R2
    R2#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R1 **
     ip address 10.0.0.2 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run int Gi0/1 | sec int
    interface GigabitEthernet0/1
     description ** to R3 **
     ip address 10.1.0.1 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run | sec router
    router ospf 10
     router-id 2.2.2.2
     area 0 range 10.0.0.0 255.255.255.224
     network 10.0.0.0 0.0.0.3 area 0
     network 10.1.0.0 0.0.0.3 area 1
    
R3
    R3#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.1.0.2 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R3#show run | sec router
    router ospf 10
     router-id 3.3.3.3
     network 10.1.0.0 0.0.0.3 area 1
    
R3#show ip route ospf | beg Ga
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O IA     10.0.0.0/27 [110/2] via 10.1.0.1, 00:15:48, GigabitEthernet0/0         « The summary route is received on R3




R3#show ip route 10.0.0.0 255.255.255.224
Routing entry for 10.0.0.0/27
  Known via "ospf 10", distance 110, metric 2, type inter area       « It is an inter area route
  Last update from 10.1.0.1 on GigabitEthernet0/0, 00:16:00 ago
  Routing Descriptor Blocks:
  * 10.1.0.1, from 2.2.2.2, 00:16:00 ago, via GigabitEthernet0/0
      Route metric is 2, traffic share count is 1




R3#show ip ospf database

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

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         215         0x80000002 0x0046AA 2
3.3.3.3         3.3.3.3         214         0x80000001 0x00E409 2

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.0        2.2.2.2         221         0x80000001 0x001A2F





R3#show ip ospf database summary 10.0.0.0

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

                Summary Net Link States (Area 1)

  LS age: 301
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.0.0.0 (summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x1A2F
  Length: 28
  Network Mask: /27
        MTID: 0         Metric: 1

The above output from R3 can be compared to the following packet capture which displays the exact same OSPF Summary-LSA on the wire. The checksum value 0x1A2F matches.

OSPF Summary_LSA packet capture

Meanwhile, on R2 the summary route is visible in the routing table (RIB). The summary route points to the Null0 interface on R2, as shown in the following output.

R2#show ip route ospf | beg Ga
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 7 subnets, 4 masks
O        10.0.0.0/27 is a summary, 00:18:25, Null0
O        10.0.0.8/29 [110/2] via 10.0.0.1, 00:18:25, GigabitEthernet0/0
O        10.0.0.16/29 [110/2] via 10.0.0.1, 00:18:25, GigabitEthernet0/0

Configuration on ASBR

In the following example scenario, external route summarization is configured on the ASBR R2. R2 is configured with BGP AS 65002 and connects via eBGP to R1. R1 is configured with AS 65001 and advertises two BGP prefixes. The ASBR summarizes these prefixes during redistribution into OSPF and as a result R3 receives only a single summary route.

Configuring OSPF route summarization on an ASBR for routes that are redistributed from eBGP into OSPF

Configuration:

R1
    R1#show run int Lo10 | sec int
    interface Loopback10
     ip address 172.16.1.1 255.255.255.0
     
    R1#show run int Lo20 | sec int
    interface Loopback20
     ip address 172.16.2.1 255.255.255.0
     
    R1#show run int Gi0/0 | sec int 
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.0.0.1 255.255.255.252
     duplex auto
     speed auto
     media-type rj45
    
    R1#show run | sec router
    router bgp 65001
     bgp router-id 1.1.1.1
     bgp log-neighbor-changes
     network 172.16.1.0 mask 255.255.255.0
     network 172.16.2.0 mask 255.255.255.0
     neighbor 10.0.0.2 remote-as 65002
    
R2
    R2#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R1 **
     ip address 10.0.0.2 255.255.255.252
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run int Gi0/1 | sec int 
    interface GigabitEthernet0/1
     description ** to R3 **
     ip address 10.1.0.1 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run | sec router
    router ospf 10
     router-id 2.2.2.2
     summary-address 172.16.0.0 255.255.252.0
     redistribute bgp 65002 subnets
     network 10.1.0.0 0.0.0.3 area 0
    router bgp 65002
     bgp router-id 2.2.2.2
     bgp log-neighbor-changes
     network 10.1.0.0 mask 255.255.255.252
     neighbor 10.0.0.1 remote-as 65001
    
R3
    R3#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.1.0.2 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R3#show run | sec router
    router ospf 10
     router-id 3.3.3.3
     network 10.1.0.0 0.0.0.3 area 0
    
R3#show ip route ospf | beg Ga
Gateway of last resort is not set

      172.16.0.0/22 is subnetted, 1 subnets
O E2     172.16.0.0 [110/1] via 10.1.0.1, 00:09:25, GigabitEthernet0/0         « R3 receives single summary route





R2#show ip route ospf |  beg Ga
Gateway of last resort is not set

      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O        172.16.0.0/22 is a summary, 00:09:39, Null0                           « R2 originates the summary route





R2#show ip route 172.16.0.0 255.255.252.0
Routing entry for 172.16.0.0/22
  Known via "ospf 10", distance 254, metric 1, type intra area
  Routing Descriptor Blocks:
  * directly connected, via Null0
      Route metric is 1, traffic share count is 1




R3#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms




R3#trace 172.16.1.1 probe 1
Type escape sequence to abort.
Tracing the route to 172.16.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 10.1.0.1 1 msec
  2 10.0.0.1 2 msec

It is important to note that configuring the summary-address command the ASBR generates an external type-2 route (E2). This summary E2 route points to the Null0 interface on the ASBR and has an Administrative Distance (AD) of 254.

Another important aspect is how to redistribute BGP routes into OSPF. By default, only eBGP routes are redistributed into OSPF. However, if the ASBR R2 had received routes from R1 through iBGP, then the command bgp redistribute-internal would need to be added under the R2 BGP router configuration mode. Adding this command enables redistributing iBGP prefixes into OSPF.

Configuration on ASBR, NSSA-only

In this example scenario, route summarization is configured on the ASBR R2 which receives prefixes via redistribution from BGP AS 65002. R2 connects with eBGP to R1 which is configured in AS 65001. R2 receives two BGP prefixes from R1, and summarizes these prefixes during redistribution into the OSPF NSSA area 1.

By configuring the command summary-address 172.16.0.0 255.255.252.0 nssa-only on R2, the summary address is only advertised within the NSSA area. As a result, R4 does not receive the summary address.

Configuring OSPF route summarization on an ASBR but limiting the advertisement of the summary address to the NSSA only

Configuration:

R1
    R1#show run int Lo10 | sec int
    interface Loopback10
     ip address 172.16.1.1 255.255.255.0
    
    R1#show run int Lo20 | sec int
    interface Loopback20
     ip address 172.16.2.1 255.255.255.0
    
    R1#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.0.0.1 255.255.255.252
     duplex auto
     speed auto
     media-type rj45
     
    R1#show run | sec router
    router bgp 65001
     bgp router-id 1.1.1.1
     bgp log-neighbor-changes
     network 172.16.1.0 mask 255.255.255.0
     network 172.16.2.0 mask 255.255.255.0
     neighbor 10.0.0.2 remote-as 65002
    
R2
    R2#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R1 **
     ip address 10.0.0.2 255.255.255.252
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run int Gi0/1 | sec int
    interface GigabitEthernet0/1
     description ** to R3 **
     ip address 10.1.0.1 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R2#show run | sec router
    router ospf 10
     router-id 2.2.2.2
     area 1 nssa
     summary-address 172.16.0.0 255.255.252.0 nssa-only
     redistribute bgp 65002 subnets
     network 10.1.0.0 0.0.0.3 area 1
    router bgp 65002
     bgp router-id 2.2.2.2
     bgp log-neighbor-changes
     network 10.1.0.0 mask 255.255.255.252
     neighbor 10.0.0.1 remote-as 65001
    
R3
    R3#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R2 **
     ip address 10.1.0.2 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
     
    R3#show run int Gi0/1 | sec int
    interface GigabitEthernet0/1
     description ** to R4 **
     ip address 10.2.0.1 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R3#show run | sec router
    router ospf 10
     router-id 3.3.3.3
     area 1 nssa
     network 10.1.0.0 0.0.0.3 area 1
     network 10.2.0.0 0.0.0.3 area 0
    
R4
    R4#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R3 **
     ip address 10.2.0.2 255.255.255.252
     ip ospf network point-to-point
     duplex auto
     speed auto
     media-type rj45
    
    R4#show run | sec router       
    router ospf 10
     router-id 4.4.4.4
     network 10.2.0.0 0.0.0.3 area 0
    
R3#show ip ospf database nssa-external 172.16.0.0

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

                Type-7 AS External Link States (Area 1)

  LS age: 959
  Options: (No TOS-capability, No Type 7/5 translation, DC, Upward)            « No Type-7/Type-5 translation on the ABR
  LS Type: AS External Link
  Link State ID: 172.16.0.0 (External Network Number )
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0xC41F
  Length: 36
  Network Mask: /22
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 1 
        Forward Address: 10.1.0.1
        External Route Tag: 0




R2#show ip route ospf | beg Ga
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O IA     10.2.0.0/30 [110/2] via 10.1.0.2, 00:19:44, GigabitEthernet0/1
      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O        172.16.0.0/22 is a summary, 00:38:42, Null0                           « R2 generates the summary route




R3#show ip route ospf | beg Ga
Gateway of last resort is not set

      172.16.0.0/22 is subnetted, 1 subnets
O N2     172.16.0.0 [110/1] via 10.1.0.1, 00:20:00, GigabitEthernet0/0         « R3 receives the summary route





R4#show ip route ospf | beg Ga
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA     10.1.0.0/30 [110/2] via 10.2.0.1, 00:15:45, GigabitEthernet0/0

As shown above, R4 does not receive the summary route. Note, if the keyword nssa-only is not configured on R2, then R4 receives the route as follows. The keyword decides whether the P-bit (Propagate-bit) is set or is not set in the Type-7 LSA.

R4#show ip route ospf | beg Ga
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA     10.1.0.0/30 [110/2] via 10.2.0.1, 00:19:00, GigabitEthernet0/0
      172.16.0.0/22 is subnetted, 1 subnets
O E2     172.16.0.0 [110/1] via 10.2.0.1, 00:00:06, GigabitEthernet0/0

Packet capture Type-7 LSA no translation (NSSA-only feature)

When the NSSA-only feature is configured on the ASBR R2, a Type-7 LSA containing the summarized prefix is advertised to R3 with the P-bit unset.

The Type-7 LSA contains Options that determine how it is handled within the OSPF domain. One such Option is the Propagate-bit, or P-bit. When the P-bit is set, it means that an ABR will advertise NSSA-routes as Type-5 LSAs into the backbone area. When the P-bit is not set, it means that an ABR does not advertise NSSA-routes beyond the NSSA area. The following packet capture shows details.

Wireshark packet capture of a Type-7 LSA with the P-bit not set