OSPF Cost and Shortest Path First

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

 

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?


 

Back to: CCNP Enterprise 350-401 ENCOR v1.1 > OSPF

Leave a Reply

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

CCNP Enterprise 350-401 ENCOR v1.1

Collapse
Expand
Latest Blog Posts