OSPF Path Selection explained

(Lazaros Agapides) #24

Hello Sannlynntun

From my understanding, what you experienced was that once you shut down the loopback interface on R3, the next best route that showed up was the following:

R1#show ip route ospf 
     1.0.0.0/32 is subnetted, 1 subnets
O N1    1.1.1.1 [110/21] via 192.168.16.6, 00:00:13, FastEthernet0/4

Is that correct? Are you sure that the IP address and the interface are the same in your results? If not, check to see which router is being referred to in your output by checking the IP address and interface.

If however this was the result you got, then there must be an error on the configuration of R4. Check to make sure that you have implemented the following commands on R4, especially the redistribute command:

R5(config-if)#router ospf 1
R5(config-router)#router-id 55.55.55.55
R5(config-router)#network 192.168.15.0 0.0.0.255 area 0
R5(config-router)#redistribute connected subnets metric-type 2

Because the order of preference of the routes chosen by OSPF does not change, I believe you will find that there is a misconfiguration in one of your routers. Let us know how it goes!

I hope this has been helpful.

Laz

0 Likes

(Brian C) #25

Great Lesson with a very well done lab that displays very well the workings of the theory behind the lesson.

0 Likes

(Mohammad Hasanuz Zaman) #26

Hi ,
For external Type-2 and the cost is same then Another attribute called Forward Metric associated to Forwarding address will kick in .So the path Selection preference will be "Path Type>>> Native Metric>>>Forward Metric .Thx

br//zaman

0 Likes

(Mohammad Hasanuz Zaman) #27

Hi,
If the Route type is E2 then Forward Metric will kick in and for others Load Balancing happend .Thx

br//zaman

0 Likes

(Lazaros Agapides) #28

Hello Zaman

It is true that the forward metric does play a role when the redistributed metric is the same. Specifically, Cisco states in this documentation that:

In summary, when you have multiple entries for Type 5 LSA, the first preference is given to the metric (Redistributed metric). The route with the lower metric is installed in the Routing Table. The second preference is given to the Forward Metric, if the redistributed metric is same. The route with the lower Forward Metric is installed in the Routing Table.

I hope this has been helpful!

Laz

0 Likes

(Imen B) #29

Hi Rene, Hi all

I still have problems for the choice between an E1 or N1 route (same between E2 or N2)
In the drawing of this course, what would have been the result if the router injecting the E1 route had been an internal router of area 3 ? R1 would then have received :

  • an E1 route from that router, ie an inter-area external route of type E1
  • and an N1 route from area 167. But since R1 has an interface in that area, that would have been an intra-area external route

Will R1 still prefer the E1 route, an inter-area external over an intra-area external ?

Thanks a lot

Imen

0 Likes

(Rene Molenaar) #30

Hello Imen,

OSPF doesn’t make a difference between inter-area or intra-area external routes. It doesn’t matter where the external route originated, it’s the cost that makes the difference.

When I booted up this lab again, I did find something interesting. When I wrote this lesson, I used IOS 12.4 and this is the list that OSPF uses for path selection:

  • Intra-Area (O)
  • Inter-Area (O IA)
  • External Type 1 (E1)
  • NSSA Type 1 (N1)
  • External Type 2 (E2)
  • NSSA Type 2 (N2)

Since Cisco IOS release 15.1(2)S, Cisco uses the path selection order from RFC 3101 which obsoletes RFC 1587. What this means is that it prefers N1 routes before E1 and N2 over E2 routes. In other words, the preferred path now is:

  • Intra-Area (O)
  • Inter-Area (O IA)
  • NSSA Type 1 (N1)
  • External Type 1 (E1)
  • NSSA Type 2 (N2)
  • External Type 2 (E2)

