Tuesday, February 24, 2015

OSPF Cost Calculation and Configuring Bandwidth/ ip ospf cost/ reference bandwidth


By default the OSPF cost calculation is based on a reference bandwidth of 100Mbps. So, the ospf cost calculation formula as the following.

Cost(Metric) = Reference Bandwidth(kbps) / Configured Bandwidth(kbps).
OSPF Metric = 100Mbps / Configured BW
OSPF Metric = 100000kbps / Configured BW

ospf cost calculation example


You  should know the configured bandwidth for any interface using show interface command, as you see below.

Site1#sh int f0/0
FastEthernet0/0 is up, line protocol is up (connected)
  Hardware is Lance, address is 00e0.8f3b.5601 (bia 00e0.8f3b.5601)
  Internet address is 10.10.10.1/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
Site2#sh int s0/0/0
Serial0/0/0 is up, line protocol is up (connected)
  Hardware is HD64570
  Internet address is 10.10.11.1/30
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,

Based on the above show commands,
  • The default configured bandwidth for the fast Ethernet link is 100000kbps, so the metric(cost) is 100000/100000=1
  • The default configured bandwidth for the serial link is 100000kbps, so the metric(cost) is 100000/100000=1 


Looking at the above diagram, we should be able to know the metric of the path from site 1 router to site 3 network.
Metric = Cost of the serial link between site1 router and site2 router+ cost of the fast Ethernet link of site2 router
Cost(Metric) = 100000/1544+100000/100000
Cost(Metric) = 64+1
Cost(Metric) = 65

You can change the default Configured bandwidth for any interface using this command
Site1(config)#int f0/0
Site1(config-if)#bandwidth ?
  <1-10000000>  Bandwidth in kilobits


Important Notes:
  1. If you calculate the path metric from site 1 to site 2 network 10.10.12.0/24, you have to use the bandwidth value of the outbound interfaces, means the values of the s/0/0/0 of site 1 router , and , and f0/1 of site 2 router.
  2. If you calculate the path metric from site 2 to site 1 network 10.10.10.0/24, you have to use the bandwidth values of the outbound interfaces, means the values of the s0/0/0 of site 2 router, and fa0/0 of site 1 router.
So, the cost is based on the bandwidth value only, changing the bandwidth value will affect the cost, for example, if you change the bandwidth values as you see in the picture below, 




Now,

Cost(Metric) From site1 router to reach site2 network 10.10.12.0/24

Metric=10^8bps/BW in bps
Metric=100000kbps/Bw in kbps+100000/BW in kbps
Metric=100000kbps/800+100000/1200=125+83
Metric=208

Cost(Metric) From site2 router to reach site2 network 10.10.10.0/24

Metric=10^8bps/BW in bps
Metric=100000kbps/Bw in kbps+100000/BW in kbps
Metric=100000/700+100000/900=142+111
Metric=253

Site1#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.10.10.0/24 is directly connected, FastEthernet0/0
C       10.10.11.0/30 is directly connected, Serial0/0/0
O       10.10.12.0/24 [110/208] via 10.10.11.2, 02:15:25, Serial0/0/0

Site2#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.10.10.0/24 [110/253] via 10.10.11.1, 00:07:18, Serial0/0/0
C       10.10.11.0/30 is directly connected, Serial0/0/0
C       10.10.12.0/24 is directly connected, FastEthernet0/1

The other way to change the cost value, using ip ospf cost command, The value set by the ip ospf cost command overrides the cost resulting from the calculation matter 10^8/Bw in bps.

For example, if you want to change the cost value  of the interface f0/0 of site1 router to 20
Site1(config)#int f0/0
Site1(config-if)#ip ospf cost 20

So, the cost of f0/0 was 100000/9000=111, but after using the above command will be 20, this mean that Cost(Metric) From site2 router to reach site2 network 10.10.10.0/24

Metric=10^8bps/BW in bps
Metric=100000kbps/Bw in kbps+100000/BW in kbps
Metric=100000/700+20=142+20
Metric=162

Site2#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.10.10.0/24 [110/162] via 10.10.11.1, 00:06:00, Serial0/0/0
C       10.10.11.0/30 is directly connected, Serial0/0/0
C       10.10.12.0/24 is directly connected, FastEthernet0/1

Also, you can change the reference bandwidth, which will affect the cost by using the 
 auto-cost reference-bandwidth mbps.

