Home > Uncategorized > OSPF Forward Metric

OSPF Forward Metric

This Post will help you understand the role of OSPF Forward Metric in route selection

To make it simple , lets start with OSPF External Routing. As we all know that there are two types of metric-types associated with OSPF External Routes. Metric Type-1 (E1) and Metric Type-2 (E2).

E1 considers the cost advertised by the ASBR for the particular route plus the cost to reach the ASBR.

While E2 considers only the cost advertised by the ASBR and neglects the cost to reach the ASBR.

We will refer to the following diagram to understand the usage of forward metric in ospf

forward-metirc

Note – OSPF is enabled on Fast Ethernet Interfaces of R1, R2 and R3. And Serial Interfaces of R1, R2 and R4

– The ospf cost values are 1 for Fastethernet interfaces and 64 for serial interfaces

If we redistribute the Loopback 0 interface in OSPF at R4 . By default R3 will receive an E2 route with the cost of 20. Changing the Metric-Type to E1 the cost will be 85 ( 1+ 64 + 20 ) provided that the default bandwidth values
are used throughout the network.

As you can see from the output of show ip route 100.100.100.100 from R3 both with E1 and E2 metric-types

With Metric-Type – 1 (E1)

R3#sh ip route 100.100.100.100
Routing entry for 100.100.100.100/32
Known via “ospf 100”, distance 110, metric 85, type extern 1
Last update from 10.100.123.2 on FastEthernet1/0, 00:00:09 ago
Routing Descriptor Blocks:
10.100.123.2, from 4.4.4.4, 00:00:09 ago, via FastEthernet1/0
Route metric is 85, traffic share count is 1
* 10.100.123.1, from 4.4.4.4, 00:00:09 ago, via FastEthernet1/0
Route metric is 85, traffic share count is 1

With Metric-Type – 2 (E2)

R3#sh ip route 100.100.100.100
Routing entry for 100.100.100.100/32
Known via “ospf 100”, distance 110, metric 20, type extern 2, forward metric 65
Last update from 10.100.123.2 on FastEthernet1/0, 00:00:13 ago
Routing Descriptor Blocks:
10.100.123.2, from 4.4.4.4, 00:00:13 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1
* 10.100.123.1, from 4.4.4.4, 00:00:13 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1

R3 is doing equal cost loadbalancing in both cases.
Notice the forward metric 65 in the output above. It is only used in Metric-Type 2 (E2).
Forward Metric is actually the cost to reach the ASBR.
So it doesn’t make sense to show it the first output as Metric-Type-1 already uses it in the calculation.

Now what makes this interesting is that when we have multiple ABRs with each having different costs to the ASBR.

In case of Metric-Type-1 (E1) simply the router will choose the one with lowest commulative cost (which includes
external metric + the cost to reach the ASBR)

But when Metric-Type-2 (E2) , which is the default , is used the the results are a bit different.
Let us see how ,

First we change the cost of Interface on R2 connecting to R4 to 100.

R2(config)#interface serial 0/0
R2(config-if)#ip ospf cost 100

we now check the routing table on R3

R3#sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route

Gateway of last resort is not set

100.0.0.0/32 is subnetted, 1 subnets
O E2 100.100.100.100 [110/20] via 10.100.123.1, 00:02:36, FastEthernet1/0
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.14.0 [110/65] via 10.100.123.1, 00:02:41, FastEthernet1/0
O IA 10.0.24.0 [110/101] via 10.100.123.2, 00:02:41, FastEthernet1/0
C 10.100.123.0 is directly connected, FastEthernet1/0

As E2 only considers the external cost, we see only 20 as the cost, neglecting the cost to reach the ASBR.
But wait previously we had two exit points through R1 and R2

Why in this case we only see the route through R1.

Does the route through R2 has a higher cost … umm let us check .

We shut the Interface on R1 connecting to R4

R1(config)#interface serial 0/0
R1(config-if)#shut

and then check the routing table on R3

R3#sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route

Gateway of last resort is not set

100.0.0.0/32 is subnetted, 1 subnets
O E2 100.100.100.100 [110/20] via 10.100.123.2, 00:00:01, FastEthernet1/0
10.0.0.0/24 is subnetted, 3 subnets
O IA 10.0.14.0 [110/165] via 10.100.123.2, 00:00:01, FastEthernet1/0
O IA 10.0.24.0 [110/101] via 10.100.123.2, 00:00:01, FastEthernet1/0
C 10.100.123.0 is directly connected, FastEthernet1/0

No. It also has the same metric. Then why does we not see both in the routing table with R3 doing equal cost loadbalancing.

Let us check the route

R3#sh ip route 100.100.100.100
Routing entry for 100.100.100.100/32
Known via “ospf 100”, distance 110, metric 20, type extern 2, forward metric 101
Last update from 10.100.123.2 on FastEthernet1/0, 00:01:35 ago
Routing Descriptor Blocks:
* 10.100.123.2, from 4.4.4.4, 00:01:35 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1

Okk.. so I think you got the answer. It is the forward metric.

R3 calculates route to the destination 100.100.100.100/32 with a cost 20 through R1 and R2. But it installs only the one through R1
as it has lower forward metric. We can see that

R1(config)#interface serial 0/0
R1(config-if)#no shut

R3#sh ip route 100.100.100.100
Routing entry for 100.100.100.100/32
Known via “ospf 100”, distance 110, metric 20, type extern 2, forward metric 65
Last update from 10.100.123.1 on FastEthernet1/0, 00:00:09 ago
Routing Descriptor Blocks:
* 10.100.123.1, from 4.4.4.4, 00:00:09 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1

So what we conclude is that although the metric will be 20 ( only external metric ). But the route with lower forward metric
will be installed in the routing table. But remember this is only for Metric-Type-2 (E2)

Happy Labbing

ccie@21 ..

Advertisements
Categories: Uncategorized
  1. GB
    March 21, 2009 at 3:07 am

    Note also. The forwarding metric is only considered when the cost between 2 or more External LSAs describing the same destination are identical (i.e. if there were 2 redistribution points for network 100.100.100.100/32 say via an additional R5, R3 would select the route based on lower External LSA metric regardless of the forwarding metric).

  2. chris
    March 21, 2009 at 11:52 pm

    Thanks so much for this post!

    The forward metric behavior is something i’ve been puzzling over for several days now.

    Though I ran into it in a slightly different scenario:

    in my case, there were two ASBRs in the same area as the router which used forward metric for its decision. if the ospf intra-area cost to the ASBRs matches, the we load balance. if the intra-area cost does not match, then forward metric makes the call.

    no ABR needed.

    Thanks again!

    • Joss
      September 2, 2009 at 7:26 pm

      Is the forward metric a proprietary Cisco mechanism for selecting the best route among 2 E2 routes or is it normalized through RFC ? Does I have a chance to have this work when interconnecting a Cisco device with another supplier router ?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: