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

Lab1 offline

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

Lab2 offline

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

Lab3 offline

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
%d bloggers like this: