Questions? Call 1.800.716.8955

Chapter 22

OSPF Configuration and Troubleshooting

Exam topics covered

3.4 Configure and verify single area OSPFv2

  • 3.4.a Neighbor adjacencies
  • 3.4.b Point-to-point
  • 3.4.c Broadcast (DR/BDR selection)
  • 3.4.d Router ID

Foundation. Chapter 21 explained what OSPF does: routers discover neighbors with hellos, flood link-state advertisements (LSAs) until every router in the area holds an identical link-state database (LSDB), and then run the SPF algorithm to choose least-cost paths. This chapter is where you make it happen on real routers. You will enable OSPFv2 with both the classic network command and the newer interface-level command, control the router ID, keep OSPF quiet on user-facing LANs, inject a default route, tune costs, and decide which router becomes the designated router. You will also learn to read the verification output the exam shows you and to diagnose the half-dozen faults that keep routers from becoming neighbors.

22.1 The Chapter Lab Topology

Every example in this chapter uses the four-router network in Figure 22-1, which mixes two kinds of OSPF segment:

Point-to-point style links from R1 to R2 and from R1 to R3, each a /30 with exactly two routers on it.

A shared Ethernet segment (10.1.234.0/24, through switch SW1) where R2, R3 and R4 all meet. With three routers on one broadcast segment, OSPF elects a designated router (DR) and a backup designated router (BDR).

R1 is the edge router, with a static default route to the ISP on G0/2. R1 and R4 each have a user LAN with no other routers.

Isp

Figure 22-1 The chapter lab: four routers, all OSPF links in area 0 (process 1). Each router's loopback 0 is X.X.X.X/32 and serves as its router ID.

Note

All terminal output in this chapter is illustrative of Cisco IOS 15.x and IOS XE. Timers, sequence numbers and checksums will differ on your equipment, and some versions add or omit a few lines, but the fields the exam tests are the same.

22.2 Enabling OSPFv2 with the network Command

OSPF configuration starts with a routing process. The command router ospf process-id creates the process and moves you to router configuration mode. The process ID is a number from 1 to 65535 that is locally significant: it identifies the process inside this router only, and it does not need to match on neighbors.

You must also tell OSPF which interfaces belong to it. The traditional way is the network command:

R1(config-router)# network address wildcard-mask area area-id

