SkarpSkarp

Chapter 16 of 29

OSPFv2 Configuration and Troubleshooting on Cisco Routers

Configure single-area OSPFv2 on Cisco routers, bring neighbors to the full state, and fix common adjacency and routing issues you will see on the exam.

27 min readen

Big Picture: What You Will Do With OSPFv2

From Theory to Practice

Here you will move from OSPFv2 concepts to hands-on skills: configuring routers, forming neighbors, and fixing broken adjacencies that appear on CCNA-style labs.

OSPFv2 Refresher

Recall: OSPFv2 is a link-state interior gateway protocol used to exchange IPv4 routing information within a single autonomous system. We now apply this with Cisco IOS commands.

Single-Area Focus

We focus on single-area OSPFv2 (area 0): choosing router IDs, using `router ospf` and `network` statements, setting interface OSPF, and interpreting neighbor states like FULL.

Troubleshooting Mindset

You will learn a simple workflow: check interfaces, verify OSPF parameters, inspect neighbors, then confirm routes. This sequence maps closely to CCNA exam tasks.

OSPFv2 Router ID: How It Is Chosen and How To Control It

What Is the Router ID?

The OSPF router ID is a 32-bit value written like an IPv4 address that uniquely identifies a router in the OSPF domain. It appears in LSAs and neighbor tables.

How Cisco Chooses It

Order of preference: 1) Manual `router-id` command, 2) Highest IPv4 on an up loopback, 3) Highest IPv4 on any up non-loopback interface.

Setting It Manually

Use `router ospf 1` then `router-id 1.1.1.1`. If you change it later, you must restart the OSPF process with `clear ip ospf process` for the new ID to apply.

Verifying and Exam Traps

Use `show ip protocols` or `show ip ospf`. Exam questions often hide that the RID comes from the highest interface IP because no explicit router ID was set.

Enabling Single-Area OSPFv2 with Network Statements

Network Statement Basics

Under `router ospf`, the `network` command both selects interfaces (by IP + wildcard) and assigns them to an OSPF area, usually area 0 in single-area designs.

Process ID and Local Scope

The process ID in `router ospf 1` is locally significant on Cisco. It does not need to match on neighboring routers for OSPFv2 to form adjacencies.

Wildcard Masks Refresher

Wildcard masks are inverse masks: `0.0.0.0` matches one IP, `0.0.0.255` matches a /24. Use them to select which interfaces run OSPF.

Verification Commands

Use `show ip ospf interface brief` to see which interfaces run OSPF and `show ip protocols` to confirm your configured network statements.

Hands-On: Building a Simple Single-Area OSPFv2 Topology

Topology Overview

Three routers in a line: R1-R2-R3. Links: 10.1.12.0/24 between R1-R2, 10.1.23.0/24 between R2-R3. Loopbacks 1.1.1.1, 2.2.2.2, 3.3.3.3 as router IDs.

Configuring Loopbacks

On each router, create a loopback with a /32 address. Example on R1: `interface lo0`, `ip address 1.1.1.1 255.255.255.255`, `no shutdown`.

Enabling OSPFv2

On each router, use `router ospf 1`, set `router-id`, and add `network` statements for the transit links and loopbacks, all in area 0.

Verifying Success

On R2, `show ip ospf neighbor` should list R1 and R3 as FULL. `show ip route ospf` should show OSPF routes for each loopback network.

OSPFv2 Neighbor States and How to Read Them

Viewing Neighbor States

Use `show ip ospf neighbor` to see each neighbor's router ID, state, dead timer, and the interface used for the adjacency.

Core States to Know

Important states: DOWN, INIT, 2WAY, EXSTART, EXCHANGE, LOADING, FULL. FULL means LSDBs are synchronized and routing can work.

2WAY vs FULL

On point-to-point links, neighbors should be FULL. On broadcast Ethernet, non-DR/BDR neighbors may stay 2WAY with each other and that is normal.

Common Exam Traps

Do not assume 2WAY is always broken; context matters. Neighbors stuck in EXSTART or EXCHANGE often signal MTU or other configuration mismatches.

Passive Interfaces and Controlling OSPF Hello Traffic

Why Passive Interfaces?

Use passive interfaces when you want to advertise a network into OSPF but do not want to send or receive OSPF Hellos on that interface.

Configuring Passive

