Useful Articles

25/recent/ticker-posts

OSPF Forward Metric Concept

OSPF Forward Metric Concept

When the routes from any other IGP are redistributed into OSPF as External Type 2 (default type), the concept of OSPF Forward Metric comes into play. The OSPF Forward metric is described as an internal cost to the ASBR. If there are more than one internal paths exist in the OSPF domain for an E2 prefix, OSPF Forward Metric helps in determining the best path for that prefix.

In Order to further understand and have more clarity on what OSPF Forward Metric Concept is, let's first discuss the difference between E1 and E2 routes.

  • If external prefixes are redistributed as E1, internal OSPF metrics are added to the OSPF Seed metric (20).
  • If external prefixes are redistributed as E2(default), internal OSPF metrics are not added to the OSPF Seed metric (20).
Let us discuss the OSPF Forward Metric Concept with the help of below Lab Topology and various lab scenarios.

OSPF Forward Metric Concept
 

Scenario1 - When External prefix 9.9.0.6/32 redistributed as OSPF E1 Route


R5(config-router)#redistribute rip subnets metric-type 1

We have taken Fast-Ethernet links in the topology which has default OSPF link cost of “1”.  
 
The Shortest path from R1 to reach 9.9.0.6/32 is via R1-R2-R5. 
 i.e.  1 (R1-R2 cost) + 1 (R2-R5 cost) + 20 (OSPF default seed metric) = 22.
 
R1#show ip route 9.9.0.6
  Routing entry for 9.9.0.6/32
  Known via “ospf 1”, distance 110, metric 22, type extern 1
  Last update from 9.9.12.2 on FastEthernet0/0, 00:04:32 ago
  Routing Descriptor Blocks:
  * 9.9.12.2, from 9.9.0.5, 00:04:32 ago, via FastEthernet0/0
   Route metric is 22, traffic share count is 1

 
The cost to reach 9.9.0.6/32 through the path R1-R3-R4-R5  is  23.


Scenario2 - When External prefix 9.9.0.6/32 redistributed as OSPF E2 Route


When routes are redistributed as E2, internal OSPF costs are not added. So we can expect that cost for 9.9.0.6/32 on R1 should be the same. But this is not the case.
 
Here comes the concept of OSPF Forward Metric.

R5(config)#router ospf 1
R5(config-router)#redistribute rip subnets metric-type 2

R1#show ip route 9.9.0.6
  Routing entry for 9.9.0.6/32
  Known via “ospf 1”, distance 110, metric 20, type extern 2, forward metric 2
  Last update from 9.9.12.2 on FastEthernet0/0, 00:00:03 ago
  Routing Descriptor Blocks:
  * 9.9.12.2, from 9.9.0.5, 00:00:03 ago, via FastEthernet0/0
  Route metric is 20, traffic share count is 1

 
We can see from the above output that R1 is still taking R1-R2-R5 path to reach R6 even when prefix 9.9.0.6/32 is received on R1 with same OSPF metric 20.

This is because of the Forward metric. Again to reiterate that The OSPF Forward Metric is the cost to reach ASBR.

On R1, The forward metric to reach ASBR R5 via R2 is 2 and via R3, R4 is 3.

Therefore based on the shortest Forward metric learned for R1-R2-R5 path. R1 prefers the R1-R2-R5 path to reach 9.9.0.6/32.


Scenario3 - Load balancing the traffic for prefix 9.9.0.6/32 on R1.

Prefix 9.9.0.6/32 is redistributed as E2(default). Increase the OSPF cost for R1-R2 link to  "2"  as below.

R1(Config)# int f0/0
R1(config-if)#ip ospf cost 2


This will make the Forward Metric for both paths the R1-R2-R5 and the R1-R3-R4-R5 as 3 and we can see two paths in the routing table for 9.9.0.6 on R1.

R1#show ip route 9.9.0.6
  Routing entry for 9.9.0.6/32
  Known via “ospf 1”, distance 110, metric 20, type extern 2, forward metric 3
  Last update from 9.9.13.3 on FastEthernet0/1, 00:01:30 ago
  Routing Descriptor Blocks:
  9.9.13.3, from 9.9.0.5, 00:01:30 ago, via FastEthernet0/1
  Route metric is 20, traffic share count is 1
  * 9.9.12.2, from 9.9.0.5, 00:01:35 ago, via FastEthernet0/0
  Route metric is 20, traffic share count is 1


 

Scenario4 - Preferring the R1-R3-R4-R5 path to reach 9.9.0.6/32 (E2) from R1.


Let’s change the cost of the R1-R2 link to 5 which will make the Forward Metric for the R1-R2-R5 path as 6.

 
R1(config)#int f0/0
R1(config-if)#ip ospf cost 5


R1 will prefer the R1-R3-R4-R5 path which has a Forward Metric of 3 to reach 9.9.0.6/32.

R1#show ip route 9.9.0.6
  Routing entry for 9.9.0.6/32
  Known via “ospf 1”, distance 110, metric 20, type extern 2, forward metric 3
  Last update from 9.9.13.3 on FastEthernet0/1, 00:07:07 ago
  Routing Descriptor Blocks:
  * 9.9.13.3, from 9.9.0.5, 00:07:07 ago, via FastEthernet0/1
   Route metric is 20, traffic share count is 1

 


I hope you have found this article informative and useful and now have a fair understanding of the OSPF Forward Metric Concept. For any of the related queries or feedback, kindly write to us at networkurge@gmail.com

Click Here for other useful OSPF articles