Also, you can cha If you have high bandwidth links, you should use a larger number of reference bandwidth to differentiate the cost of these links. It's important to know that the value set by ip ospf cost command will override the cost resulting from the auto-cost command.
Site1(config)#router ospf 10
R1(config-router)#auto-cost reference-bandwidth 1000

This simple and short video shows all the above (lab)


To get the packet tracer file. Just click on the following link

To get automatic updates, join a facebook group (netsyshorizon)
https://www.facebook.com/groups/954180217947066/

Related Links:
Assign ip address to cisco layer 2 switch / Assign ip address to vlan
https://youtu.be/Q9SUVmyJr80
Telnet Vs SSH - Difference betweenTelnet and SSH Configuration
https://youtu.be/15pfENww-dk
Configure DHCP on Cisco router - Cisco router as a DHCP Server
https://youtu.be/YTCgVn9X4ac
SSH from cisco router and switch to another
https://youtu.be/_I-0Vgc8E9s
OSPF Cost Calculation and Configuring Bandwidth/ip ospf cost/reference bandwidth
https://youtu.be/zgqaVkQe5Sw
EIGRP Composite Metric Calculation and Configuring different delay values and Bandwidth values
https://youtu.be/GsnV4Bc3On8
Configure / Assign IP address to Cisco Layer 3 Switch
https://youtu.be/s9DMZCq27Ys
Configuring cisco extended acl / extended named access control list tutorial using packet tracer
https://youtu.be/Tj6H8pg06f0
Configure Cisco  Extended ACL/ Extended Numbered Access Control List ACL Using Packet Tracer
https://youtu.be/j0CDNAa2Wqg
Port Forwarding and Static Nat on Cisco Routers - Access your private network from the internet
https://youtu.be/8WVWoW86Uhw
Configure Cisco Named Standard Access Control List ACL on Cisco routers
https://youtu.be/u2zmuRZazFw
How Access List works - Numbered Standard Access List configuring
https://youtu.be/rLci6mFg2BA
Cisco router WAN Redundancy/WAN Failover and Change Routing dynamicaly Using IP SLA - Route Tracking
https://youtu.be/x3xZhbrX7Ww
Cisco Named Access Control Lists Editing (add and delete individual lines+resequence)
https://youtu.be/RToV6h2rGeM
Connecting  GNS3 to Vmware

https://youtu.be/WuLf3ESAx94
How to download and install GNS3 1.2 + adding IOS image to GNS3

https://youtu.be/CXVNpERIPo4
Mikrotik router PPPoE client configuration - Mikrotik PPPoE client Setup
https://youtu.be/aUGL20rjbVA
Add IOS images to GNS3
https://youtu.be/GjxODWeuC5Y
Connect your PC to GNS3 - connecting GNS3 to local machine
https://youtu.be/c_b_-rGWnJc
Configuration register value - changing the configuration register
https://youtu.be/YVAKerOmJpk
Backup and Restore Cisco Configuration file -  Cisco backup Config
https://youtu.be/YMX1EMPjBC0
Capture telnet password using wireshark - Sniffing telnet password using wireshark
https://youtu.be/xShwyUq-uHk
Clock Rate vs Bandwidth - Configuring clock rate and bandwidth
https://youtu.be/rntsm5bHagI
Configure Default routes on cisco routers
https://youtu.be/E5-kpZt8LU4
Configure cisco router hostname and ip address
https://youtu.be/1OYMlMzQ1dE
Cisco Router Password Recovery
https://youtu.be/6shdtrAx9l0
Static Routing Configuration Using Packet Tracer
https://youtu.be/v05Jm4h-Zms

Keywords:
configuring layer 3 interfaces
ospf cost calculation cisco example
how to configure ospf cost
how to calculate ospf cost
ospf metric calculation
ospf and cost calculation
ospf uses bandwidth to calculate the cost
calculating ospf cost
ospf metric value cost and ospf default cost
ospf path cost
ospf link cost
ospf equal cost paths
ospf reference bandwidth command
auto-cost reference-bandwidth command
ip ospf cost command
ospf area
ospf metric troubleshooting
ospf metric sample
ospf metric tutorial ccna ccnp
how to configure ospf cost
configuring ospf cost
configuring ospf interface cost
free ccna and ccnp material and videos ospf
ospf calculation formula
learning ospf cost
ip ospf cost example
ospf cost configuration
ospf configuration guide
ospf metric calculation example

No comments:

Post a Comment