So if you have an N1 route and an E1 route, it doesn’t matter where those originated…OSPF will prefer the N1 route (if you run at least IOS 5.1(2)S :grin:

Hope this helps!

Rene

2 Likes

(Imen B) #31

Hi Rene
Thanks a lot for your answer :smile:
I hope they won’t get to that level of detail in the written as per version question :disappointed_relieved:
Take care :slight_smile:

0 Likes

(vadim z) #32

I apologize if this was already asked and answered, I just could not find it. So the questions is what is the criteria OSPF uses when choosing route between several equal cost and equal type paths. Thats in a single OSPF process, if one uses CISCO router, then CISCO by default set max path for OSPF to 4. But CISCO is not the only router there is and whatever is its default its CISCO default, not OSPF, strictly speaking. So how the OSPF itself then chooses the route to use? In other words, if I run max path 1 on the router (or use some router that has it as default), there should not be load balancing anymore, only one route will be used. Even if there are two (or more ) equal cost available. So which one? Whats the tie breaker in this case?

0 Likes

(Lazaros Agapides) #33

Hello Vadim

There are several indications found in Cisco documentation as well as user experiences that for two routes in the same area with the same metric when the max path is set to 1, the path that has been learned from the router with the highest router ID is the one that is chosen. However, after doing some testing I have found that it is the most stable LSA that is used, that is, the LSA that has been in the database for the longest time. This is confirmed by this Cisco support thread as well…

I hope this has been helpful!

Laz

0 Likes

(Rahul B) #34

Hi Rene,
First of all Thanks .
Please explain me the difference between E1 & E2 and N1 & N2 .

Best Regards
Rahul

0 Likes

(Lazaros Agapides) #35

Hello Rahul

E1 and E2 are two different ways of calculating an external route. An external route is one that has been introduced into OSPF from a different autonomous system. This external autonomous system could be running a different routing protocol, static routing or even another OSPF instance completely independent of the one in question.

When a route is defined as E1, it includes the cost from the ASBR to the particular router that we are looking at. An E2 route does not include this additional metric value. E1 is the default configuration for OSPF.

Take a look at the following diagram
image
R3 is an ASBR which has received an external route. If R3 is configured to view this redistributed external route as an E1 route, then as this route is propagated to R2 and R1, the cost to the originating ASBR is added to the route. So the routing tables in R2 and R1 will add the cost of each additional hop.

E2 routes, if defined as such in R3, when propagated will not have the cost of the distance to the ASBR added as they are propagated from router to router. Note here that the source of E1 and E2 routes are an ASBR.

In the case of N1 and N2 routes, the same logic applies except that the source of the routes is a router is an NSSA ASBR.

I hope this has been helpful!

Laz

0 Likes

(AZM U) #36

Hello Rene/Laz,
I am going to use the below topology for my question.

image

In this diagram, OSPF is running everywhere. Router 3 and Router 4 have loopback addresses as it is depicted in the topology. My question is regarding path manipulation in OSPF. In this scenario, Router 4 is learning 3.3.3.3 route through two different ways. However, Router 4 is installing 3.3.3.3 route with the exit interface of G 0/2 as the best path (note: all the interfaces are Gig interface).

Question 1:
Is there any way to view the cost of the backup route for 3.3.3.3 in OSPF like it can be done in EIGRP topology table?

Now let’s say we want to manipulate the routing path. In this case, if we like to use G 0/1 as the primary path on Router 4, we can simply increase the cost on G 0/2 interface.
Question 2:
Now, when Router 3 will calculate the cost for 4.4.4.4 prefix, how would it do it?
Please break it down with an example if possible.

Thank you in advance

Azm

0 Likes

(Lazaros Agapides) #37

Hello AZM

Unfortunately no. In order to know the cost of an alternate route, the SPF algorithm must be run for that route. Because OSPF by its very nature does not keep a “backup route” ready to be installed when needed (like EIGRP does), there is no way to know the cost of the next best route until the best route fails and the cost is calculated. EIGRP on the other hand has done the calculations beforehand, that’s why we have a value.

One solution, in a lab environment, is to shutdown the interface through which a particular network is routed, let the SPF algorithm run and see what result it gets for the cost of the alternate route. Now you can’t do this in a real world scenario, but what you can do is this:

Run the show ip ospf database router command to see the contents of type 1 LSAs in the area. you’ll get something like this:

Router12#show ip ospf database router

            OSPF Router with ID (200.0.0.1) (Process ID 1)

                Router Link States (Area 0)

  LS age: 83
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 200.0.0.1
  Advertising Router: 200.0.0.1
  LS Seq Number: 8000007E
  Checksum: 0xAD4A
  Length: 72
  AS Boundary Router
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 200.0.0.1
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 200.0.111.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 200.0.0.2
     (Link Data) Router Interface address: 200.0.12.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 200.0.12.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

The TOS 0 Metrics: X at the end of each section shows you the cost of that particular link. If you do this on all the routers and look at the links you are interested in, you can reconstruct the total cost for a particular path. If you require inter-area links, use the show ip ospf database summary command to see type 3 LSAs as well. It’s a bit of a chore, but it’s the only way.

There are several ways to affect the cost of a path. This can be done by adjusting the bandwidth parameter on the specified interface. This is just a label, and does not affect the actual bandwidth of that link. The bandwidth is configured in kilobits/second and is intimately related to the OSPF reference bandwidth. For more info about that, take a look at the following lesson:


Now it is also possible to adjust the OSPF cost directly by using the ip ospf cost command on the interface in question. By implementing the command ip ospf cost 12345 for example, the cost of sending a packet out that interface is set to that value. Values can range from 1 to 65535.

Keep in mind that for both the bandwidth and ospf cost commands, the cost of sending IP packets OUT of that interface is affected. This means that in order to have symmetric routing (routing in both directions following the same path), the appropriate adjustments must be made at both ends of the path. Otherwise, this may result in links being used only in one direction, which is a waste of bandwidth.

Finally, another option is to specify the OSPF cost for a particular neighbor. This can be accomplished using the following command;

Router(config-router)#neighbor 10.1.1.2 cost 5000

This will cause any packets routed to that router to have a cost of 5000. Keep in mind that this command is valid only on OSPF network types that allow neighbor command like point-to-multipoint non broadcast.

I hope this has been helpful!

Laz

0 Likes

(Rahul B) #38

Hi Rene,

Thanks for your reply .

could you please explain, why label 201 is reflecting in trace route from R1 to 3.3.3.3

0 Likes

(Lazaros Agapides) #39

Hello Rahul

You most probably intended to post this in another topic from a different lesson. Can you ask your question again in the context of the correct lesson so we can see the full extend of the issue? Thanks!

Laz

0 Likes

(Sergei K) #40

Hi, Rene!
For the CCNP route exam that I have to learn, if the theoretical question does not indicate the version of IOS ?

0 Likes

(Lazaros Agapides) #41

Hello Sergei

Generally, the questions will be asked so that you have all the information you need to answer them correctly. If such a question comes up, you will be told which IOS is being used. Most of the updated content will focus on version 15.X IOS unless it is explicitly stated, so if you do come across something like this you can assume 15.X.

I hope this has been helpful!

Laz

1 Like

(Swapnil K) #42

What is the significant difference between ospf and isis as both are link state routing protocols but it is usually said that ISIS is more scalable as compared to OSPF…Why is it said that ISIS is highly scalable as compared to OSPF??

0 Likes

(Lazaros Agapides) #43

Hello Swapnil

Both IS-IS and OSPF are link state protocols, and both use the same Dijkstra algorithm to compute the best path through the network. However, they do have a few differences in their architecture. You can read more about the differences here:


Specifically concerning scalability, IS-IS does not use as much bandwidth to function as OSPF and its algorithm is less CPU and memory intensive. As stated in the above link, “Given the same set of resources, IS-IS can support more routers in an area than OSPF.” This can be due in part to the fact that IS-IS doesn’t require a backbone area such as Area 0 like OSPF does, in the fact that IS-IS strictly functions at Layer 2, and that it has fewer extensions and optional features than OSPF.

I hope this has been helpful!

Laz

0 Likes