OSPF external E1, E2, N1, N2…Who is the winner?


This lab focuses on route selection mechanism of OSPF external routes. The complexity of OSPF selection process is due to its inherent hierarchical structure.

The following selection order should be familiar to you:

  1. intra-area (O)
  2. inter-area (IA)
  3. external routes

OSPF provides more flexibility for external routes by manipulating the following criteria:

  • Regular areas or NSSA (Not So Stubby Area)
  • type1 or type2
  • total cost, cost to ABR and cost to ASBR

The idea is to provide a lab topology in which all types of external routes are artificially available in the same time to the main router (R1). This is done by injecting an overlapping prefix 10.10.10.1/32 through different areas into the same OSPF process.

R1(made the DR) is configured not to advertise LSAs and prefixes between its interfaces.

Each lab starts with all paths available (case1), then the forwarding interface of the best elected path is shutdown (case2) to see who is the next best route. And so on until the last preferable path.

Three topologies are used to narrow down the tests:

  • The 1st lab (Mix of external routes): Compare all types of external routes
  • The 2nd lab (All E2): Compare E2 routes with the same redistribution cost, but different costs to ABR and costs to ASBR.
  • The 3rd lab (All E1): Compare E1 routes with the same total cost, but different costs to ABR and costs to ASBR.

For each lab, the following is provided:

  • Lab topology
  • The result table for studied cases
  • Verification commands
  • An offline lab (A comprehensive report of the network state during each test case)
To keep visible the general structure of the post, verifications commands, configuration listings and the gory details of router configurations are kept in compact flash boxes with selectable text.

Lab1

Lab1 topology

ospfmix

Table1: Lab1 (Mix of external routes)

Case

Route type

Route cost

Next-hop

Cost to ABR

Cost to ASBR

From ABR (LSA4)

ASBR

Redistribution Cost

1 E1 22 192.168.121.2 1 1 192.168.61.8 20
2 E1 22 192.168.121.2 1 64 192.168.62.8 20
3 N1 30 192.168.161.6 10 192.168.161.6 20
4 N1 84 192.168.162.6 64 192.168.162.6 20
5 E1 85 192.168.122.2 64 64 192.168.62.8 20
*** N2 20 192.168.163.7 1 192.168.163.7 20
6 N2 20 192.168.164.7 64 192.168.164.7 20
7 E2 83 192.168.131.3 1 62 192.168.63.9 20
8 E2 83 192.168.131.3 1 64 192.168.64.9 20
9 E2 83 192.168.132.3 64 64 192.168.64.9 20
*** During the automatic testing the link from R1 to R2 (192.168.167) was unstable, so R1 RIB didn’t take it into account. But, theoretically it should be there.

Results:

Obviously OSPF consider type1 before type2 as indicated by RFC2328 (http://www.ietf.org/rfc/rfc2328.txt)


There are four possible types of paths used to route traffic to
the destination, listed here in decreasing order of preference:
intra-area, inter-area, type 1 external or type 2 external.

Knowing that type 1 cost is equal to the total cost of the route (redistribution cost + cost inside OSPF domain), OSPF does not differentiate between external routes from regular areas and NSSA areas. The one with the lowest total cost wins (N1 and E1 in table1).

Lab1 verification commands (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfmix/cases.swf

Selection_002_12_01

 

Lab1 offline  (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfmix/offlinelabv1.swf

Selection_001_13_01

Lab2 (All E2)

Lab2 topology  ospfalle2

According to lab1 results, though the cost of type 2 route is equal to the cost of the redistribution, it looks like among routes with the same cost OSPF considers other criteria.

Let’s consider a separated lab to compare routes with the same redistribution cost but different combinations of (cost to ABR + cost to ASBR).

Table2: Lab2 (All E2)

Case

Route type

Route cost

Next-hop

Cost to ABR

Cost to ASBR

From ABR (LSA4)

Redistribution Cost

1 E2 20 192.168.163.7 1 1 20
2 E2 20 192.168.162.6 64 1 20
E2 20 192.168.131.3 1 64 20
3 E2 20 192.168.122.2 64 64 20

Results:

According to the table, even though E2 cost is equal to the cost of redistribution, among routes with the same cost, OSPF consider the total cost as the tie breaker.

E2 selection process:

  1. Redistribution cost
  2. Total cost
  3. Multiple path installed

Lab2 verification commands (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfalle2/cases.swf

Selection_002_13_01.jpg

Lab2 offline (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfalle2/offlinelabv1.swf

Selection_003_13_01

Lab3 (All E1)

Lab3 topology

top1

Table3: Lab3 (All E1)

Case

Route type

Route cost

Next-hop

Cost to ABR

Cost to ASBR

From ABR (LSA4)

Redistribution Cost

1 E1 148 192.168.163.7 1 1 146
E1 148 192.168.162.6 64 1 83
E1 148 192.168.131.3 1 64 83
E1 148 192.168.122.2 64 64 20

Results

For E1 routes, it looks like nothing counts but the total cost.

Lab3 verification commands (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfalle1/cases.swf

Selection_004_13_01

Lab3 offline (click on the link below to open the interactive flash app.)

http://hpnouri.free.fr/ospfalle1/offlinelabv1.swf

Selection_005_13_01

Conclusion

According to lab results, OSPF external route selection process works as follow:

  1. External routes type 1:
    1. Lowest total cost
    2. Multipath
  2. External routes type 2:
    1. Redistribution cost
    2. Total cost
    3. Multipath

About ajnouri
Se vi deziras sekure komuniki eksterbloge, jen mia publika (GPG) ŝlosilo: My public key for secure communication: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x41CCDE1511DF0EB8

7 Responses to OSPF external E1, E2, N1, N2…Who is the winner?

  1. Pingback: CCNA | My Raspberry Pi Links

  2. Pingback: OSPF inter-area and intra-area routing rules | CCIE, the beginning!

  3. Pingback: OSPF inter-area and intra-area routing rules | shollanet

  4. amit says:

    what will be sequence between E1,E2 and N1,N2?
    As we know E2 cost < E1 cost. I think E2 should come first in sequence. Tell me if i'm wrong

  5. wizard says:

    @amit: you are wrong. E2 cost is considered to be much greater than any E1 cost. E2>>E1.
    The selection preference is N2 with P-bit=1, E2, N2 with P-bit=0.
    Whether the E2 ASBR is known via intra-Area (LSA1) or inter Area (LSA4) means also affects the preference, as well as the RFC1583compatibility setting, (even though it is not really implemented in IOS, but it is in NX-OS)

  6. Ilya says:

    No images 😦

    • ajnouri says:

      Hi Ilya, I added link to the resources.
      These are embedded flash apps. It looks like wordpress.com doesn’t support anymore embedded flash code.

Leave a comment