OSPF E2 route type selection
Thumbnail: logo

OSPF E2 route type selection

by

Today I was really surprised by a new particular OSPF behavior. If I receive two equal cost Type5 LSA I expect to install both into the forwarding table and so perform load balancing between them - but then I discovered this is not always the case. For instance:

PE1#<strong>show ip ospf database external 172.31.254.6
</strong>
 OSPF Router with ID (10.107.104.2) (Process ID 1)
 Type-5 AS External Link States
 LS age: 1942
 Options: (No TOS-capability, DC)
 LS Type: AS External Link
 Link State ID: 172.31.254.6 (External Network Number )
<strong> Advertising Router: 10.107.104.21</strong>
 LS Seq Number: 80003E79
 Checksum: 0xC164
 Length: 36
 Network Mask: /32
 Metric Type: 2 (Larger than any link state path)
 MTID: 0
 <strong>Metric: 20</strong>
 Forward Address: 0.0.0.0
 External Route Tag: 0

<strong> Routing Bit Set</strong> on this LSA in topology Base with MTID 0
 LS age: 951
 Options: (No TOS-capability, DC)
 LS Type: AS External Link
 Link State ID: 172.31.254.6 (External Network Number )
 <strong>Advertising Router: 10.107.104.22</strong>
 LS Seq Number: 80004BBA
 Checksum: 0x12C4
 Length: 36
 Network Mask: /32
 Metric Type: 2 (Larger than any link state path)
 MTID: 0
 <strong>Metric: 20</strong>
 Forward Address: 0.0.0.0
 External Route Tag: 0

But only one route is installed into the routing table, via 10.107.104.22 - why?

PE1#<strong>show ip route 172.31.254.6</strong>
Routing entry for 172.31.254.6/32
  Known via "ospf 1", distance 110, <strong>metric 20</strong>, type extern 2, forward metric 1
  Last update from 10.107.126.6 on GigabitEthernet0/0/0.494, 7w0d ago
  Routing Descriptor Blocks:
  * 10.107.126.6, from<strong> 10.107.104.22</strong>, 7w0d ago, via GigabitEthernet0/0/0.494
      Route metric is 20, traffic share count is 1

RFC2328 states

(d) If the new AS external path is still indistinguishable from the current paths in the N’s routing table entry, select the preferred path based on a least cost comparison. Type 1 external paths are compared by looking at the sum of the distance to the forwarding address and the advertised type 1 metric (X+Y). Type 2 external paths advertising equal type 2 metrics are compared by looking at the distance to the forwarding addresses.

So actually, even if we have E2 type we have to take into account the metric towards the advertising router, which in our case differs between the twos.

PE1#<strong>show ip route 10.107.104.21</strong>
Routing entry for 10.107.104.21/32
  Known via "ospf 1", distance 110, <strong>metric 3</strong>, type intra area
...

PE1#<strong>show ip route 10.107.104.22</strong>
Routing entry for 10.107.104.22/32
  Known via "ospf 1", distance 110, <strong>metric 2</strong>, type intra area
...

Hence 10.107.104.22 will be preferred as a better next hop due to lower cost.



© 2013-2019 Matteo Malvica. Illustrations by Sergio Kalisiak.