The network command does not directly say "advertise this network"; it is an interface selector. For every interface on the router, IOS compares the interface's IP address against the address and wildcard mask in the statement. If the interface address matches, OSPF is enabled on that interface: the router starts sending hellos out of it, tries to form neighbors there, and advertises the interface's connected subnet (using the interface's real subnet mask, not the wildcard) in its router LSA.

22.2.1 How wildcard matching works

A wildcard mask is read bit by bit. A 0 bit means "this bit of the interface address must match the same bit in the statement's address". A 1 bit means "ignore this bit". So 0.0.0.255 requires the first three octets to match and accepts any value in the fourth, and 0.0.0.0 requires an exact match of the whole address. Figure 22-2 shows the comparison IOS makes for two interfaces on R1 against the statement network 10.1.12.0 0.0.0.3 area 0 . Statement: network 10.1.12.0 0.0.0.3 area 0

  • octet 1 octet 2 octet 3 octet 4
  • Statement address 00001010 00000001 00001100 000000 00
  • Wildcard 0.0.0.3 00000000 00000000 00000000 000000 11
  • 0 bits = must match (first 30 bits) 1 bits = ignore
  • G0/0 10.1.12.1 00001010 00000001 00001100 000000 01
  • First 30 bits identical: MATCH, OSPF enabled on G0/0
  • G0/1 10.1.13.1 00001010 00000001 00001101 000000 01
  • Bit 24 differs where the wildcard says "must match": NO MATCH

Figure 22-2 Wildcard matching for a network statement. Only the bits under a wildcard 1 may differ.

22.2.2 Worked examples

Because the network command only selects interfaces, there are many correct ways to enable the same set of interfaces. Table 22-1 tests five statements against R1's interfaces.

Table 22-1 Which R1 interfaces does each network statement enable?

The last row is quick in a lab but here would send hellos to the ISP. Prefer statements that match only what you intend, such as the exact interface address with wildcard 0.0.0.0 . The wildcard in a network statement does not have to equal the inverse of the interface's subnet mask. network 10.1.12.1 0.0.0.0 area 0 on a /30 interface is perfectly valid, and OSPF still advertises 10.1.12.0/30. If a question asks what OSPF advertises, use the interface's mask, not the wildcard. If two statements match the same interface, the most specific match (longest run of zero bits) decides the area.

22.2.3 Configuring R1

Here is a complete OSPF configuration for R1 using network statements. The ISP link is deliberately left out.

R1(config)# interface loopback0
R1(config-if)# ip address 1.1.1.1 255.255.255.255
R1(config-if)# exit
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 1.1.1.1 0.0.0.0 area 0 ! loopback 0
R1(config-router)# network 10.1.12.0 0.0.0.3 area 0 ! G0/0 to R2
R1(config-router)# network 10.1.13.0 0.0.0.3 area 0 ! G0/1 to R3
R1(config-router)# network 192.168.1.0 0.0.0.255 area 0 ! G0/3 user LAN
R1(config-router)# passive-interface GigabitEthernet0/3

R1 now multicasts hellos to 224.0.0.5 on each matching interface. Once R2 and R3 are configured, a syslog message such as %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done confirms each adjacency.

22.3 Enabling OSPF on the Interface

IOS also lets you skip the wildcard arithmetic entirely and enable OSPF directly in interface configuration mode:

R2(config)# router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)# exit
R2(config)# interface loopback0
R2(config-if)# ip ospf 1 area 0
R2(config-if)# interface GigabitEthernet0/0
R2(config-if)# ip ospf 1 area 0
R2(config-if)# interface GigabitEthernet0/1
R2(config-if)# ip ospf 1 area 0

The command ip ospf process-id area area-id enables OSPF on exactly that interface. If the process does not yet exist, IOS creates it. The result is identical to a matching network statement: hellos, neighbors and advertisement of the connected subnet. If both methods would place an interface into OSPF, the interface command takes precedence. You can tell which method enabled an interface from show ip ospf interface , which says either "Attached via Network Statement" or "Attached via Interface Enable".

R3 and R4 complete the topology. R3 uses network statements with exact-match wildcards; R4 uses interface commands plus a passive user LAN.

! R3

R3(config)# router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)# network 3.3.3.3 0.0.0.0 area 0
R3(config-router)# network 10.1.13.2 0.0.0.0 area 0
R3(config-router)# network 10.1.234.3 0.0.0.0 area 0
! R4
R4(config)# router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)# passive-interface GigabitEthernet0/1
R4(config-router)# interface range loopback0, GigabitEthernet0/0 - 1
R4(config-if-range)# ip ospf 1 area 0

To see which interfaces run OSPF, use show ip ospf interface brief (Figure 22-6). Its State column shows the router's role on each interface ( DR , BDR , DROTH , P2P or LOOP ) and Nbrs F/C shows full neighbors over total neighbors. On R2 at this point, G0/0 would surprisingly show BDR : Ethernet defaults to the broadcast network type even with only two routers attached. Section 22.6 fixes that.

22.4 The OSPF Router ID

Every OSPF router needs a unique 32-bit router ID (RID), written in dotted decimal. The RID identifies the router in hellos, in the neighbor table and as the advertising router of its LSAs. When the OSPF process starts, IOS picks the RID using this order:

  • 1. The value configured with the router-id command in router configuration mode.
  • 2. Otherwise, the highest IPv4 address on any loopback interface that is up.
  • 3. Otherwise, the highest IPv4 address on any other interface that is up.

"Highest" means numerically largest, and the interfaces need not be OSPF-enabled. If no interface has an IPv4 address and no RID is configured, the process cannot start and IOS logs %OSPF-4-NORTRID: OSPF process 1 failed to allocate unique router-id and cannot start . The RID is chosen once, when the process starts. Changing the router-id command or adding a higher loopback afterwards has no effect until the process restarts, which you trigger with clear ip ospf process . This resets all adjacencies on the router, so do it in a maintenance window.

R3(config-router)# router-id 33.33.33.33

% OSPF: Reload or use "clear ip ospf process" command, for this to take effect

R3# clear ip ospf process

Reset ALL OSPF processes? [no]: yes

22.5 Verifying Neighbors and DR/BDR Election

show ip ospf neighbor is the single most useful OSPF command. Each line is one neighbor, identified by its RID, with the priority, the adjacency state combined with the neighbor's role on the segment, the time remaining before the dead timer expires, the neighbor's interface address, and the local interface.

R2 — console

R2# show ip ospf neighbor
  • Neighbor ID Pri State Dead Time Address Interface
  • 4.4.4.4 1 FULL/DR 00:00:37 10.1.234.4 GigabitEthernet0/1
  • 3.3.3.3 1 FULL/BDR 00:00:34 10.1.234.3 GigabitEthernet0/1
  • 1.1.1.1 1 FULL/DR 00:00:31 10.1.12.1 GigabitEthernet0/0

Figure 22-3 R2's neighbors with default priorities. R4 (highest RID) is DR on the shared LAN, R3 is BDR.

The State column has two parts separated by a slash. The part before the slash is the adjacency state (FULL, 2WAY, EXSTART and so on). The part after the slash is the neighbor's role on that segment, not the local router's. So FULL/DR next to 4.4.4.4 means "I am fully adjacent with 4.4.4.4, and 4.4.4.4 is the DR". On a point-to-point network type there is no role, and the column shows FULL/ - .

22.5.1 How the election played out

On a broadcast segment, the router with the highest interface priority becomes DR; ties are broken by the highest RID. The second-best router becomes BDR. All three routers on 10.1.234.0/24 have the default priority of 1, so RID decides: 4.4.4.4 wins DR and 3.3.3.3 becomes BDR. R2 is a DROther. On the R1–R2 link, still using the broadcast type, R1 (1.1.1.1) and R2 (2.2.2.2) also held an election, which R1 won, but only because it came up first (see the next section).

  • R2 2.2.2.2 R3 3.3.3.3 R4 4.4.4.4
  • 10.1.234.0/24
  • priority 1
  • DROther
  • priority 1

Bdr

priority 1

DR

  • 1. Highest priority wins (0 = never DR/BDR). 2. Tie: highest router ID wins.
  • 3. The election is not preemptive: a better router arriving later waits for a failure.

Figure 22-4 DR/BDR election on the shared segment with default priorities.

DROthers form FULL adjacencies only with the DR and BDR. Between two DROthers the adjacency stops at 2WAY, which is normal and healthy. If a fourth router joined SW1, you would see 2WAY/DROTHER for it on R2. Do not mistake 2WAY/DROTHER for a fault.

22.5.2 Influencing the election with ip ospf priority

Suppose the network team wants R2, which has the most CPU and memory, to be the DR on the shared LAN, and never wants R4 to hold either role. Priority is set per interface, from 0 to 255:

R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip ospf priority 100
R4(config)# interface GigabitEthernet0/0
R4(config-if)# ip ospf priority 0 ! R4 can never be DR or BDR here

Nothing changes immediately. The DR election is non-preemptive: once a DR exists, a higher-priority router does not take over until the current DR fails or the OSPF process on the segment restarts. Setting R4's priority to 0 does make it resign at once, though, because a priority-0 router is ineligible. R3, the BDR, is promoted to DR and a new BDR election picks R2. To see the intended final result, clear the OSPF process on R3 so that R2 can take over as DR.

R2 — console

R2# show ip ospf interface GigabitEthernet0/1

GigabitEthernet0/1 is up, line protocol is up

Internet Address 10.1.234.2/24, Area 0, Attached via Interface Enable Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1 Transmit Delay is 1 sec, State DR, Priority 100

Designated Router (ID) 2.2.2.2, Interface address 10.1.234.2

Backup Designated router (ID) 3.3.3.3, Interface address 10.1.234.3 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Neighbor Count is 2, Adjacent neighbor count is 2

Adjacent with neighbor 3.3.3.3 (Backup Designated Router)

Adjacent with neighbor 4.4.4.4

Figure 22-5 show ip ospf interface after the priority change: R2 is now DR, R3 BDR.

This one command shows the area, how OSPF was enabled, network type, cost, state, priority, DR, BDR and timers.

Exam alert

Three DR/BDR facts appear constantly: the default priority is 1; priority 0 means the router never becomes DR or BDR; and the election is non-preemptive. A question that raises a router's priority and then asks "who is the DR now?" usually expects the answer "the existing DR, until it fails or OSPF is reset".

22.6 Point-to-Point Network Type

An Ethernet link between two routers is physically point-to-point, but OSPF treats it as broadcast by default. That works but wastes effort: the routers wait up to 40 seconds for a DR election and the DR generates an unnecessary network LSA. The point-to-point type removes the election:

R1(config)# interface range GigabitEthernet0/0 - 1
R1(config-if-range)# ip ospf network point-to-point
R2(config)# interface GigabitEthernet0/0
R2(config-if)# ip ospf network point-to-point
R3(config)# interface GigabitEthernet0/0
R3(config-if)# ip ospf network point-to-point

Configure both ends. With broadcast on one side and point-to-point on the other, the timers still match, so the neighbors may reach FULL, but each describes the link differently in its LSA and routes go missing.

R1 — console

R1# show ip ospf neighbor
  • Neighbor ID Pri State Dead Time Address Interface
  • 3.3.3.3 0 FULL/ - 00:00:39 10.1.13.2 GigabitEthernet0/1
  • 2.2.2.2 0 FULL/ - 00:00:35 10.1.12.2 GigabitEthernet0/0
R1# show ip ospf interface brief
  • Interface PID Area IP Address/Mask Cost State Nbrs F/C
  • Lo0 1 0 1.1.1.1/32 1 LOOP 0/0
  • Gi0/3 1 0 192.168.1.1/24 1 DR 0/0
  • Gi0/1 1 0 10.1.13.1/30 1 P2P 1/1
  • Gi0/0 1 0 10.1.12.1/30 1 P2P 1/1

Figure 22-6 After changing the network type, R1's neighbors show no DR/BDR role and the interface state is P2P.

Priority shows 0 for point-to-point neighbors and the state ends with a dash. The passive LAN G0/3 shows DR with zero neighbors: a router alone on a broadcast segment elects itself, which is harmless.

For reference: broadcast (default on Ethernet) and point-to-point (default on serial HDLC/PPP links) both use 10-second hellos and a 40-second dead interval; only broadcast elects a DR. The legacy non-broadcast (NBMA) type also elects a DR but uses 30/120-second timers.

22.7 Passive Interfaces

R1's G0/3 and R4's G0/1 lead to user LANs. Their subnets must be advertised, but sending hellos there is pointless and risky: a rogue device could form an adjacency and inject routes. A passive interface:

stops sending OSPF hellos, and ignores any it receives, so no neighbor can form on it; still has its connected subnet advertised in the router LSA.

On routers with many LAN interfaces, it is easier to make everything passive and then enable only the router-facing links:

R4(config)# router ospf 1
R4(config-router)# passive-interface default
R4(config-router)# no passive-interface GigabitEthernet0/0 ! the link toward SW1 needs
neighbors

Loopback interfaces never send hellos anyway, so they do not need to be marked passive. Confirm passive interfaces with show ip protocols (Figure 22-7) or the line "No Hellos (Passive interface)" in show ip ospf interface .

R4 — console

R4# show ip protocols

Figure 22-7 show ip protocols on R4: RID, interfaces enabled with ip ospf , passive interfaces and the routers that supplied routes.

With network statements, "Routing for Networks" lists each statement as configured, the best place to spot a mistyped wildcard. "Maximum path: 4" is the default number of equal-cost paths.

22.8 Advertising a Default Route

Rather than configuring static defaults on R2, R3 and R4, give R1 a default route and let OSPF distribute it:

R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
R1(config)# router ospf 1
R1(config-router)# default-information originate

default-information originate makes R1 an autonomous system boundary router (ASBR) that floods a type 5 external LSA for 0.0.0.0/0. By default it advertises the route only while R1 itself has a default route in its routing table, so if the static route is removed (for example because the ISP interface fails), the advertisement is withdrawn and the other routers stop sending Internet traffic to a dead end. Adding the keyword always advertises the default regardless, which is rarely what you want on a single-exit network. The other routers learn the route as O*E2 : an OSPF external type 2 route with a default metric of 1, and the asterisk marks it as the candidate default.

22.9 Verifying OSPF Routes and the LSDB

With every router configured, R4 should have routes to every subnet in the topology. show ip route ospf filters the routing table to OSPF-learned routes.

R4 — console

R4# show ip route ospf

Codes: L - local, C - connected, S - static, O - OSPF, E2 - OSPF external type 2 (remaining codes omitted)

Gateway of last resort is 10.1.234.3 to network 0.0.0.0

O*E2 0.0.0.0/0 [110/1] via 10.1.234.3, 00:03:12, GigabitEthernet0/0 [110/1] via 10.1.234.2, 00:03:12, GigabitEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/3] via 10.1.234.3, 00:18:40, GigabitEthernet0/0 [110/3] via 10.1.234.2, 00:18:40, GigabitEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/2] via 10.1.234.2, 00:18:40, GigabitEthernet0/0 3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.3 [110/2] via 10.1.234.3, 00:18:40, GigabitEthernet0/0 10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks

