OSPF Configuration, DR/BDR Election, Cost Metrics, Timers, and Verification
Multi-Access Network Architecture and Layer 3 Routing
- Multi-access networks in an OSPF environment typically consist of multiple routers interconnected through a centralized Layer 2 switch using Ethernet ports rather than serial point-to-point connections.
- Utilizing Ethernet connections to a Layer 2 switch represents a common campus network topology design.
- Designing the network at Layer 3 avoids reliance on Spanning Tree Protocol (STP), preventing associated STP loops, blocking states, and slow convergence issues.
- Dynamic routing protocols at Layer 3 provide superior path redundancy and failover handling compared to Layer 2 STP loops management mechanisms.
Designated Router (DR) and Backup Designated Router (BDR) Elections
- On multi-access broadcast networks, OSPF routers elect a Designated Router (DR) and a Backup Designated Router (BDR) to minimize the number of adjacencies and reduce routing update traffic.
- Routers that are neither the DR nor the BDR take on the role of DROTHER (DR Other).
- Election criteria operate under a deterministic priority hierarchy:
- The router with the highest interface priority value is elected as the DR.
- The router with the second-highest interface priority value is elected as the BDR.
- If interface priority numbers are equal (the default priority value is 1 on all OSPF-enabled interfaces), the router with the highest Router ID (RID) wins the election.
Router ID (RID) Determination Hierarchy
- The OSPF Router ID is a 32-bit value (formatted identically to an IPv4 address) used to uniquely identify each router within an OSPF routing domain.
- Routers determine their RID according to a strict three-tier precedence order:
- Tier 1 (Manual Configuration): Explicit static assignment within the OSPF routing process via the command
router-id <ip-address> (e.g., router-id 1.1.1.1, router-id 2.2.2.2, or router-id 3.3.3.3). - Tier 2 (Highest Loopback Address): In the absence of a manually configured RID, the router automatically selects the highest IPv4 address configured among its active logical/virtual loopback interfaces.
- Tier 3 (Highest Active Physical Interface): If no loopback interfaces exist, the router selects the highest IPv4 address among any of its operational (up/up) physical interfaces.
Modifying OSPF Interface Priority and Forcing Re-election
- OSPF interface priority values can be tuned to designate specific routers as the DR or BDR manually.
- Interface priority configuration steps:
- Access interface configuration mode (e.g.,
interface GigabitEthernet0/0 or interface g0/0). - Apply the priority command:
ip ospf priority <0-255> (e.g., ip ospf priority 255). - Setting a priority of 255 ensures the highest possible preference during an election.
- Setting a priority of 0 prevents a router from ever participating in the DR/BDR election, permanently keeping it in the DROTHER state.
- Resetting the OSPF process:
- OSPF DR and BDR elections are non-preemptive; a newly added router with a higher priority or higher RID will not displace an existing active DR or BDR unless the election process is reset.
- To force an immediate re-election, clear the OSPF process using the privileged EXEC command:
clear ip ospf process. - For optimal control, execute
clear ip ospf process on all participating routers, beginning first with the intended DR router possessing the highest configured priority value.
OSPF Metric and Cost Calculation
- OSPF utilizes cost as its routing metric, which represents the overhead required to send packets across a given interface.
- The cost is inversely proportional to interface bandwidth—higher bandwidth links yield lower cost values, making them preferred paths.
- The baseline mathematical formula for interface cost is:
Cost=Interface BandwidthReference Bandwidth
- The default OSPF reference bandwidth is defined as 100 Mbps (100,000,000 bps or 108 bps).
- Cost calculation examples under default reference bandwidth (100 Mbps):
- Fast Ethernet (100 Mbps):
Cost=100 Mbps100 Mbps=1
- Standard Ethernet (10 Mbps):
Cost=10 Mbps100 Mbps=10
- Gigabit Ethernet (1000 Mbps or 1 Gbps):
Cost=1000 Mbps100 Mbps=0.1→1
- Ten Gigabit Ethernet (10 Gbps or 10,000 Mbps):
Cost=10,000 Mbps100 Mbps=0.01→1
- Because OSPF cost values are whole integers and cannot drop below 1, fractional cost results are automatically rounded up to 1.
- Under default settings, Fast Ethernet (100 Mbps), Gigabit Ethernet (1 Gbps), and Ten Gigabit Ethernet (10 Gbps) all share an identical cost of 1, preventing OSPF from differentiating higher-speed links.
- End-to-end path cost represents the cumulative sum of all outbound interface costs along the entire path from the source router to the destination network.
- OSPF is a link-state routing protocol that bases routing decisions solely on the static status and capacity (bandwidth) of the links rather than dynamic live traffic congestion or load.
- Analogy: OSPF behaves like a driver selecting a highway with a speed limit of 75 mph over a road with a speed limit of 25 mph, assuming the faster road is inherently superior regardless of momentary traffic jams.
- By contrast, alternative routing protocols such as EIGRP consider additional dynamic factors (e.g., load and delay).
Reference Bandwidth Tuning and Manual Interface Cost
- To resolve the identical metric limitation on links faster than 100 Mbps, the reference bandwidth must be adjusted to match or exceed the highest bandwidth interface in the network topology.
- Changing reference bandwidth globally:
- Enter OSPF configuration mode:
router ospf <process-id>. - Apply the command:
auto-cost reference-bandwidth <value-in-Mbps>. - Setting
auto-cost reference-bandwidth 1000 configures the reference bandwidth to Gigabit speeds (1000 Mbps). - For topologies using Ten Gigabit Ethernet (10 Gbps), setting the reference bandwidth to Ten Gigabit speeds ensures 10 Gbps has a cost of 1, 1 Gbps has a cost of 10, and 100 Mbps has a cost of 100.
- Consistency requirement: The
auto-cost reference-bandwidth command must be applied uniformly across every OSPF router in the routing domain to prevent asymmetric or suboptimal routing paths.
- Manual cost configuration:
- The calculated cost can be overridden directly on an individual interface without modifying the global reference bandwidth.
- Enter interface configuration mode and type:
ip ospf cost <value>.
OSPF Timers: Hello and Dead Intervals
- OSPF routers establish and maintain neighbor adjacencies through periodic Hello packets.
- Default timer settings for multi-access/broadcast links:
- Hello Interval: Sent every 10 seconds.
- Dead Interval: Defaults to four times (4×) the Hello interval, which equals 40 seconds.
- If a router does not receive a Hello packet from an established neighbor within the Dead interval window, the router declares that neighbor down/dead and recalculates the topology.
- Hello and Dead intervals are strictly negotiated during adjacency formation:
- Neighbor routers must agree identically on both the Hello and Dead intervals.
- If there is any mismatch in the Hello or Dead interval timers between two interconnected interfaces, they will fail to form an adjacency, and no OSPF routing information will be populated in their routing tables.
- Checking for mismatched timers is a critical troubleshooting step on CCNA certification assessments.
- Timer tuning for faster convergence:
- Reducing timers allows faster detection of interface and link failures.
- Example: Lowering the Hello interval to 5 seconds automatically scales the Dead interval to 4×5=20 seconds.
- Timer adjustment commands on an interface:
ip ospf hello-interval 5ip ospf dead-interval 20- When modifying timers, the identical values must be configured across every adjacent router on that shared network segment.
- In scenarios where an edge router connects to an upstream Internet Service Provider (ISP), an internal default route must be propagated to all internal OSPF routers.
- Simulation of an ISP link is frequently accomplished via a loopback interface (such as
Loopback 1) configured on the border router. - Any packet with a destination address that does not match an entry in a router's routing table is forwarded via the default route toward the edge router.
- To advertise the default route into OSPF:
- An operational default static route must exist on the edge router (e.g.,
ip route 0.0.0.0 0.0.0.0 Loopback 1). - Enter router configuration mode:
router ospf 10 (using OSPF process ID 10). - Apply the propagation command:
default-information originate.
- The
default-information originate command floods a Type 5 external Link-State Advertisement (LSA) throughout the OSPF area, instructing all neighboring routers to dynamically inject a default route into their own routing tables pointing back to the edge router.
OSPF Verification and Troubleshooting Commands
show ip ospf neighbor:- Verifies whether adjacent routers have formed successful OSPF neighbor relationships.
- Displays neighbor Router IDs (e.g.,
1.1.1.1, 2.2.2.2, 3.3.3.3), neighbor states (FULL/DR, FULL/BDR, or FULL/DROTHER), Dead time counters, neighbor IP addresses (e.g., 192.168.1.1), and local exit interfaces.
show ip protocols:- Displays global routing protocol parameters, including the active OSPF process ID, Router ID, network statements, and interfaces explicitly configured to advertise OSPF.
- Verifies the Administrative Distance (AD) of OSPF, which defaults to 110.
show ip ospf:- Provides general information about the OSPF routing instance, including process ID, Router ID, backbone/area parameters, SPF calculation counters, and link-state database metrics.
show ip ospf interface <interface-id> (e.g., show ip ospf interface g0/0):- Provides an exhaustive breakdown of OSPF settings for a specific interface.
- Shows whether the physical layer and line protocol are active (up/up).
- Displays assigned IP address, interface cost, process ID, local Router ID, network type (broadcast multi-access), interface priority, DR and BDR Router IDs, and current Hello/Dead intervals.
show ip ospf interface brief:- Produces a concise, tabular summary of all OSPF-enabled interfaces, displaying interface names, process IDs, area IDs, IP addresses, subnet masks, interface costs, OSPF state/role (DR, BDR, or DROTHER), and neighbor count.