Monday, April 6, 2015

Configuring OSPF - area range vs summary-address

In this blogtorial we are going to take a look at the difference between area range vs summary-address command both of which can be used for OSPF summarization/filtering. Both area range and summary-address commands can also be used for OSPF route filtering. In addition, we will also discuss a few options that are available with area range and summary-address command and pitfalls to be on the lookout for.

Simple topology below and let's get started.


Difference between area range vs summary-address

The primary difference between area range and summary-address is in where the command should be applied. Area range should be applied on the ABRs when you are trying to summarize routes between OSPF areas. So area range is used to summarize Type 3 LSAs. On the other hand summary-address should be applied on the ASBRs when you are trying to summarize externally redistributed routes from another protocol domain (eigrp, bgp etc). So summary-address is used to summarize Type5/7 LSAs. One exception to this rule is when you have a NSSA area, the router that is responsible for the conversion of Type7 to Type 5 LSA can have the summary-address applied.

Area range and its options

Objective:
  • Summarize 10.10.1.0/24 and 10.10.2.0/24 from Area 1 into Area 0. 
Let's take a look on R4's RIB before we summarize the routes.

 R4#      show ip route ospf  
    10.0.0.0/32 is subnetted, 2 subnets  
 O IA   10.0.1.2 [110/3] via 14.14.14.1, 00:02:32, GigabitEthernet1.14  
 O IA   10.0.2.2 [110/3] via 14.14.14.1, 00:02:32, GigabitEthernet1.14  

Now on R1 (ABR ... between Area 1 and Area 0) let's configure the Area Range command. Remember the Area number to use here is the source of the summary and in this case it is Area 1.

 R1#sh run | sec ospf  
 router ospf 1  
  area 1 range 10.0.0.0 255.255.252.0  

 R1#sh ip route 
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
      O        10.0.0.0/22 is a summary, 02:50:24, Null0
<!!--Output Truncated--!!>

Take note of the null route that is created on R1 due to the area-range command. We will discuss this later in the Pitfall section.

Notice that only the summary route now exists. And in the database although the /32 exists their distance is set to the MAX to invalidate the route.

 R4# show ip route 10.0.0.0 255.0.0.0 longer-prefixes    
   10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks   
   O IA  10.0.0.0/22 [110/3] via 14.14.14.1, 00:02:04, GigabitEthernet1.14 

 R4# show ip ospf database summary 10.0.1.2 internal
   
       OSPF Router with ID (150.1.4.4) (Process ID 1)  
         Summary Net Link States (Area 0)  
  Changed flag set for this LSA  
  LSA prefix priority: High  
  Distance: 16777215  
  Now in min table   
  Table index: 61 min 9 sec  
  LS age: 1488  
  Options: (No TOS-capability, DC, Upward)  
  LS Type: Summary Links(Network)  
  Link State ID: 10.0.1.2 (summary Network Number)  
  Advertising Router: 150.1.2.2  
  LS Seq Number: 80000001  
  Checksum: 0x840F  
  Length: 28  
  Network Mask: /32  
     MTID: 0     Metric: 1   

 R4#sh ip ospf database summary 10.0.2.2 internal   

       OSPF Router with ID (150.1.4.4) (Process ID 1)  
         Summary Net Link States (Area 0)  
  LSA prefix priority: High  
  Distance: 16777215  
  Now in min table   
  Table index: 1 min 0 sec  
  LS age: 1795  
  Options: (No TOS-capability, DC, Upward)  
  LS Type: Summary Links(Network)  
  Link State ID: 10.0.2.2 (summary Network Number)  
  Advertising Router: 150.1.2.2  
  LS Seq Number: 80000014  
  Checksum: 0x532C  
  Length: 28  
  Network Mask: /32  
     MTID: 0     Metric: 1   

 R4#sh ip os dat summary 10.0.0.0 internal   

       OSPF Router with ID (150.1.4.4) (Process ID 1)  
         Summary Net Link States (Area 0)  
  Changed flag set for this LSA  
  LSA prefix priority: Low  
  In topology Base with MTID 0 route refcount is 1  
  Distance: 3  
  Path: 14.14.14.1, GigabitEthernet1.14, parent: 1/150.1.1.1/150.1.1.1  
  Now in min table   
  Table index: 4 min 62 sec  
  LS age: 116  
  Options: (No TOS-capability, DC, Upward)  
  LS Type: Summary Links(Network)  
  Link State ID: 10.0.0.0 (summary Network Number)  
  Advertising Router: 150.1.1.1  
  LS Seq Number: 80000001  
  Checksum: 0xABEE  
  Length: 28  
  Network Mask: /22  
     MTID: 0     Metric: 2   


Options:

advertise - This is the default
not-advertise - This is actually used for filtering routes. For example "area 1 range 10.0.1.2 255.255.255.255 not-advertise" will actually remove 10.0.1.2 from Area 0. You check out my previous blogtorial on this.
nssa-only - Advertise the route inside an NSSA only. Basically this disables Type 7 to Type 5 conversion for the prefix. Keep in mind then this command + option will need to be configured on the actual router doing the Type 7/5 conversion.

Summary-address and its options

Objective:
  • Summarize externally advertised route 192.168.1.0/24 and 192.168.2.0/24 from EIGRP into OSPF
