cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
35851
Views
0
Helpful
6
Replies

OSPF metric calculation ?

fran19422
Level 1
Level 1

Hello,I have some questions reagrding OSPF metric calculation.

Within network configuration I have uploaded, I have shown two routing tables, with lines indicating which router they are from.

I understand that the OSPF metric calcualtion uses the formula 100,000,000 / interface bandwidth.

However in my network, I am using fastethernet interfaces and the route table from Wellington router show my metrics are coming out at 11, 21, 31.

So they seem to be being calculated as 100,000,000 / 10,000,000 + 1 ?

Why are my interfaces being interpreted as 10,000,000 interfaces ? As they are Fast Ethernet interfaces, should they not be interpreted as 100,000,000 for the OSPF calculation ?

And where are the odd values coming from eg. metrics of 11, 21 and 31 instead of potentially being 10, 20 and 30 ?

The second part of my question concerns the 172.16.50.0 route of the Christchurch router route table which has a metric of 791.

Can someone please explain how that metric was calculated. The serial interfaces are running at 125000 (clock rate) so, 100,000,000  / 125000 = 800. However my metric is 791. How does that work out ?

Thanks kindly for any help.

1 Accepted Solution

Accepted Solutions

Peter Paluch
Cisco Employee
Cisco Employee

Hello Philip and Reza,

Please allow me to join.

Philip, the OSPF cost is indeed computed as you indicate, i.e 100 Mbps / interface bandwidth. However, the "interface bandwidth" here refers to the value of the bandwidth command and not to the actual transmission speed or clockrate. This is an important thing to mention - neither OSPF nor EIGRP take the real interface speed into account, rather, they always compute the metric using the value of the bandwidth command.

A natural question is, what default bandwidth value is used if there is no explicit bandwidth command present in the interface configuration?

Serial interfaces have a default bandwidth setting of either 128 Kbps (WIC-2A/S) or 1544 Kbps (WIC-2T). This will result in OSPF cost of either 781 or 64, respectively. On serial interfaces, the default bandwidth setting is not automatically adapted to reflect the clock rate.

Ethernet interfaces actually adapt the default bandwidth value automatically to the currently negotiated speed of the interface. The result is therefore somewhat confusing - while on Ethernet interfaces, the bandwidth and the related OSPF cost reflects the current operating speed, on Serial interfaces, it never does until the bandwidth command is configured manually.

Regarding the cost of the route from the Christchurch to the 172.16.50.0/24 via Auckland and/or Wellington: you have to sum the costs of all links from Christchurch to the destination network to get the total cost. Here, the cost of Ethernet interfaces between Christchurch and Auckland/Wellington appears to be 10 (are the interfaces running on 10Mbps?), plus the cost of the link from Auckland/Wellington to the directly connected 172.16.50.0/24 is 781 (remember, the default bandwidth for slow serial interfaces is 128 Kbps). Hence, 10+781 = 791. What's sometimes forgotten is the fact that also the cost of the final router's interface to the destination network itself has to be added to the route cost.

With regard to the route cost to the 172.16.2.0/24 and 172.16.3.0/24, these networks appear to be redistributed rather than injected into OSPF via a network command. Did you specify any starting metric? Also, did you use a manual badwidth setting on any interface in your network? The metrics as visible in your picture suggest that the Fa0/1 interface on Wellington uses an OSPF cost of 1 while the Eth2 interface on the Christchurch uses an OSPF cost of 10 which should not happen in a correctly configured network (all routers on a single link should assign it the same cost). Using the show ip ospf interface brief should be helpful here - this command nicely shows the interface costs along with other useful information.

Are you running this topology in the Packet Tracer?

Best regards,

Peter

View solution in original post

6 Replies 6

Reza Sharifi
Hall of Fame
Hall of Fame

Have a look at the configs for the interface.  There may be OSPF metric manually set or the interfaces are operating at 10Mb.

HTH

Hello, no there is no OSPF metric set automatically.

The serial interfaces are running at 125000 (clock rate) so, 100,000,000 / 125000 = 800. However my metric is 791. How does that match work out ?

Thanks fo any help.

Hi,

Can you post "sh ip ospf inter" from the routers including the once with serial interface?

Peter Paluch
Cisco Employee
Cisco Employee

Hello Philip and Reza,

Please allow me to join.

Philip, the OSPF cost is indeed computed as you indicate, i.e 100 Mbps / interface bandwidth. However, the "interface bandwidth" here refers to the value of the bandwidth command and not to the actual transmission speed or clockrate. This is an important thing to mention - neither OSPF nor EIGRP take the real interface speed into account, rather, they always compute the metric using the value of the bandwidth command.

A natural question is, what default bandwidth value is used if there is no explicit bandwidth command present in the interface configuration?

Serial interfaces have a default bandwidth setting of either 128 Kbps (WIC-2A/S) or 1544 Kbps (WIC-2T). This will result in OSPF cost of either 781 or 64, respectively. On serial interfaces, the default bandwidth setting is not automatically adapted to reflect the clock rate.

Ethernet interfaces actually adapt the default bandwidth value automatically to the currently negotiated speed of the interface. The result is therefore somewhat confusing - while on Ethernet interfaces, the bandwidth and the related OSPF cost reflects the current operating speed, on Serial interfaces, it never does until the bandwidth command is configured manually.

Regarding the cost of the route from the Christchurch to the 172.16.50.0/24 via Auckland and/or Wellington: you have to sum the costs of all links from Christchurch to the destination network to get the total cost. Here, the cost of Ethernet interfaces between Christchurch and Auckland/Wellington appears to be 10 (are the interfaces running on 10Mbps?), plus the cost of the link from Auckland/Wellington to the directly connected 172.16.50.0/24 is 781 (remember, the default bandwidth for slow serial interfaces is 128 Kbps). Hence, 10+781 = 791. What's sometimes forgotten is the fact that also the cost of the final router's interface to the destination network itself has to be added to the route cost.

With regard to the route cost to the 172.16.2.0/24 and 172.16.3.0/24, these networks appear to be redistributed rather than injected into OSPF via a network command. Did you specify any starting metric? Also, did you use a manual badwidth setting on any interface in your network? The metrics as visible in your picture suggest that the Fa0/1 interface on Wellington uses an OSPF cost of 1 while the Eth2 interface on the Christchurch uses an OSPF cost of 10 which should not happen in a correctly configured network (all routers on a single link should assign it the same cost). Using the show ip ospf interface brief should be helpful here - this command nicely shows the interface costs along with other useful information.

Are you running this topology in the Packet Tracer?

Best regards,

Peter

Joseph W. Doherty
Hall of Fame
Hall of Fame

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

Just to add a couple of points. . .

You can find (on Cisco's IOS) what OSPF is using for the interface's cost metric using the command "show ip ospf interface" (or on later IOS images, "show ip ospf interface brief".

By default, Cisco calculates OSPF cost metric by what it considers the interface's bandwidth by dividing by 100,000,000, however this default divisor can be changed by using the OSPF auto-cost reference-bandwidth

command.  (You'll generally want to change the default divisior if using links faster than 100 Mbps.)

fb_webuser
Level 6
Level 6

OSPF metric calculation uses the formula 100/Bandwith in Mbits

---

Posted by WebUser Sayon Samui from Cisco Support Community App

Review Cisco Networking products for a $25 gift card