# OSPF Cost - Explanation

Jul 1st, 2009

Hi,

I need to understand, if I have Two GRE Tunnels with SAME OSPF COST, which route will be preferred. Destination can be reached from both Tunnels

How does it work in the background, can someone explain.

Overall Rating: 5 (1 ratings)

## Replies

Jerry Ye Wed, 07/01/2009 - 05:51
• Cisco Employee,

Hi Ronald,

If a specification destination can be reach via these two GRE tunnels and the metrics are the same, the router will load balance traffic to this destination.

Cost value is between two adjacent routers. To calculate the metric to a specific destination from a source, you have to add all the link's costs together.

HTH,

jerry

xcz504d1114 Wed, 07/01/2009 - 12:17
• Bronze, 100 points or more

To add a little bit more to Jerry's response, cost in OSPF is calculated based on 100 Mbits.

So a Fast Ethernet port that operates at 100 Mbits will have a cost value of 1, you can verify this by issuing a "show ip ospf interface fast 0/0".

To calculate cost acrossed an entire path you would divide the link speed (in bits) by 100,000,000 (100 Mbits).

So a T1 with 1.544 Mbits would be represented as such:

100,000,000 / 1,544,000 = 64.76

You would then round up to 65, a T1 would have a cost of 65.

You perform this for every link in the path then add up the values to get your cost.

HTH,

Craig