Network Bulls
www.networkbulls.com
Best Institute for CCNA CCNP CCSP CCIP CCIE Training in India
M-44, Old Dlf, Sector-14 Gurgaon, Haryana, India
Call: +91-9654672192
All this effort to define LSA types, create areas, and fully flood the LSAs has one goal in
mind: to allow all routers in that area to calculate the best, loop-free routes for all known
subnets. Although the database exchange process may seem laborious, the process by
which SPF calculates the best routes requires a little less thought, at least to the level rewww.
CareerCert.info
Chapter 6: OSPF Topology, Routes, and Convergence 205
quired for the CCNP ROUTE exam. In fact, the choice of the best route for a given subnet,
and calculated by a particular router, can be summarized as follows:
■ Analyze the LSDB to find all possible routes to reach the subnet.
■ For each possible route, add the OSPF interface cost for all outgoing interfaces in
that route.
■ Pick the route with the lowest total cost.
For humans, if you build a network diagram, note the OSPF cost for each interface (as
shown with show ip ospf interface), you can easily add up the costs for each router’s possible
routes to each subnet and tell which route OSPF will choose. The routers must use a
more complex SPF algorithm to derive a mathematical model of the topology based on the
LSAs. This section examines both the simpler human view of metric calculation and folds in
some of the basics of what SPF must do on a router to calculate the best routes. It also goes
through the options for tuning the metric calculation to influence the choice of routes.
OSPF Metric Calculation for Internal OSPF Routes
The process of calculating the cost from a router to each subnet may be intuitive to most
people. However, spending a few minutes considering the details is worthwhile, in part to
link the concepts with the LSAs, and to be better prepared for questions on the ROUTE
exam. This section breaks the discussion into three sections: intra-area routes, interarea
routes, a short discussion about cases when both intra-area and interarea routes exist for
the same subnet, and an explanation of SPF calculations.
Calculating the Cost of Intra-Area Routes
When a router analyzes the LSDB to calculate the best route to each subnet, it does the
following:
Step 1. Finds all subnets inside the area, based on the stub interfaces listed in the Type
1 LSAs and based on any Type 2 network LSAs
Step 2. Runs SPF to find all possible paths through the area’s topology, from itself to
each subnet
Step 3. Calculates the OSPF interface costs for all outgoing interfaces in each route,
picking the lowest total cost route for each subnet as the best route
For example, Figure 6-11 shows the routers and links inside area 34, as a subset of the internetwork
also shown in Figure 6-1. Figure 6-11 shows the interface numbers and OSPF costs.
Following the basic three-step process, at Step 1, R1 can determine that subnet
10.10.34.0/24 exists in area 34 because of the Type 2 LSA created by the DR in that subnet.
For Step 2, R1 can then run SPF and determine four possible routes, two of which are
clearly more reasonable to humans: R1-R3 and R1-R4. (The two other possible routes, R1-
R3-R2-R4 and R1-R4-R2-R3, are possible and would be considered by OSPF but would
clearly be higher cost.) For Step 3, R1 does the simple math of adding the costs of the outgoing
interfaces in each route, as follows:
■ R1-R3: Add R1’s S0/0/0.3 cost (647) and R3’s Fa0/0 cost (10), total 657
■ R1-R4: Add R1’s S0/0/0.4 cost (647) and R4’s Fa0/0 cost (10), total 657
Key
Topic
Key
Topic
www.CareerCert.info
206 CCNP ROUTE 642-902 Official Certification Guide
Subnet
10.10.34.0/24
Fa0/0
Cost 10
.3
Fa0/0
Cost 10
.4
13.3
S0/0/0.1 Cost 647
S0/0/0.2 Cost 647
14.4
S0/0/0.1 Cost 647
S0/0/0.2 Cost 647
Cost 647 S0/0/0.3
Cost 647 S0/0/0.3
Cost 647 S0/0/0.3
Cost 647 S0/0/0.4
R2
R3 R1
R4
Figure 6-11 Area 34 Portion of Figure 6-1
The metrics tie, so with a default setting of maximum-paths 4, R1 adds both routes to its
routing table. In particular, the routes list the metric of 657, and the next-hop IP address
on the other end of the respectively links: 10.10.13.3 (R3’s S0/0/0.1) and 10.10.14.4 (R4’s
S0/0/0.1).
Note that OSPF supports equal-cost load balancing, but it does not support unequal-cost
load balancing. The maximum-paths OSPF subcommand can be set as low as 1, with the
maximum being dependent on router platform and IOS version. Modern IOS versions typically
support 16 or 32 concurrent routes to one destination (maximum).
Calculating the Cost of Interarea Routes
From a human perspective, the cost for interarea routes can be calculated just like for intra-
area routes if we have the full network diagram, subnet numbers, and OSPF interface
costs. To do so, just find all possible routes from a router to the destination subnet, add up
the costs of the outgoing interfaces, and choose the router with the lowest total cost.
However, OSPF routers cannot do the equivalent for interarea routes, because routers internal
to one area do not have topological data–LSA Types 1 and 2–for other areas. Instead,
ABRs create and flood Type 3 summary LSAs into an area, listing the subnet
number and mask, but not listing details about routers and links in the other areas. For example,
Figure 6-12 shows both Areas 34 and 0 from Figure 6-1, including interface costs.
Then consider how OSPF determines the lowest-cost route from router R3 for subnet
10.10.99.0/24, the Data Center subnet on the right.
R3 has a large number of possible routes to reach subnet 10.10.99.0/24. For example, just
to get from R3 to R1, there are several possibilities: R3-R1, R3-R4-R1, and R3-R2-R1.
From R1 the rest of the way to subnet 10.10.99.0/24, many more possibilities exist. The
SPF algorithm has to calculate all possible routes inside an area to the ABR, so with more
redundancy, SPF’s run time goes up. And SPF has to consider all the options, whereas we
humans can rule out some routes quickly because they appear to be somewhat ridiculous.
34.
Example 6-7 Route and Type 3 LSA on R1 for 10.10.99.0/24
R1#show ip route ospf
10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks
O 10.10.5.0/27 [110/648] via 10.10.15.5, 00:04:19, Serial0/0/0.5
O 10.10.23.0/29 [110/711] via 10.10.13.3, 00:04:19, Serial0/0/0.3
www.CareerCert.info
208 CCNP ROUTE 642-902 Official Certification Guide
O 10.10.24.0/29 [110/711] via 10.10.14.4, 00:04:19, Serial0/0/0.4
O 10.10.25.0/29 [110/711] via 10.10.15.5, 00:04:19, Serial0/0/0.5
O 10.10.27.0/24 [110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0
[110/11] via 10.10.12.2, 00:04:19, FastEthernet0/0.1
O 10.10.28.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1
[110/11] via 10.10.12.2, 00:04:19, FastEthernet0/0.1
O 10.10.34.0/24 [110/648] via 10.10.14.4, 00:04:19, Serial0/0/0.4
[110/648] via 10.10.13.3, 00:04:19, Serial0/0/0.3
O 10.10.98.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1
[110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0
O 10.10.99.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1
[110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0
R1#show ip ospf database summary 10.10.99.0
OSPF Router with ID (1.1.1.1) (Process ID 1)
! omitting output for area 5...
Summary Net Link States (Area 34)
LS age: 216
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.99.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000003
Checksum: 0x951F
Length: 28
Network Mask: /24
TOS: 0 Metric: 11
LS age: 87
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.99.0 (summary Network Number)
Advertising Router: 2.2.2.2
LS Seq Number: 80000002
Checksum: 0x7938
Length: 28
Network Mask: /24
TOS: 0 Metric: 11
Each router repeats this process for all known routes to reach the ABR, considering the
Type 3 LSAs from each ABR. In this case, R3 ties on metrics for one route through R1 and
one through R2, so R3 adds both routes to its routing table, as shown in Example 6-8.
Example 6-8 Route and Type 3 LSA on R1 for 10.10.99.0/24
R3#show ip route 10.10.99.0 255.255.255.0
Routing entry for 10.10.99.0/24
Known via “ospf 3”, distance 110, metric 658, type inter area
Last update from 10.10.13.1 on Serial0/0/0.1, 00:08:06 ago
Routing Descriptor Blocks:
* 10.10.23.2, from 2.2.2.2, 00:08:06 ago, via Serial0/0/0.2
Route metric is 658, traffic share count is 1
10.10.13.1, from 1.1.1.1, 00:08:06 ago, via Serial0/0/0.1
Route metric is 658, traffic share count is 1
R3#show ip route ospf
10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks
O IA 10.10.5.0/27 [110/1304] via 10.10.23.2, 00:07:57, Serial0/0/0.2
[110/1304] via 10.10.13.1, 00:07:57, Serial0/0/0.1
O IA 10.10.12.0/24 [110/657] via 10.10.23.2, 00:08:17, Serial0/0/0.2
[110/657] via 10.10.13.1, 00:08:17, Serial0/0/0.1
! lines omitted for brevity
O IA 10.10.99.0/24 [110/658] via 10.10.23.2, 00:08:17, Serial0/0/0.2
[110/658] via 10.10.13.1, 00:08:17, Serial0/0/0.1
Besides the information that matches the expected outgoing interfaces per the figures, the
output also flags these routes as interarea routes. The first command lists “type inter area”
explicitly, and the show ip route ospf command lists the same information with the code
“O IA,” meaning OSPF, interarea. Simply put, interarea routes are routes for which the
subnet is known from a Type 3 summary LSA.
Special Rules Concerning Intra-area and Interarea Routes on ABRs
OSPF has a couple of rules concerning intra-area and interarea routes that take precedence
over the simple comparison of the cost calculated for the various routes. The issue exists
when more than one ABR connects to the same two areas. Many designs use two routers
between the backbone and each nonbackbone area for redundancy, so this design occurs
in many OSPF networks.
The issue relates to the fact that with two or more ABRs, the ABRsthemselves, when calculating
their own routing tables, can calculate both an intra-area route and interarea route
for subnets in the backbone area. For example, consider the perspective of Router R1 from
the last several examples, as depicted in Figure 6-14.
Conceptually, R1 could calculate both the intra-area route and interarea route to
10.10.99.0/24. However, the OSPF cost settings could be set so that the lower cost route
www.CareerCert.info
Chapter 6: OSPF Topology, Routes, and Convergence 211
Area 34
R2
R1
Area 0
10.10.99.0/24
Interarea
Route
Intra-area
Route
Best Route
Figure 6-14 R1’s Choice: Intra-Area or Interarea Route to 10.10.99.0/24
for R1 actually goes through area 34, to ABR R2, and then on through Area 0 to
10.10.99.0/24. However, two OSPF rules prevent such a choice by R1:
Step 1. When choosing the best route, an intra-area route is always better than a competing
interarea route, regardless of metric.
Step 2. If an ABR learns a Type 3 LSA inside a nonbackbone area, the ABR ignores
that LSA when calculating its own routes.
Because of the first rule, R1 would never choose the interarea route if the intra-area
route were available. The second rule goes further, stating that R1 could never choose the
interarea route at all–R1 simply ignores that LSA for the purposes of choosing its own
best IP routes.
Metric and SPF Calculations
Before moving on to discuss how to influence route choices by changing the OSPF interface
costs, first take a moment to consider the CPU-intensive SPF work done by a router.
SPF does the work to piece together topology information to find all possible routes to a
destination. As a result, SPF must execute when the intra-area topology changes, because
changes in topology impact the choice of best route. However, changes to Type 3 LSAs
do not drive a recalculation of the SPF algorithm, because the Type 3 LSAs do not actually
describe the topology.
To take the analysis a little deeper, remember that an internal router, when finding the best
interarea route for a subnet, uses the intra-area topology to calculate the cost to reach the
ABR. When each route is identified, the internal router adds the intra-area cost to the
ABR, plus the corresponding Type 3 LSA’s cost. A change to the Type 3 LSA–it fails,
comes back up, or the metric changes–does impact the choice of best route, so the
changed Type 3 LSA must be flooded. However, no matter the change, the change does
not affect the topology between a router and the ABR—and SPF focuses on processing
that topology data. So, only changes to Type 1 and 2 LSAs require an SPF calculation.
www.CareerCert.info
212 CCNP ROUTE 642-902 Official Certification Guide
You can see the number of SPF runs, and the elapsed time since the last SPF run, using
several variations on the show ip ospf command. Each time a Type 3 LSA changes and is
flooded, SPF does not run, and the counter does not increment. However, each time a
Type 1 or 2 LSA changes, SPF runs, and the counter increments. Example 6-9 highlights
the counter that shows the number of SPF runs on that router, in that area, and the time
since the last run. Note that ABRs list a group of messages per area, showing the number
of runs per area.
Example 6-9 Example with New Route Choices but No SPF Run
R3#show ip ospf | begin Area 34
Area 34
Number of interfaces in this area is 3
Area has no authentication
SPF algorithm last executed 00:41:02.812 ago
SPF algorithm executed 15 times
Area ranges are
Number of LSA 25. Checksum Sum 0x0BAC6B
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Metric Tuning
Engineers have a couple of commands available that allow them to tune the values of the
OSPF interface cost, thereby influencing the choice of best OSPF route. This section discusses
the three methods: changing the reference bandwidth, setting the interface bandwidth,
and setting the OSPF cost directly.
Changing the Reference Bandwidth
OSPF calculates the default OSPF cost for an interface based on the following formula:
The reference-bandwidth, which you can set using the auto-cost reference-bandwidth
bandwidth router subcommand, sets the numerator of the formula for that one router,
with a unit of Mbps. This setting may be different on different routers, but Cisco recommends
using the same setting on all routers in an OSPF routing domain.
For example, serial interfaces default to a bandwidth setting of 1544, meaning 1544 Kbps.
The reference bandwidth defaults to 100, meaning 100 Mbps. After converting the reference
bandwidth units to Kbps to match the bandwidth, the cost, calculated per the defaults,
for serial links would be
100,000
1544
64
Reference-brandwidth
interface-bandwidth
www.CareerCert.info
Chapter 6: OSPF Topology, Routes, and Convergence 213
Note: OSPF always rounds down when the calculation results in a fraction.
The primary motivation for changing the reference bandwidth is to accommodate good
defaults for higher-speed links. With a default of 100 Mbps, the cost of FastEthernet interfaces
calculates to cost 1. However, the minimum OSPF cost is 1, so Gigabit Ethernet
and 10 Gigabit interfaces also then default to OSPF cost 1. By setting the OSPF reference
bandwidth so that there is some difference in cost between the higher speed links, OSPF
can then choose routes that use those higher speed interfaces.
Note: Although Cisco recommends that all routers use the same reference bandwidth, the
setting is local to each router.
Note that in the examples earlier in this chapter, the bandwidth settings used default settings,
but the auto-cost reference-bandwidth 1000 command was used on each router to
allow different costs for FastEthernet and Gigabit interfaces.
Setting Bandwidth
You can indirectly set the OSPF cost by configuring the bandwidth speed interface subcommand.
In such cases, the formula shown in the previous section is used, just with the
configured bandwidth value.
While on the topic of the interface bandwidth subcommand, a couple of seemingly trivial
facts may matter to your choice of how to tune the OSPF cost. First, on serial links, the
bandwidth defaults to 1544. On subinterfaces of those serial interfaces, the same bandwidth
default is used.
On Ethernet interfaces, if not configured with the bandwidth command, the interface
bandwidth matches the actual speed. For example, on an interface that supports autonegotiation
for 10/100, the bandwidth is either 100,000 (kbps, or 100 Mbps) or 10,000 (Kbps,
or 10 Mbps) depending on whether the link currently runs at 100 or 10 Mbps, respectively.
Configuring Cost Directly
The most controllable method to configure OSPF costs, but the most laborious, is to configure
the interface cost directly. To do so, use the ip ospf cost value interface subcommand,
substituting your chosen value as the last parameter.
Verifying OSPF Cost Settings
Several commands can be used to display the OSPF cost settings of various interfaces.
Example 6-10 shows several, along with the configuration of all three methods for changing
the OSPF cost. In this example, the following has been configured:
■ The reference bandwidth is set to 1000.
■ Interface S0/0/0.1 has its bandwidth set to 1000 Kbps.
■ Interface Fa0/0 has its cost set directly to 17.
www.CareerCert.info
214 CCNP ROUTE 642-902 Official Certification Guide
Example 6-10 R3 with OSPF Cost Values Set
router ospf 3
auto-cost reference-bandwidth 1000
interface S0/0/0.1
bandwidth 1000
interface fa0/0
ip ospf cost 17
R3#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Se0/0/0.2 3 34 10.10.23.3/29 647 P2P 1/1
Se0/0/0.1 3 34 10.10.13.3/29 1000 P2P 1/1
Fa0/0 3 34 10.10.34.3/24 17 BDR 1/1
R3#show ip ospf interface fa0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.10.34.3/24, Area 34
Process ID 3, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 17
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 4.4.4.4, Interface address 10.10.34.4
Backup Designated router (ID) 3.3.3.3, Interface address 10.10.34.3
! lines omitted for brevity
No comments:
Post a Comment