O 10.1.12.0/30 [110/2] via 10.1.234.2, 00:18:40, GigabitEthernet0/0 O 10.1.13.0/30 [110/2] via 10.1.234.3, 00:18:40, GigabitEthernet0/0 O 192.168.1.0/24 [110/3] via 10.1.234.3, 00:18:40, GigabitEthernet0/0 [110/3] via 10.1.234.2, 00:18:40, GigabitEthernet0/0

Figure 22-8 R4's OSPF routes. Two equal-cost paths exist to R1's networks, so both are installed.

Each route shows [administrative distance/metric] . OSPF's administrative distance is 110 and the metric is the total cost of the outgoing interfaces along the path, ending with the cost of the destination subnet's own interface. To reach 192.168.1.0/24, R4 pays 1 (its G0/0) + 1 (R2's or R3's G0/0 toward R1) + 1 (R1's G0/3) = 3. Both paths cost 3, so both are installed. E2 routes keep the ASBR's metric (1) everywhere.

show ip ospf database shows one router LSA (type 1) per router, one network LSA (type 2) per segment with a DR and neighbors, and external LSAs (type 5).

R4# show ip ospf database
  • OSPF Router with ID (4.4.4.4) (Process ID 1)
  • Router Link States (Area 0)
  • Link ID ADV Router Age Seq# Checksum Link count
  • 1.1.1.1 1.1.1.1 196 0x80000008 0x00A61C 6
  • 2.2.2.2 2.2.2.2 201 0x80000007 0x003FE2 4
  • 3.3.3.3 3.3.3.3 199 0x80000009 0x00F10B 4
  • 4.4.4.4 4.4.4.4 1113 0x80000005 0x0052A7 3
  • Net Link States (Area 0)
  • Link ID ADV Router Age Seq# Checksum
  • 10.1.234.2 2.2.2.2 1102 0x80000003 0x00B0C4
  • Type-5 AS External Link States
  • Link ID ADV Router Age Seq# Checksum Tag
  • 0.0.0.0 1.1.1.1 192 0x80000001 0x00D7E4 1

Figure 22-9 R4's LSDB: four router LSAs, one network LSA for the shared LAN (advertised by the DR, R2) and R1's external default route.

Every router in the area holds an identical database. The network LSA's Link ID is the DR's interface address. R1's link count of 6 is two stubs (loopback, G0/3) plus two links per point-to-point interface.

22.10 Tuning OSPF Cost

OSPF computes the default cost of an interface as reference bandwidth ÷ interface bandwidth, with a minimum of 1. The default reference is 100 Mbps, so FastEthernet and anything faster all cost 1.

Raising the reference to 100,000 Mbps (100 Gbps) restores useful differences: Ethernet (10 Mbps) costs 10,000, FastEthernet 1,000, GigabitEthernet 100 and 10-Gigabit 10. There are three ways to change cost, from broadest to most specific:

  • 1. auto-cost reference-bandwidth mbps in router mode changes the reference for every interface on that router. Configure the same value on every router in the domain, or routers will compute inconsistent costs. IOS reminds you: % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers.
  • 2. bandwidth kbps in interface mode changes the bandwidth value that OSPF (and other features) divide into. It does not change the real speed of the link.
  • 3. ip ospf cost 1-65535 in interface mode sets the cost directly, overriding the calculation. Suppose R4 should reach R1's networks via R3 and use R2 only as a backup. Raising the cost on R2's G0/0 (outbound from R2 toward R1) breaks the tie: the path via R2 now costs 1 + 10 + 1 = 12, while the path via R3 still costs 3, so R4 installs only the R3 path. Cost counts only outgoing interfaces, and the two ends of a link may have different costs.
R2(config)# interface GigabitEthernet0/0
R2(config-if)# ip ospf cost 10

22.11 Hello and Dead Timers

Neighbors declare each other dead if no hello arrives within the dead interval. Defaults on broadcast and point-to-point networks are 10 and 40 seconds; lower values detect failures faster. Set them per interface:

R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip ospf hello-interval 5
R1(config-if)# ip ospf dead-interval 20

If you change only the hello interval, IOS automatically sets the dead interval to four times the new hello value. The timers must match on both ends, or the adjacency drops (Section 22.12).

Ospfv3 in brief

OSPFv3 carries IPv6 routes using the same neighbor states, areas, DR/BDR election, cost and SPF as OSPFv2. It still uses a 32-bit dotted-decimal router ID, so a router with no IPv4 addresses needs router-id configured under ipv6 router ospf 1 . There is no network command: after ipv6 unicast-routing , you enable it per interface with ipv6 ospf 1 area 0 , and verify with show ipv6 ospf neighbor and show ipv6 route ospf . Neighbors are identified by link-local addresses. The CCNA blueprint asks you to configure only OSPFv2, so recognition is enough here.

22.12 Troubleshooting OSPF Adjacencies

When routes are missing, start with the neighbor table. An absent or stuck neighbor almost always traces to a parameter in Table 22-2; routers silently discard hellos that do not match. Remember the pattern: no neighbor means a hello parameter or passive interface; stuck in EXSTART/EXCHANGE means MTU; FULL but routes missing means a network-type mismatch.

Table 22-2 What must match (or differ) for OSPFv2 neighbors

  • Requirement Symptom when violated
  • Interfaces in the same subnet (and same mask on
  • broadcast networks)
  • No neighbor; debug shows mismatched
  • mask

Same area ID on the link No neighbor; %OSPF-4-ERRRCV "mismatched area ID"

Same hello and dead intervals No neighbor, or neighbor flaps then disappears

Same authentication settings (if used) No neighbor; "Mismatched Authentication type"

  • Same stub-area flag No neighbor (not common in single-area
  • designs)
  • Matching IP MTU Neighbor stuck in EXSTART or EXCHANGE
  • Unique router IDs %OSPF-4-DUP_RTRID_NBR ; no adjacency or
  • unstable routes
  • Interface not passive No hellos sent, no neighbor

Same network type (not checked in hellos) FULL adjacency but missing or wrong routes Each scenario below breaks the working lab with one fault. Name the cause from the symptom before reading the fix.

22.12.1 Scenario 1: Mismatched area

A colleague re-enabled OSPF on R3's G0/0 with the wrong area. R1 no longer lists 3.3.3.3 as a neighbor and the console shows repeated errors.

R1 — console

R1#

%OSPF-4-ERRRCV: Received invalid packet: mismatched area ID from backbone area must be virtual-link but not found from 10.1.13.2, GigabitEthernet0/1

R3# show ip ospf interface brief
  • Interface PID Area IP Address/Mask Cost State Nbrs F/C
  • Lo0 1 0 3.3.3.3/32 1 LOOP 0/0
  • Gi0/1 1 0 10.1.234.3/24 1 BDR 2/2
  • Gi0/0 1 1 10.1.13.2/30 1 P2P 0/0

Figure 22-10 Area mismatch: R1 rejects hellos from R3, and R3's G0/0 is in area 1.

Fix: put the interface back in area 0 on R3: interface g0/0 , ip ospf 1 area 0 (or correct the network statement). Ignore the virtual-link wording in the message.

22.12.2 Scenario 2: Hello and dead timer mismatch

Someone set R1's G0/1 to 5/20 timers but forgot R3. Forty seconds later the neighbor goes down and never returns. Timer mismatches produce no log message by default, so use debug ip ospf hello or compare show ip ospf interface on both ends.

R1 — console

%OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down:

Dead timer expired

R1# debug ip ospf hello

OSPF hello debugging is on

OSPF-1 HELLO Gi0/1: Rcv hello from 3.3.3.3 area 0 10.1.13.2

OSPF-1 HELLO Gi0/1: Mismatched hello parameters from 10.1.13.2 OSPF-1 HELLO Gi0/1: Dead R 40 C 20, Hello R 10 C 5

R1# undebug all

Figure 22-11 Timer mismatch. "R" is the value received from the neighbor, "C" is the value configured locally.

Fix: make both ends match, either by applying the same ip ospf hello-interval and ip ospf dead-interval on R3 or by removing them on R1 with the no form.

22.12.3 Scenario 3: Different subnets or masks

R2's G0/0 was readdressed as 10.1.12.2 255.255.255.0 while R1 still uses /30. In the broadcast network type, the subnet mask carried in the hello must match, so R1 discards R2's hellos (and vice versa). Even when masks match, two interfaces in different subnets will not become neighbors.

R1# debug ip ospf hello

OSPF-1 HELLO Gi0/0: Rcv hello from 2.2.2.2 area 0 10.1.12.2

OSPF-1 HELLO Gi0/0: Mismatched hello parameters from 10.1.12.2 OSPF-1 HELLO Gi0/0: Dead R 40 C 40, Hello R 10 C 10 Mask R 255.255.255.0 C 255.255.255.252 Fix: correct the address or mask so both interfaces share 10.1.12.0/30. Compare show running-config interface on both ends.

22.12.4 Scenario 4: MTU mismatch, stuck in EXSTART

R4's G0/0 has ip mtu 1400 while R2 and R3 use 1500. Hellos do not carry MTU, so the neighbors pass 2WAY and the DR election. The MTU is checked in the database description (DBD) packets exchanged next. A router receiving a DBD advertising a larger MTU than its own interface rejects it, so the exchange never completes.

R2# show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface

4.4.4.4 0 EXSTART/DROTHER 00:00:33 10.1.234.4 GigabitEthernet0/1 3.3.3.3 1 FULL/BDR 00:00:38 10.1.234.3 GigabitEthernet0/1

1.1.1.1 0 FULL/ - 00:00:36 10.1.12.1 GigabitEthernet0/0

R2#

%OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/1 from EXSTART to DOWN, Neighbor Down:

Too many retransmissions

Figure 22-12 An MTU mismatch leaves the neighbor cycling through EXSTART (or EXCHANGE) and DOWN.

Fix: make the IP MTU match on all routers on the segment ( no ip mtu on R4). As a workaround, ip ospf mtu-ignore on the interface tells OSPF to skip the check, but large packets may still be dropped on the data plane, so correcting the MTU is the real solution.

22.12.5 Scenario 5: Duplicate router ID

R2 was built from a copy of R1's configuration, including router-id 1.1.1.1 . Both routers now claim the same identity.

R1#

%OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 1.1.1.1 from 10.1.12.2 on interface GigabitEthernet0/0

Fix: on R2, configure router-id 2.2.2.2 and run clear ip ospf process . When duplicate RIDs exist on routers that are not directly connected, there is no neighbor error; instead each router keeps overwriting the other's router LSA, and you see routes flapping and the log message %OSPF-4-FLOOD_WAR .

22.12.6 Scenario 6: Passive interface on a router link

A technician applied passive-interface default on R3 to protect a new user LAN but forgot to re-enable the router links. All of R3's neighbors disappeared at once, yet R3's interfaces show no errors.

R3# show ip ospf neighbor
R3#
R3# show ip ospf interface GigabitEthernet0/0 | include Passive|Hello

No Hellos (Passive interface)

R3# show ip protocols | section Passive
  • Passive Interface(s):
  • GigabitEthernet0/0
  • GigabitEthernet0/1
  • GigabitEthernet0/2
  • Loopback0

Fix: no passive-interface GigabitEthernet0/0 and no passive-interface GigabitEthernet0/1 under router ospf 1 .

LAB Build and Verify Single-Area OSPFv2

Goal: Configure the Figure 22-1 topology so that every router reaches every subnet, R2 is the DR on the shared LAN, the R1 links use the point-to-point type, user LANs are passive, R1 advertises a default route, and costs reflect a 100 Gbps reference bandwidth. Topology: Figure 22-1, with IP addresses and loopbacks already configured. Steps:

  • 1. On every router, create router ospf 1 , set router-id to the loopback address and set auto-cost reference-bandwidth 100000 .
  • 2. On R1 and R3, enable OSPF with network statements using the 0.0.0.0 wildcard and the exact interface address. On R2 and R4, use ip ospf 1 area 0 on each interface. Do not include R1's G0/2.
  • 3. On R1 G0/0, R1 G0/1, R2 G0/0 and R3 G0/0, configure ip ospf network point-to-point .
  • 4. On R2 G0/1 set ip ospf priority 100 ; on R4 G0/0 set ip ospf priority 0 . Then run clear ip ospf process on R3 and R4 so the election reflects the new priorities.
  • 5. Make R1 G0/3 and R4 G0/1 passive (on R4 use passive-interface default and re-enable G0/0).
  • 6. On R1, add ip route 0.0.0.0 0.0.0.0 203.0.113.1 and default-information originate . Verify: On R2, show ip ospf interface brief should show G0/0 as P2P with cost 100 and G0/1 as DR. On R4:

R4 — console

R4# show ip ospf neighbor
  • Neighbor ID Pri State Dead Time Address Interface
  • 2.2.2.2 100 FULL/DR 00:00:38 10.1.234.2 GigabitEthernet0/0
  • 3.3.3.3 1 FULL/BDR 00:00:33 10.1.234.3 GigabitEthernet0/0
R4# show ip route ospf | include 192.168.1|0.0.0.0

O*E2 0.0.0.0/0 [110/1] via 10.1.234.3, 00:01:05, GigabitEthernet0/0 O 192.168.1.0/24 [110/300] via 10.1.234.3, 00:01:05, GigabitEthernet0/0 [110/300] via 10.1.234.2, 00:01:05, GigabitEthernet0/0

Figure 22-13 Lab verification on R4: R2 is DR, and the cost to R1's LAN is 100 + 100 + 100 with the new reference bandwidth.

Expected results: R4 has two neighbors (DR and BDR) and appears as DROTHER with priority 0 in their tables. The metric to 192.168.1.0/24 is 300 (three Gigabit interfaces at cost 100). Pings from R4's LAN to R1's LAN and to 203.0.113.1 succeed.

  • Key terms
  • OSPF process ID
  • network command
  • router ID
  • designated router

Bdr

Exstart

MTU mismatch

Review questions

  • 1. Which network statement enables OSPF on an interface with address 172.16.5.9/29 and on no other interface in the 172.16.0.0/16 range?
  • A. network 172.16.5.0 0.0.0.255 area 0
  • B. network 172.16.5.8 0.0.0.7 area 0
  • C. network 172.16.5.8 255.255.255.248 area 0
  • D. network 172.16.0.0 0.0.255.255 area 0
  • 2. A router has no router-id command. Its interfaces are G0/0 10.10.10.1 (up), G0/1 192.168.50.1 (up), Loopback0 10.255.255.1 (up) and Loopback1 172.16.1.1 (administratively down). What is its OSPF router ID?
  • A. 192.168.50.1
  • B. 172.16.1.1
  • C. 10.255.255.1
  • D. 10.10.10.1
  • 3. In show ip ospf neighbor on R5 you see 2WAY/DROTHER for neighbor R6 on an Ethernet segment. What does this indicate?
  • A. An MTU mismatch between R5 and R6
  • B. Normal operation if both R5 and R6 are DROthers
  • C. R6 has priority 0 and cannot form adjacencies
  • D. Hello timers do not match
  • 4. Which two statements about the DR election are true? (Choose two.)
  • A. The router with the lowest RID wins a priority tie.
  • B. A priority of 0 prevents a router from becoming DR or BDR.
  • C. A newly added router with a higher priority immediately becomes DR.
  • D. The default interface priority is 1.
  • E. The DR is elected per area rather than per segment.
  • 5. Two routers connected by one Ethernet link should not elect a DR. Which interface command achieves this?
  • A. ip ospf priority 0
  • B. ip ospf network point-to-point
  • C. passive-interface
  • D. ip ospf network broadcast
  • 6. What is the effect of passive-interface GigabitEthernet0/2 under router ospf 1 ?
  • A. OSPF stops advertising the G0/2 subnet.
  • B. G0/2 sends hellos but ignores replies.
  • C. G0/2 sends no hellos and forms no neighbors, but its subnet is still advertised.
  • D. G0/2 is removed from the routing table.
  • 7. R1 has default-information originate configured but no default route of its own. What do the other OSPF routers receive?
  • A. An O*E2 default route with metric 1
  • B. An O*IA default route
  • C. No default route
  • D. A static default route pointing to R1
  • 8. Which two commands change the OSPF cost of an interface? (Choose two.)
  • A. ip ospf cost 50
  • B. ip ospf priority 50
  • C. bandwidth 50000
  • D. ip ospf hello-interval 50
  • E. speed 100
  • 9. R1's G0/0 has ip ospf hello-interval 5 . The neighbor uses defaults. What happens?
  • A. No adjacency forms, because R1's dead interval also changes to 20 and neither timer matches.
  • B. They become neighbors because only the dead interval must match.
  • C. They become neighbors but R1 is always DR.
  • D. R1 adopts the neighbor's timers automatically.
  • 10. Two OSPF neighbors remain in the EXSTART state. What is the most likely cause?
  • A. Area mismatch
  • B. Mismatched IP MTU
  • C. Hello timer mismatch
  • D. Different process IDs
  • 11. Which two parameters must match for two routers on the same Ethernet segment to become OSPF neighbors? (Choose two.)
  • A. Process ID
  • B. Area ID
  • C. Router ID
  • D. Subnet mask
  • E. Interface cost
  • 12. Which command shows, for one interface, the network type, the hello and dead timers and the current DR?
  • A. show ip ospf neighbor
  • B. show ip ospf database
  • C. show ip ospf interface g0/1
  • D. show ip protocols

Answers

  • 1. B. 172.16.5.8 with wildcard 0.0.0.7 matches 172.16.5.8–15, which contains .9. A and D match too much; C wrongly uses a subnet mask.
  • 2. C. Without a manual RID, the highest address on an up loopback wins. Loopback1 is down, so 10.255.255.1 wins.
  • 3. B. DROthers stay at 2WAY with each other.
  • 4. B, D. Priority 0 means ineligible, and the default is 1. The election is non-preemptive and per segment.
  • 5. B. The point-to-point network type has no DR/BDR election.
  • 6. C. Passive interfaces suppress hellos and adjacencies but remain advertised.
  • 7. C. Without always , a default is advertised only if one is in the routing table.
  • 8. A, C. ip ospf cost sets the cost directly; bandwidth changes the divisor.
  • 9. A. Changing only the hello interval sets the dead interval to four times the hello (20).
  • 10. B. MTU is checked in DBD exchange,, after 2WAY.
  • 11. B, D. Area and subnet mask (on broadcast networks) are checked in hellos. Process IDs are local.
  • 12. C. It shows network type, timers and DR.
Use ← → to move between sections