OSPFv2 – OSPF, BGP, and Route Manipulation
OSPFv2
RFC 2328 defines Open Shortest Path First version 2 (OSPFv2), a link-state routing protocol that uses Dijkstra’s shortest-path first (SPF) algorithm to calculate paths to destinations. OSPFv2 is used in IPv4 networks. OSPF was created for use in large networks where RIP failed. OSPF improved the speed of convergence, provided for the use of variable-length subnet masking (VLSM), and improved the path calculation.
In OSPF, each router sends link-state advertisements (LSAs) about itself and its links to all other routers in the area. Note that it does not send routing tables but rather sends link-state information about its interfaces. Then, each router individually calculates the best routes to the destination by running the SPF algorithm. Each OSPF router in an area maintains an identical database describing the area’s topology. The routing table at each router is individually constructed using the local copy of this database to construct a shortest-path tree.
OSPFv2 is a classless routing protocol that permits the use of VLSM. With Cisco routers, OSPF also supports equal-cost multipath load balancing and neighbor authentication. OSPF uses multicast addresses to communicate between routers. OSPF uses IP protocol 89.
This section covers OSPF theory and design concepts. It discusses OSPF LSAs, area types, and router types. OSPF uses a two-layer hierarchy with a backbone area at the top and all other areas below. Routers send LSAs informing other routers of the status of their interfaces. The use of LSAs and the characteristics of OSPF areas are important concepts to understand for the ENSLD 300-420 exam.
OSPFv2 Metric
The metric that OSPFv2 uses is cost. It is an unsigned 16-bit integer in the range 1 to 65,535. The default cost for interfaces is calculated based on the bandwidth, using the formula 108 / BW, where BW is the bandwidth of the interface expressed as a full integer of bits per second (bps). If the result is smaller than 1, the cost is set to 1. A 10BASE-T (10 Mbps = 107 bps) interface has a cost of 108 / 107 = 10. OSPF performs a summation of the costs to reach a destination; the lowest cost is the preferred path. Table 4-2 shows some sample interface metrics.
Table 4-2 OSPF Default Interface Costs
Interface Type | OSPF Cost |
10 Gigabit Ethernet | 108/1010 = .01 → 1 |
Gigabit Ethernet | 108/109 = .1 → 1 |
OC-3 (155 Mbps) | .64516 → 1 |
Fast Ethernet | 108/108 = 1 |
DS-3 (45 Mbps) | 2 |
Ethernet | 108/107 = 10 |
T1 | 64 |
512 kbps | 195 |
256 kbps | 390 |
The default reference bandwidth used to calculate OSPF costs is 108 (cost = 108 / BW). Notice that for technologies that support speeds greater than 100 Mbps, the default metric gets set to 1 without regard for the network’s different speeds.
Because OSPF was developed prior to high-speed WAN and LAN technologies, the default metric for 100 Mbps was 1. Cisco provides a method to modify the default reference bandwidth. The cost metric can be modified on every interface. It is highly recommended that you change the default reference bandwidth to a higher number on all routers in the OSPF network if OSPF links have a speed higher than 100 Mbps.