Under `router ospf`, use `passive-interface g0/1` to stop Hellos on that interface while still advertising its connected network.

Passive by Default Pattern

You can use `passive-interface default` then `no passive-interface g0/0` to make all interfaces passive except specific uplinks.

Exam Gotchas

A passive interface prevents neighbor formation but not route advertisement. Watch for neighbors missing because one side is passive.

Basic OSPFv2 Troubleshooting Workflow

Step 1: Check Basics

Start with `show ip interface brief` and `ping` to confirm interfaces are up/up and IP addressing and basic connectivity are correct.

Step 2: Is OSPF Running?

Use `show ip ospf interface brief` to verify OSPF is enabled on the right interfaces and they are in the intended area, usually area 0.

Step 3: Neighbors and Passives

Check `show ip ospf neighbor` for expected neighbors and states, and review `passive-interface` settings and area IDs on both ends of each link.

Step 4: Routes and Testing

Confirm OSPF routes with `show ip route ospf`, then test end-to-end with `ping` and `traceroute` to find where traffic stops.

Fixing Common OSPFv2 Issues: Area, Timers, Network Type, Passive

Problem 1: Area Mismatch

If two routers on the same link are in different OSPF areas, they will not become neighbors. Ensure both ends use the same area ID, usually area 0.

Problem 2: Timer Mismatch

On broadcast and point-to-point networks, Hello and Dead timers must match. Custom intervals on one side can prevent neighbors from forming.

Problem 3: Network Type

Mismatched OSPF network types (e.g., point-to-point vs broadcast) can leave neighbors stuck in INIT or EXSTART. Set the same type on both ends.

Problem 4: Passive Interface

If an interface is passive, the router advertises the network but does not send Hellos, so no neighbor forms. Remove passive on transit links.

Thought Exercise: Diagnose an OSPFv2 Adjacency Problem

Work through this mental troubleshooting scenario step by step.

Scenario

You have two routers, R1 and R2, connected on G0/0 with network 192.168.10.0/24.

  • R1 G0/0: 192.168.10.1/24
  • R2 G0/0: 192.168.10.2/24

Configs:

R1:

```text

router ospf 10

router-id 1.1.1.1

network 192.168.10.0 0.0.0.255 area 0

```

R2:

```text

router ospf 1

router-id 2.2.2.2

network 192.168.10.0 0.0.0.255 area 0

passive-interface g0/0

```

You run `show ip ospf neighbor` on both routers and see no neighbors.

Your tasks (think through, then check yourself):

  1. Does the difference in process ID (10 vs 1) prevent adjacency?
  2. What does the `passive-interface g0/0` command on R2 do in this context?
  3. Which single command change on R2 would most likely fix the problem?
  4. After the fix, which commands would you use to confirm that adjacency is now working?

Reveal model answers (compare with your reasoning):

  1. Process ID mismatch does not prevent adjacency on Cisco; it is locally significant.
  2. `passive-interface g0/0` prevents R2 from sending/receiving OSPF Hellos on G0/0, so no neighbor can form.
  3. Under `router ospf 1`, enter `no passive-interface g0/0`.
  4. Use `show ip ospf neighbor` to see the neighbor in FULL state and `show ip route ospf` to confirm routes are installed.

Try to solve similar mini-scenarios on paper until this reasoning becomes automatic.

Quiz 1: Core OSPFv2 Configuration and Neighbors

Answer this question to check your understanding of OSPFv2 basics on Cisco routers.

You have two directly connected routers, R1 and R2, on 10.0.12.0/24. Both interfaces are up/up and can ping each other. On R1 you configured: router ospf 1 network 10.0.12.0 0.0.0.255 area 0 On R2 you configured: router ospf 5 network 10.0.12.0 0.0.0.255 area 0 passive-interface g0/0 Which statement best explains why OSPF neighbors do NOT form?

  1. The OSPF process IDs differ (1 vs 5), and OSPF requires them to match between neighbors.
  2. The `passive-interface g0/0` command on R2 prevents OSPF Hellos from being sent or received on that interface.
  3. R1 and R2 must both use router ID 1.1.1.1 for single-area OSPFv2 to work.
  4. The network statement must use a /32 wildcard mask on both routers for adjacency to form.
Show Answer

Answer: B) The `passive-interface g0/0` command on R2 prevents OSPF Hellos from being sent or received on that interface.