Let's take a look before we make any changes. 

 R4#     show ip route 192.168.0.0 255.255.0.0 longer-prefixes   
 O E2 192.168.1.0/24 [110/20] via 14.14.14.1, 00:00:01, GigabitEthernet1.14  
 O E2 192.168.2.0/24 [110/20] via 14.14.14.1, 00:00:01, GigabitEthernet1.14  

Now on R1, let's configure the summary-address. This command has to be configured on the ASBR and in this case R1 since it's in both routing domains and check out the output on R4.

 R1#
  router ospf 1
  summary-address 192.168.0.0 255.255.252.0 
  
 R1# show ip route
  
    0 192.168.0.0/22 is a summary via null0

Again notice the null route created by the summary command which we will discuss in detail in the Pitfall section.

 R4#     show ip route 192.168.0.0 255.255.0.0 longer-prefixes   
 O E2 192.168.0.0/22 [110/20] via 14.14.14.1, 00:00:34, GigabitEthernet1.14  

Unlike the area range command the more specific prefixes are not even in the database.

 R4# show ip os data | in 192.168
192.168.0.0     150.1.1.1       970         0x80000001 0x00C6D9 0

Options:

no-advertise - Used to filter the routes out from redistributing. 
nssa-only - Only summarize into NSSA area and no where else.
tag - Tag the incoming routes to perhaps match in a route-map and apply some routing policy.

Pitfalls: 

As you probably noticed when we summarized the externally distributed routes, R1 created a null route in the routing table so that it can advertise the route in OSPF. This route is called a discard route. Notice that the discard route actually encompasses routes that R1 does not have a route for (192.168.0.0/24 and 192.168.3.0/24). Furthermore, let's say that R1 has the default into another domain which does have the routes for 192.168.0.0/24 and 192.168.3.0/24, traffic destined for these 2 subnets will be sent to R1 and will be blackholed (sent to null0). In order to prefer the default instead of the null we have to remove the discard route. The exact command to remove discard route is under the global OSPF process using "no discard-route".

Let's see this in action, and modify the topology slightly. Let's add a default route on R1 to point to R5 which does contain 192.168.0.1/32 and 192.168.3.1/32.


 R5#  
 !  
 interface GigabitEthernet1.15  
  encapsulation dot1Q 15  
  ip address 15.15.15.5 255.255.255.0  
 !  
 interface Loopback1  
  ip address 192.168.0.1 255.255.255.255  
 end  
 !  
 interface Loopback2  
  ip address 192.168.3.1 255.255.255.255  
 end 

 R1#sh run int gig1.15  
 interface GigabitEthernet1.15  
  encapsulation dot1Q 15  
  ip address 15.15.15.1 255.255.255.0  
 end  
 !  
 R1#sh run | in ip route  
 ip route 0.0.0.0 0.0.0.0 15.15.15.5  
 !  
 R1#ping 15.15.15.5   
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 15.15.15.5, timeout is 2 seconds:  
 !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/5 ms  
 !  
 R1#sh ip route 0.0.0.0  
 Routing entry for 0.0.0.0/0, supernet  
  Known via "static", distance 1, metric 0, candidate default path  
  Routing Descriptor Blocks:  
  * 15.15.15.5  
    Route metric is 0, traffic share count is 1  
!
 R1#ping 192.168.0.1
   Type escape sequence to abort.
   Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
   .....
   Success rate is 0 percent (0/5)
!
 R1#ping 192.168.3.1
   Type escape sequence to abort.
   Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
   .....
   Success rate is 0 percent (0/5)

As you can see we have reachability to R5 from R1 and the default is pointed towards R5, however PINGs to 192.168.0.1/32 and 192.168.3.1/32 is failing and this is because the summary 192.168.0.0/22 is pointed to null.

To get around this, we can use the command "no discard-route" under OSPF.

 R1#conf t  
 Enter configuration commands, one per line. End with CNTL/Z.  
 R1(config)#router ospf 1  
 R1(config-router)#no discard-route ?  
  external Discard route for redistributed summarised routes  
  internal Discard route for summarised internal routes  
  <cr>  
 R1(config-router)#no discard-route   
 R1(config-router)#exit  
 R1(config)#exit  
!
 R1#ping 192.168.0.1  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:  
 !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/4 ms 
! 
 R1#sh ip route | in 192  
 D   192.168.1.0/24 [90/130816] via 13.13.13.3, 14:13:48, GigabitEthernet1.13  
 D   192.168.2.0/24 [90/130816] via 13.13.13.3, 14:13:48, GigabitEthernet1.13
!  
 R1#sh ip os data external 192.168.0.0   
       OSPF Router with ID (150.1.1.1) (Process ID 1)  
         Type-5 AS External Link States  
  LS age: 491  
  Options: (No TOS-capability, DC, Upward)  
  LS Type: AS External Link  
  Link State ID: 192.168.0.0 (External Network Number )  
  Advertising Router: 150.1.1.1  
  LS Seq Number: 80000007  
  Checksum: 0xBADF  
  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  
 R1#  

"no discard-route" can be applied for internal or external summaries. Also there is no summary route in the RIB 192.168.0.0/22 via null0 on R1, however a summary 192.168.0.0/22 is being advertised into OSPF by R1.

Many more articles to come so ....

Please subscribe/comment/+1 if you like my posts as it keeps me motivated to write more and spread the knowledge.