Wednesday, 24 December 2014

OSPF Prefix Suppression

Recently I came across this command "ip ospf prefix-suppression". It's a nice feature which allows the suppression of the transit link advertisement which will result in smaller RIB. 

Let's look at the below topology and see how it works.


We have R1, R2 and R3 connected with ethernet interfaces. All three routers are running OSPF process 10. I have applied the command "network 0.0.0.0 255.255.255.255 area 0" on all of them. 


We can see that R3 learns the loopback IP of R1 (1.1.1.1/32) and the link between R1 and R2 (12.12.12.0/24) via OSPF.

Let's check network LSA in R3's OSPF database





From the above output, we can see that R1 is the DR for the segment between R1 and R2. It advertises the transit network (10.1.12.0/24). 

Now Let's apply the command "ip ospf prefix-suppression" on R1's Ethernet0/0 interface.

The routing table of R3 still shows the entry for the loopback IP (1.1.1.1/32) however it has removed the prefix of the transit link (12.12.12.0/24) from the routing table.


Looking at the network LSA in the OSPF database on R3 again



After applying the command for prefix suppression, R1 is adversing it's network LSAs with /32 network mask.

If we test the connectivity from R3 to R1's Loopback, we can see that it's still working.


We have tested this for the broadcast network where DR/BDR gets selected. 

How will this work on a point-to-point link? Remember there will not be any DR/BDR for the point-to-point network type. 

To test it, let's create a new loopback on R3 with IP 3.3.3.3/32 and re-configure the link between R2 and R3 as ospf point-to-point network.



The Loopback on R3 is advertised in the OSPF process so it's visible in R1's routing table.



We can also see that the transit subnet between R2 and R3 (10.1.23.0/24) is also in the routing table.

If we check the Router LSA on R1, we can see that R3 advertise this subnet through Link Type-3.



Now let's apply the command "ip ospf prefix-suppression" on R3's interface.



Looking at R1's OSPF database again



We can see that R3 has now stopped advertising the "Type 3" entry.

Let's check R1's routing table and see if it has removed the entry for the transit subnet (10.1.23.0/24)



The prefix is still in the routing table!! Why?

It's because the same prefix is advertised by R2 in it's router LSA. Let's check R1's OSPF database 



This means that we also have to apply the command on R2's point-to-point interface.



Now on R1, we can see that R2's has also stopped advertising the link Type -3. 




As a result of that R1 doesn't have the transit subnet (10.1.23.0/24) in the routing table now.



Even though the transit links are now not advertised in OSPF, we still have end to end reachability between loopback IPs.



If we have multiple transit links in the network then this command will help us reducing the size of the routing table.

Here is the link to the official documentation from Cisco
http://www.cisco.com/c/en/us/td/docs/ios/12_4t/12_4t15/ht_osmch.html

it says

"The OSPF mechanism to exclude connected IP prefixes from LSAs allows network administrators to control what IP prefixes are installed into LSAs. This functionality is implemented for router and network LSAs in the following manner:
•For the router LSA, to exclude prefixes, the feature excludes link type 3 (stub link).
•For the network LSA, the OSPF Designated Router (DR) generates LSAs with a special /32 network mask (0xFFFFFFFF)."

The things to remember here are

i. For the network types which select DR/BDR, the command has to be applied on the DR.
ii. for the network types which do not select DR/BDR, the command has to be applied on all the routers connected with the link.



5 comments:

  1. Dear Jigar Shukla... this post was really helpful... thanks a lot for your effort... God bless you brother...

    ReplyDelete
  2. Awesome bro .. It helped me to understand a case and move further.

    ReplyDelete
  3. At the beginning, R3 learns 10.1.12.0/24 and not 12.12.12.0/24 as you have wrongly typed. Correct the statement.

    ReplyDelete