Week 6 · Lesson 20

OSPFv2 Single-Area Configuration

Configuring OSPF on a Cisco router takes only three commands. The skill that earns marks is the wildcard mask and the verification that proves neighbours reached the FULL state and routes were learned.

CCNA 200-301 Domain 3.0 IP Connectivity Verified 2026-10-11
Learning objectives
Part 1

The three-step configuration

A single-area OSPF design puts every router in area 0. The configuration is:

  1. Enter OSPF configuration mode with a process ID: router ospf 1.
  2. Advertise the networks to route with network <network> <wildcard> area 0.
  3. (Recommended) set a stable router ID and add passive interfaces.
! R1: enable OSPF process 1 and advertise both LANs into area 0
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 10.0.0.0 0.0.0.255 area 0
R1(config-router)# network 10.0.1.0 0.0.0.255 area 0
R1(config-router)# passive-interface GigabitEthernet0/0
R1(config-router)# end

The process ID (here 1) is locally significant — it does not have to match on neighbouring routers. It simply distinguishes multiple OSPF instances on the same router, which is unusual in small networks. Routers only form adjacencies when they are on the same link and in the same area.

Exam tip — process ID is local The number after router ospf does not need to match between routers. Neighbours must match on the area ID and the link, not on the process ID.
In this lesson · select a part to jump

Key ideas & exam traps · select one

Part 2

The network command

The network command serves two purposes at once: it tells OSPF which interfaces to run on and it advertises the matching connected networks into the area. An interface matches only if its address falls inside the network/wildcard pair. Anything matched is enabled for OSPF; anything not matched stays silent.

You do not have to enable OSPF interface-by-interface in the router configuration; a single network statement can match several interfaces at once. There is also an interface-level alternative:

R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip ospf 1 area 0

Both methods produce the same adjacency; the network method is the classic one the exam expects. Whichever you use, only the interfaces you intend should be included.

Part 3

Wildcard masks

A wildcard mask is the inverse of a subnet mask: every mask bit is flipped, so 1 becomes 0 and 0 becomes 1. In the network command, a wildcard bit of 0 means “must match exactly” and a 1 means “ignore this bit”. To turn a subnet mask into a wildcard, subtract each octet from 255:

PrefixSubnet maskWildcard maskMatches
/24255.255.255.00.0.0.255All addresses in one /24
/16255.255.0.00.0.255.255All addresses in one /16
/25255.255.255.1280.0.0.127The first or second half of a /24
Host (/32)255.255.255.2550.0.0.0Exactly one address
Any—255.255.255.255Every interface

For example, network 10.0.0.0 0.0.0.255 area 0 enables OSPF on any interface whose address is 10.0.0.x. To enable OSPF on all interfaces, some engineers write network 0.0.0.0 255.255.255.255 area 0, although this can accidentally include interfaces you did not intend.

Definition — wildcard mask A wildcard mask is the bitwise inverse of a subnet mask. In OSPF and ACL configuration, 0 = match and 1 = ignore. It is computed by subtracting each mask octet from 255.
Reference table · select a row

Part 4

Passive interfaces

By default, enabling OSPF on an interface sends Hellos out of it, looking for neighbours. On a LAN with no other OSPF router — or worse, on a link facing users — those Hellos are wasted and slightly insecure. A passive interface suppresses Hellos on that interface while still advertising its network into OSPF. It is the standard way to “advertise the LAN but do not talk to hosts”.

! silence Hellos toward the LAN, keep advertising 10.0.0.0/24
R1(config-router)# passive-interface GigabitEthernet0/0

! make everything passive, then re-enable only real neighbour links
R1(config-router)# passive-interface default
R1(config-router)# no passive-interface GigabitEthernet0/1

The passive-interface default pattern is a best practice: it makes every interface passive, then the administrator explicitly turns Hellos back on only where a genuine OSPF neighbour exists (the inter-router links). This prevents stray adjacencies.

Tip — passive does not mean hidden A passive interface is still advertised. It only stops sending and receiving Hellos. The subnet remains reachable; you simply never form an adjacency over it.
Part 5

Setting the router ID

As Lesson 19 explained, the router ID is chosen from a configured value, else the highest loopback, else the highest active physical interface. Because that automatic choice can change, set it explicitly:

R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
! for the new ID to take effect immediately, restart the process
R1# clear ip ospf process

The router ID must be unique in the OSPF domain. A common convention is to assign each router a loopback address (for example 1.1.1.1, 2.2.2.2, 3.3.3.3) and use the same values as router IDs.

Part 6

Verification

Three commands prove that OSPF is working:

! 1. are neighbours fully adjacent?
R1# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:35    10.0.1.2        GigabitEthernet0/1

! 2. which interfaces run OSPF, in which area?
R1# show ip ospf interface brief
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Gi0/1        1     0               10.0.1.1/24        1     P2P   1/1

! 3. which routes came from OSPF? (code O)
R1# show ip route ospf
O    10.0.2.0/24 [110/2] via 10.0.1.2, 00:02:11, GigabitEthernet0/1

The FULL state in show ip ospf neighbor is the goal: it means the two routers have exchanged their full databases and agree. A neighbour stuck in INIT, 2-WAY, or EXSTART points to a parameter mismatch or a link problem. show ip route ospf lists only OSPF-learned routes, each starting with the code O and showing [110/<cost>]. Useful extras are show ip protocols (which networks OSPF is advertising) and show ip ospf (process ID, router ID, and SPF statistics).

R1 (1.1.1.1) R2 (2.2.2.2) 10.0.1.0/24 · area 0 · FULL LAN 10.0.0.0/24 LAN 10.0.2.0/24 R1 config: router ospf 1 / network 10.0.0.0 0.0.0.255 area 0 / network 10.0.1.0 0.0.0.255 area 0
Two routers in area 0. Each advertises its own LAN; the shared link forms the adjacency. R1 learns 10.0.2.0/24 from R2 as an O route and vice versa.
Key terms

The vocabulary you need

Every term below appears in the lesson text above. Select one to read its definition, then use the quiz at the end to check what stuck.

Key terms · select a term

Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 5 questions

Sources

Sources & references

  1. Cisco. CCNA (200-301) Exam Topics. cisco.com.
  2. IETF. Request for Comments (RFCs). rfc-editor.org.
  3. IANA. Internet Assigned Numbers Authority registries. iana.org.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.