OSPF Cost and SPF Algorithm

ospf-cost-spf-algorithm-ipcisco

In OSPF Protocol, all the topology information resides in Link-State databases. But this information cannot be used for routing in this style. Beside this information, Dijkstra Shortest Path First (SPF) algorithm is also used to calculate the routes that will be in the routing table and the routing is done according to these routes. For this calculation, OSPF Cost is used as an OSPF metric. In this lesson, we will focus on OSPF Cost Calculation and OSPF Dijkstra Shortest Path First (SPF).

 


 

OSPF Cost

OSPF Cost values are the values, that shows the feasibility of a link. So, how can we calculate an OSPF link’s cost? OSPF cost value is calculated with a formula that includes the bandwidh of the link and a reference bandwidh value.

 

This OSPF Cost Formula is given below:

 

Cost = Reference BW (default 10 000 000) / BW

 

According to the link cost that are calculated with this formula, the best routes are determined by Shortest Path Frist Algorithm. Here, all the link cost are added and the total cost of the link through the destination is determined. The way, that has the lowest cost value, is elected as best path.

 


You can also check OSPF Router ID, Authentication, Timers


 

OSPF Shortest Path First Algorithm

One of the important Routing Algorithms is Dijkstra Shortest Path First Algorithm in CCNP ENCOR Lesson. Shortest Path First is the algorithm that is used by OSPF Routing Protocol. Let’s explain the logic of shortest path first algorithm with an example. In the below example, there are three paths to go from Router A to Router F. So, which path will be added to the routing table and the traffic go through it?

 

ospf-cost-spf-algorithm-ipcisco

 

As I have mentioned before, the path that has the lowest cost will be selected as best path according to the shortest path first algorithm. For this example, if we check the total costs of all these paths, we can see that, the third path has the lowest cost. This means that, this path will be selected as best path and will be added to the routing table.

 

The first neighbor’s interface ip address will be the next hop address in the routing table. Here, the next hop interface will be Router D interface.

 


Would You Like To Learn How to Configure OSFP on Cisco Routers?


OSPF Default Cost Values

Different interfaces has different bandwidthes and their default cost values are different. You can find default cost values for different interfaces in the below OSPF default cost values table.

 

ospf-default-cost-values-ipcisco

 

Back to: CCNA 200-301 v1.1 > OSPF

Leave a Reply

Your email address will not be published. Required fields are marked *

CCNA 200-301 v1.1

Collapse
Expand
Latest Blog Posts