You can modify the default interface cost in OSPF by changing the OSPF Reference Bandwidth metric. This lab will discuss and demonstrate the configuration and verification of OSPF reference bandwidth.
If you completed Lab 9-10 – Configuring OSPF Interface Cost then you should be familiar with how t he metric is calculated by OSPF.The default formula to calculate the cost for the OSPF metric is (10^8/BW). This is due to the default auto cost reference bandwidth being set at 100Mbps so any link with a speed of 100Mbps or great would have a cost of 1 and no less. This can cause problems such as sub-optimal route selection and load balancing which could lead to out of order packets thus causing application problems on through out the network.
The default reference bandwidth used to calculate the OSPF metric can be changed to reflect today’s modern networks in which case a 100Gbps reference bandwidth is a good estimate or perhaps you wish to future proof your network as many corporations do and use a reference bandwidth of 1Tbps.
In this lab you will learn how to configure the auto cost reference bandwidth on all routers in the OSPF autonomous system to ensure proper route metric calculation based on interface speed. To configure the reference bandwidth you use the auto-cost reference-bandwidth # command in OSPF router configuration mode whereas # is the Mbps used as the constant in the OSPF metric formula Metric = (C/Bw)
Familiarize yourself with the following new command(s);
Command | Description |
---|---|
auto-cost reference-bandwidth # | This command is executed in OSPF router configuration mode to specify a default auto-cost reference bandwidth used to dynamically calculate OSPF interface cost. |
The following logical topology shown below is used in labs found through out Section 9 – Configuring OSPF;
Objective 1. – Configure the OSPF Auto Cost Reference Bandwidth on all OSPF routers in the topology to 1Tbps.
1Tbps = 1000000Mbps as shown below;
R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#router ospf 1 R1(config-router)#auto-cost reference-bandwidth 1000000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers. R1(config-router)#end R1#
R2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R2(config)#router ospf 1 R2(config-router)#auto-cost reference-bandwidth 1000000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers. R2(config-router)#end R2#
R3#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R3(config)#router ospf 1 R3(config-router)#auto-cost reference-bandwidth 1000000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers. R3(config-router)#end R3#
R4#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R4(config)#router ospf 1 R4(config-router)#auto-cost reference-bandwidth 1000000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers. R4(config-router)#end R4#
R5#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R5(config)#router ospf 1 R5(config-router)#auto-cost reference-bandwidth 1000000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers. R5(config-router)#end R5#
Objective 2. – Verify your configuration by viewing the routing table and manually calculating the metric for a T1
R1#show ip route
Codes: C - connected, S - static, 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
* - 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, 9 subnets, 4 masks
O IA 10.90.50.1/32 [110/65536] via 10.90.245.5, 00:06:04, Serial0/0
O IA 10.90.40.1/32 [110/65536] via 10.90.245.4, 00:06:04, Serial0/0
O IA 10.90.23.0/30 [110/131070] via 10.90.245.2, 00:05:53, Serial0/0
O IA 10.90.30.1/32 [110/131071] via 10.90.245.2, 00:05:53, Serial0/0
O IA 10.90.145..0/24 [110/65635] via 10.90.245.5, 00:05:24, Serial0/0
O IA 10.90.45.0/30 [110/131070] via 10.90.245.5, 00:05:14, Serial0/0
[110/131070] via 10.90.245.4, 00:05:14, Serial0/0
O IA 10.90.20.1/32 [110/65536] via 10.90.245.2, 00:06:04, Serial0/0
C 10.90.10.0/24 is directly connected, Loopback0
C 10.90.245.0/29 is directly connected, Serial0/0
R1#
To calculate the auto-cost metric for a T1 we’ll use the following route shown below;
O IA 10.90.20.1/32 [110/65536] via 10.90.245.2, 00:06:04, Serial0/0
First off we know the formula is Metric = (10^12/bw) in which case we also know the bandwidth of the interface which is 1544; so to calculate the T1 auto-cost metric the math would be; metric = (10^12/1,544,000) in which case equals 647668.
Okay so something does not add up; the metric on the router shows 65536 but the metric calculated shown above does not match the route metric in the actual routing table? To answer this question you must think back to the operation of OSPF; this is due to the maximum metric per interface being 65536. This is the worst possible metric given to a single hop.
Keep in mind setting the OSPF auto-cost reference-bandwidth to 1Tbps can hurt your network more then it can help it. This is due to the fact that any link slower then ~15Mbps will get the max metric of 65536 per hop, in which case OSPF cannot tell the difference between a T1 and 10Mbps WAN link and thus will install both routes as equal cost routes to the destination in the routing table resulting in sub-optimal routing. CEF will load-share based on per destination hashing which can result in unintended network operation such as all traffic going to one server takes the slow path over the faster path.
In today’s network it is best to set the OSPF auto-cost reference-bandwidth too 100Gbps using the auto-cost reference-bandwidth 100000 command in router configuration mode. In which case a full T1 would get a metric of 64766.