|
After a router has a complete link-state database,
it is ready to create its routing table so that it can forward traffic. As
mentioned earlier in the chapter, OSPF uses the metric value called cost to
determine the best path to a destination (see the figure to the left). The default cost value is based on
media bandwidth. In general, cost decreases as the speed of the link increases.
RTB's 10-Mbps Ethernet interface, for example, has a lower cost than its T1
serial line because 10 Mbps is faster than 1.544 Mbps.
To calculate the lowest cost to a destination,
RTB uses the SPF algorithm. In simple terms, the SPF algorithm adds up the total
costs between the local router (called the root) and each destination network.
If there are multiple paths to a destination, the lowest-cost path is preferred.
By default, OSPF keeps up to four equal-cost route entries in the routing table
for load balancing.
Sometimes a link, such as a serial line, will go
up and down rapidly (a condition called flapping). If a flapping link causes
LSUs to be generated, routers that receive those updates must rerun the SPF
algorithm to recalculate routes. Prolonged flapping can severely affect performance. Repeated SPF calculations can overtax the router's CPU; moreover,
the constant updates may prevent link-state databases from converging.
To combat this problem, the Cisco IOS uses an SPF hold timer. After receiving an
LSU, the SPF hold timer determines how long a router will wait before running
the SPF algorithm. The timers spf
command enables you to adjust the timer, which defaults to 10 seconds.
After RTB has selected the best routes using the
SPF algorithm, it moves into the final phase of OSPF operation.
|