On Cisco routers, the OSPF process ID is locally significant and does not need to match between neighbors, so option A is incorrect. The real issue is that `passive-interface g0/0` on R2 stops OSPF Hellos on that interface, so no neighbor can form. Router IDs do not need to match (they must be unique), and a /32 wildcard is not required; the /24 wildcard is fine. Therefore, option B is correct.

Quiz 2: Interpreting OSPFv2 Neighbor States

Use your knowledge of neighbor states to answer this question.

On a broadcast Ethernet segment with three routers (R1, R2, R3), you run `show ip ospf neighbor` on R2. You see: - R1 in state FULL - R3 in state 2WAY All routers are in area 0, and pings between all pairs succeed. What is the most likely explanation?

  1. R2 and R3 have an OSPF area mismatch and are not fully adjacent.
  2. R3 has an MTU mismatch with R2, causing the adjacency to stop at 2WAY.
  3. R1 is the DR or BDR, so R2 forms FULL adjacency with R1, but only 2WAY with R3, which is normal.
  4. R3 is configured as a passive interface on R2, so the adjacency cannot reach FULL.
Show Answer

Answer: C) R1 is the DR or BDR, so R2 forms FULL adjacency with R1, but only 2WAY with R3, which is normal.

On a broadcast multiaccess network, only routers that are DR or BDR form FULL adjacencies with everyone. Other routers may remain in 2WAY with each other, which is normal when the DR/BDR mechanism is working. Since connectivity is fine and all are in area 0, the most likely explanation is that R1 is the DR/BDR and R2 and R3 are DROTHERs, making option C correct.

Flashcards: Key OSPFv2 Commands and Concepts

Use these flashcards to reinforce core OSPFv2 configuration and troubleshooting ideas.

Command to start an OSPFv2 process with ID 1 on a Cisco router
`router ospf 1` in global configuration mode
Definition of OSPFv2
Open Shortest Path First version 2 (OSPFv2) is a link-state interior gateway protocol used to exchange IPv4 routing information within a single autonomous system.
Command to set the OSPF router ID to 2.2.2.2
Under `router ospf <process-id>`: `router-id 2.2.2.2`
Effect of `network 10.1.0.0 0.0.255.255 area 0` under `router ospf`
Enables OSPFv2 on all interfaces whose IPs are in 10.1.0.0/16 and assigns them to area 0.
Command to see OSPF neighbors and their states
`show ip ospf neighbor`
Command to make all OSPF interfaces passive by default
Under `router ospf`: `passive-interface default`
What does a passive OSPF interface do?
It continues to advertise the connected network in OSPF but does not send or receive OSPF Hello packets, so no neighbors form on that interface.
Command to view which interfaces are running OSPF and in which area
`show ip ospf interface brief`
Desired final neighbor state on a point-to-point OSPF link
FULL
Typical cause of neighbors stuck in EXSTART/EXCHANGE
Often an MTU or OSPF parameter mismatch (such as network type) between the two routers.

Key Terms

OSPFv2
Open Shortest Path First version 2 (OSPFv2) is a link-state interior gateway protocol used to exchange IPv4 routing information within a single autonomous system.
OSPF area
A logical grouping of OSPF routers and networks that share the same link-state database; area 0 is the backbone area.
router ID
A 32-bit value written like an IPv4 address that uniquely identifies an OSPF router within an autonomous system.
Dead timer
The OSPF interval after which, if no Hellos are received from a neighbor, that neighbor is declared down.
Hello timer
The OSPF interval at which Hello packets are sent on an interface to discover and maintain neighbor relationships.
OSPF neighbor
Another OSPF-enabled router on a common network segment with which a router exchanges OSPF Hellos and, potentially, LSAs.
wildcard mask
An inverse mask used in OSPF network statements to select IP address ranges by specifying which bits must match and which bits can vary.
OSPF adjacency
A relationship between OSPF neighbors that have synchronized their link-state databases and reached the FULL state.
OSPF network type
A setting that defines how OSPF treats a network segment (for example, broadcast, non-broadcast, point-to-point), affecting DR/BDR elections and neighbor formation.
passive interface
An interface on which a routing protocol does not send or receive routing updates or Hellos, but whose network may still be advertised.

Finished reading?

Test your understanding with a custom practice exam on this chapter.

Test yourself