Course contents

Module 3: Configure and VerifyLesson 3.1 (1 of 3 in this module)9 of 29 in the OSPF course

Configuring single-area OSPFv2

How do we make three routers learn each other's LANs without adding a static route for every network? Let's configure one OSPF area, then check that the result matches the plan.

Intermediate · 14 min read

Start with the interfaces and the required result

PC-A on 192.168.1.0/24 needs to reach the server at 192.168.3.10. R1 knows PC-A's local network, and R3 knows the server's local network. R2 joins them. Each router needs routes to the remote LANs, and the server needs a return path to PC-A.

OSPFv2 is the IPv4 routing protocol we use here. An area groups interfaces that share detailed OSPF topology information. This small network uses one normal area, area 0. An OSPF neighbour is another router on a local link. PCs and ordinary Layer 2 access switches do not need to become OSPF neighbours.

R1–R3 should learn the three LANs. Only router-to-router interfaces form neighbours. R1 also supplies an external default route. Interface addresses and basic connectivity are already configured; the blocks below start in global configuration mode on their named router.

Three routers, three LANs, one OSPF area
Three routers, three LANs, one OSPF areaGrey lines are Ethernet cables. Teal router links form OSPF adjacencies; gold LAN links advertise subnets without Hellos. The ISP router is outside the OSPF domain. R1, R2 and R3 form a chain in area 0. Each connects through an access switch to one host LAN. R1 has a separate ISP uplink that does not run OSPF.ISP routerR1SW1PC-ARID 1.1.1.1Gi0/0 · passive192.168.1.1/24192.168.1.10/24R2SW2PC-BRID 2.2.2.2Gi0/2 · passive192.168.2.1/24192.168.2.10/24R3SW3ServerRID 3.3.3.3Gi0/1 · passive192.168.3.1/24192.168.3.10/24ISP Gi0/0 · 203.0.113.1/30R1 Gi0/2 · 203.0.113.2/30Area 0 · router links P2P10.0.12.0/3010.0.23.0/30R2 Gi0/1 .1 → R3 Gi0/0 .2R1 Gi0/1 .1 → R2 Gi0/0 .2
R1 · RID 1.1.1.1
Gi0/0 192.168.1.1/24 → SW1; Gi0/1 10.0.12.1/30 → R2 Gi0/0 10.0.12.2/30; Gi0/2 203.0.113.2/30 → ISP Gi0/0 203.0.113.1/30 (outside OSPF).
R2 · RID 2.2.2.2
Gi0/0 → R1; Gi0/1 10.0.23.1/30 → R3 Gi0/0 10.0.23.2/30; Gi0/2 192.168.2.1/24 → SW2.
R3 · RID 3.3.3.3
Gi0/0 → R2; Gi0/1 192.168.3.1/24 → SW3. LAN interfaces on all three routers are passive but included in area 0.
Hosts and access switches
PC-A 192.168.1.10/24, PC-B 192.168.2.10/24, server 192.168.3.10/24. Each gateway is its LAN's .1 router address. Each switch Gi0/1 → router, Gi0/2 → host Ethernet; one local access VLAN per LAN.
OSPF assumptions
Area 0, local process 1, unique explicit RIDs. Router links: point-to-point, Hello 10 / Dead 40 s, no authentication, matching MTU 1500. All interfaces up; gigabit bandwidth, reference 10000 Mbps, outgoing cost 10 unless stated.
Address key
/24 mask 255.255.255.0; /30 mask 255.255.255.252. Prefixes describe networks; host/interface addresses identify devices. No URL is shown. ISP range is documentation addressing; Internet service needs NAT, return routing and permitting policy beyond this OSPF example.
Grey lines are Ethernet cables. Teal router links form OSPF adjacencies; gold LAN links advertise subnets without Hellos. The ISP router is outside the OSPF domain.
See the configuration and verification sequence
Identify
Local process number and unique router ID
Select interfaces
Network statements OR interface commands, in area 0
Set behaviour
Passive LANs, P2P router links, consistent cost reference
Verify
Interfaces → neighbours → routes → a return-path test

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Configure each router, then verify the result before saving.

1 · Select the interface, keep its actual subnet mask

The process ID is the local number for OSPF, here 1. The router ID is a separate unique name, such as 1.1.1.1 for R1. It looks like an IP address, but it does not need to be configured on a port. Set it explicitly so the router's identity is predictable.

A wildcard mask tells IOS which address bits to compare: 0 means match, and 1 means ignore. The wildcard 0.0.0.3 matches the four addresses from 10.0.12.0 through 10.0.12.3. R1's 10.0.12.1 interface is inside that range.

See why matching one address does not create a /32 route
The network command selects an interface, not a new mask
The network command selects an interface, not a new maskArrows show a configuration decision, not packet movement. Wildcard 0.0.0.0 means match every address bit; it does not change the interface's /30 subnet mask. On R1, network 10.0.12.1 0.0.0.0 area 0 matches only Gi0/1. Its actual 10.0.12.1/30 address produces subnet 10.0.12.0/30, not a /32 advertisement. Gi0/0 and Gi0/2 do not match this statement.network 10.0.12.1 0.0.0.0 area 0R1Gi0/0 · 192.168.1.1/24No matchGi0/1 · 10.0.12.1/30Match ✓Gi0/2 · 203.0.113.2/30No matchAdvertised subnet: 10.0.12.0/30Actual interface mask stays /30
Equivalent selection
On this R1, network 10.0.12.0 0.0.0.3 area 0 also selects Gi0/1. Its range is 10.0.12.0–10.0.12.3. Wildcard bits: 0 = compare, 1 = ignore. The /30 subnet mask is 255.255.255.252.
Alternative command
Under R1 interface Gi0/1: ip ospf 1 area 0 selects the interface explicitly. Both alternatives use local process 1 and area 0. R1 RID 1.1.1.1; its peer is R2 Gi0/0 10.0.12.2/30, RID 2.2.2.2.
Arrows show a configuration decision, not packet movement. Wildcard 0.0.0.0 means match every address bit; it does not change the interface's /30 subnet mask.

The network command selects local interfaces. A precise match does not create a host route. The interface's actual address and mask determine the connected prefix advertised by this example.

network 10.0.12.0 0.0.0.3 area 0

R1 router configuration mode: selects Gi0/1. For a contiguous /30 mask, 255.255.255.255 − 255.255.255.252 gives wildcard 0.0.0.3.

interface GigabitEthernet0/1 ip ospf 1 area 0

Alternative on R1, from global configuration mode: enable OSPF directly on Gi0/1. Use either method for this interface; both are not needed.

The process number is local: neighbours do not need matching process IDs. Area IDs must agree on the link. On IOS, an interface-level OSPF area command takes precedence over a matching network statement; check both when reading an existing configuration.

2 · Advertise user LANs without forming neighbours there

The LAN must be included in OSPF so other routers can learn it. However, there is no OSPF router to discover beside PC-B. A passive interface advertises its selected subnet without sending Hello discovery packets or forming an adjacency on that interface.

Follow R2's active router links and passive LAN
R2: speak to routers, advertise the user LAN
R2: speak to routers, advertise the user LANTeal dashed arrows are Hello delivery. The gold marker stops Hellos towards the PC LAN; it does not block user packets or hide that subnet. Purple arrows are subnet information flooded to router neighbours. R2 sends Hellos towards R1 and R3 over the two /30 links. Gi0/2 is passive: no Hellos or adjacency towards SW2 and PC-B, but 192.168.2.0/24 is advertised through the active router links.R1R2R3SW2PC-B10.0.12.0/3010.0.23.0/30Advertise 192.168.2.0/24Gi0/2 passive · no HellosPC-B gateway: 192.168.2.1
Routers and links
R1 RID 1.1.1.1, Gi0/1 10.0.12.1/30 ↔ R2 RID 2.2.2.2, Gi0/0 10.0.12.2/30. R2 Gi0/1 10.0.23.1/30 ↔ R3 RID 3.3.3.3, Gi0/0 10.0.23.2/30. Area 0, P2P, Hello 10 / Dead 40 s.
Passive LAN
R2 Gi0/2 192.168.2.1/24 → SW2 Gi0/1; SW2 Gi0/2 → PC-B Ethernet 192.168.2.10/24, gateway 192.168.2.1. OSPF is enabled on Gi0/2 and passive-interface GigabitEthernet0/2 is set. No OSPF neighbour forms on this LAN.
Teal dashed arrows are Hello delivery. The gold marker stops Hellos towards the PC LAN; it does not block user packets or hide that subnet. Purple arrows are subnet information flooded to router neighbours.

Passive does not mean hidden. The OSPF-enabled LAN stays advertised, but no adjacency forms on it. With passive-interface default, enable neighbour formation only on the intended router links.

3 · Apply the configuration to each router

R1 · network statements and the ISP default

Read R1's block in three parts. The static default points unknown destinations to the Internet service provider (ISP). The interface command makes the R1–R2 link point-to-point: OSPF treats it as a link with one other router, without electing a designated router. The process commands then set identity, cost calculation and the interfaces allowed to form neighbours.

ip route 0.0.0.0 0.0.0.0 203.0.113.1 interface GigabitEthernet0/1 ip ospf network point-to-point exit router ospf 1 router-id 1.1.1.1 auto-cost reference-bandwidth 10000 passive-interface default no passive-interface GigabitEthernet0/1 network 192.168.1.0 0.0.0.255 area 0 network 10.0.12.0 0.0.0.3 area 0 default-information originate exit

R1 only, from global configuration mode. Gi0/0 advertises LAN 1 passively. Gi0/1 forms the R2 adjacency. Gi0/2 faces the ISP and is not selected for OSPF. Set the RID before enabling the process on its interfaces.

R2 · explicit interface commands

R2 has two router-facing links, so both need no passive-interface. Its third interface is the PC-B LAN and stays passive. This block uses interface commands instead of network statements to show the alternative. You do not need both methods on the same interface.

router ospf 1 router-id 2.2.2.2 auto-cost reference-bandwidth 10000 passive-interface default no passive-interface GigabitEthernet0/0 no passive-interface GigabitEthernet0/1 exit interface GigabitEthernet0/0 ip ospf 1 area 0 ip ospf network point-to-point exit interface GigabitEthernet0/1 ip ospf 1 area 0 ip ospf network point-to-point exit interface GigabitEthernet0/2 ip ospf 1 area 0 exit

R2 only. Gi0/0 and Gi0/1 form neighbours; Gi0/2 advertises LAN 2 passively. An interface must be selected for OSPF before the passive setting can advertise its subnet.

R3 · exact interface-address matches

R3 uses wildcard 0.0.0.0, which compares every address bit. The two lines therefore select exactly the transit interface and the LAN interface. They still advertise the real /30 transit and /24 LAN networks. The wildcard selects an interface; the configured interface mask describes its subnet.

interface GigabitEthernet0/0 ip ospf network point-to-point exit router ospf 1 router-id 3.3.3.3 auto-cost reference-bandwidth 10000 passive-interface default no passive-interface GigabitEthernet0/0 network 10.0.23.2 0.0.0.0 area 0 network 192.168.3.1 0.0.0.0 area 0 exit

R3 only. Exact matches select the two interfaces. Gi0/0 forms the R2 adjacency; Gi0/1 advertises LAN 3 passively. Its LAN prefix remains /24, not /32.

A new interface remains passive under this policy, but its subnet is advertised only if OSPF is also enabled on it. For a new router link, configure the network type on both ends and remove passive on the intended interface.

4 · Check the route cost from the receiving router

Cost is OSPF's path metric. For this example, each gigabit routed interface costs 10. To reach LAN 1, R3 adds its outgoing cost towards R2, R2's outgoing cost towards R1 and R1's outgoing cost onto LAN 1: 10 + 10 + 10 gives an OSPF route metric of 30. Switch ports on the same LAN do not add a routed OSPF hop.

R3 to LAN 1: add the outgoing interface costs
R3 to LAN 1: add the outgoing interface costsThe purple arrow follows forwarding towards LAN 1, from right to left. Access switches add no routed OSPF interface cost. The destination prefix is a network, not one PC address. Traffic from R3 to 192.168.1.0/24 leaves R3 Gi0/0, R2 Gi0/0 and R1 Gi0/0. Each has cost 10: the advertised route metric at R3 is 30.SW1 · LAN 1R1R2R3Gi0/0: 10Gi0/0: 10Gi0/0: 10192.168.1.0/2410.0.12.0/3010.0.23.0/30R3 metric = 10 + 10 + 10 = 30O 192.168.1.0/24 [110/30] via 10.0.23.1110 = administrative distance · 30 = OSPF cost
Cost assumptions
Each routed interface has bandwidth 1000 Mbps; every router uses reference 10000 Mbps. No manual cost override: 10000 ÷ 1000 = 10. RIDs R1 1.1.1.1, R2 2.2.2.2, R3 3.3.3.3; area 0, transit links P2P.
Interfaces and next hop
R3 Gi0/0 10.0.23.2/30 → R2 Gi0/1 10.0.23.1/30; R2 Gi0/0 10.0.12.2/30 → R1 Gi0/1 10.0.12.1/30; R1 Gi0/0 192.168.1.1/24 → SW1 Gi0/1. R3's immediate next hop is 10.0.23.1, not R1's RID.
The purple arrow follows forwarding towards LAN 1, from right to left. Access switches add no routed OSPF interface cost. The destination prefix is a network, not one PC address.

Reference bandwidth is in Mbps. At 10000 Mbps, gigabit interfaces cost 10; 100 Mbps interfaces cost 100; 10 Gbps interfaces cost 1. Use the same reference across the domain. The default 100 Mbps reference gives all three speeds cost 1.

Manual cost and bandwidth overrides

An explicit ip ospf cost 50 overrides the automatic calculation on that outgoing interface. Otherwise OSPF uses the interface bandwidth value. The bandwidth command changes that configured value, not the physical line rate. The reverse direction has its own cost. These overrides are not applied in the cost-30 example.

interface GigabitEthernet0/1 ip ospf cost 50

Separate example: interface configuration from global mode on the selected router. This changes its outgoing cost, so the illustrated metric may change.

Equal-cost paths can be installed up to the device's supported and configured maximum-paths limit. This chain has no alternate path.

5 · Originate a default only under the intended condition

A default route, 0.0.0.0/0, is used when no more specific route matches the destination. R1 having a static default does not automatically teach it to R2 and R3. default-information originate asks OSPF to advertise one while R1 has an eligible installed default, under the conditions used in this lab.

On R3 the default next hop is R2, 10.0.23.1. R3 cannot send directly to the ISP's 203.0.113.1 address because that router is not on R3's local link. Each router forwards to its own next hop.

Compare the advertised default and its withdrawal
R1 originates a default; R3 forwards back towards R1
R1 originates a default; R3 forwards back towards R1Purple dashed arrows show default-route information, not user packets. Actual external traffic forwards R3 → R2 → R1 → ISP. The ISP is outside OSPF. R1 has a static default via ISP 203.0.113.1 and originates a Type 5 external default into normal area 0. R2 learns via R1; R3 learns via R2. Data towards unknown external destinations follows the opposite direction.ISPR1 · ASBRR2R3203.0.113.0/3010.0.12.0/3010.0.23.0/30R1: S* 0.0.0.0/0 via 203.0.113.1R3: O*E2 0.0.0.0/0 [110/1] via 10.0.23.10.0.0.0/0 = default prefix · not a device IP or URL
Link and identity map
ISP Gi0/0 203.0.113.1/30 ↔ R1 Gi0/2 203.0.113.2/30. R1 Gi0/1 10.0.12.1/30 ↔ R2 Gi0/0 .2/30. R2 Gi0/1 10.0.23.1/30 ↔ R3 Gi0/0 .2/30. RIDs: R1 1.1.1.1; R2 2.2.2.2; R3 3.3.3.3.
Example conditions
Normal area 0; internal links P2P; R1 is ASBR. Plain default-information originate, no route-map or metric override; example external type E2, metric 1. R3's next hop is 10.0.23.1. R1 does not run OSPF towards the ISP.
Purple dashed arrows show default-route information, not user packets. Actual external traffic forwards R3 → R2 → R1 → ISP. The ISP is outside OSPF.
After R1 loses its installed default
After R1 loses its installed defaultA logical condition, not a claim that every ISP outage removes a static route. A failure beyond the next hop can leave the local default installed. With default-information originate and no always or route-map, R1 withdraws the external default after its local default disappears. After convergence R2 and R3 remove that route, assuming no alternate default source.ISPR1 · ASBRR2R3203.0.113.0/3010.0.12.0/3010.0.23.0/30R1: no default → external default withdrawnR3 after convergence: no OSPF defaultInternal LAN routes can still remain reachable
Link and identity map
ISP Gi0/0 203.0.113.1/30 ↔ R1 Gi0/2 203.0.113.2/30. R1 Gi0/1 10.0.12.1/30 ↔ R2 Gi0/0 .2/30. R2 Gi0/1 10.0.23.1/30 ↔ R3 Gi0/0 .2/30. RIDs: R1 1.1.1.1; R2 2.2.2.2; R3 3.3.3.3.
Example conditions
R1 has no installed 0.0.0.0/0. No always keyword, route-map or alternate default originator. Snapshot is after withdrawal and convergence. OSPF neighbours on internal links remain Full.
A logical condition, not a claim that every ISP outage removes a static route. A failure beyond the next hop can leave the local default installed.

An installed default is not an Internet health check. A failure beyond the ISP next hop can leave R1's static default installed. Plain default-information originate then continues advertising it. The always keyword removes the installed-default requirement; it does not repair upstream connectivity.

6 · Verify interfaces, neighbours and learned routes

First check what OSPF is actually running on. Next check whether the expected router has reached Full, meaning database synchronisation has completed. Finally inspect the route for the destination. These checks answer different questions; one successful neighbour entry is not proof that every LAN is advertised.

Illustrative IOS excerpt · active router links shown; LAN row omitted
R2#show ip ospf interface brief
Interface    PID   Area   IP Address/Mask    Cost  State Nbrs F/C
Gi0/1        1     0      10.0.23.1/30       10    P2P   1/1
Gi0/0        1     0      10.0.12.2/30       10    P2P   1/1
The two P2P links each have one Full neighbour. Passive-interface brief states vary by software; use the detailed interface output to confirm passive behaviour, rather than treating a LAN row as evidence of DR election.
Illustrative IOS excerpt · omitted fields and platform-dependent formatting
R2#show ip ospf interface GigabitEthernet0/2
Internet Address 192.168.2.1/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
No Hellos (Passive interface)
Neighbor Count is 0, Adjacent neighbor count is 0
The address, area, cost and passive line must match the intended LAN. No neighbour on this interface is expected.
Example output · based on Cisco documentation; exact format varies by platform and software version
R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:00:34    10.0.23.2       GigabitEthernet0/1
1.1.1.1           0   FULL/  -        00:00:39    10.0.12.1       GigabitEthernet0/0
Neighbour IDs are RIDs; Address is the peer's local-link IPv4 address. A dash follows Full on these point-to-point links; no DR/BDR election is used.
Illustrative IOS excerpt · learned routes for this topology
R3#show ip route ospf
O*E2  0.0.0.0/0 [110/1] via 10.0.23.1, GigabitEthernet0/0
O     10.0.12.0/30 [110/20] via 10.0.23.1, GigabitEthernet0/0
O     192.168.1.0/24 [110/30] via 10.0.23.1, GigabitEthernet0/0
O     192.168.2.0/24 [110/20] via 10.0.23.1, GigabitEthernet0/0
Local LAN 3 is connected, so it is not listed by this OSPF-only command. The E2 external metric is 1 in this example; it is not the internal cost-30 calculation. Internal cost can still affect external-route selection.
show ip ospf | include ID|Reference

Privileged EXEC on each router: confirm the active RID and 10000 Mbps reference. On an existing process, a configured RID change may require a process restart; plan for disrupted adjacencies.

Test PC-B to server 192.168.3.10 and back, checking host gateways and any filtering. Full neighbours alone do not prove end-to-end traffic works. After verification, save on each router with copy running-config startup-config.

Short lab: prove the LAN advertisement

On R3 run show ip route 192.168.1.0, then ping 192.168.1.10 from the server. In this isolated lab, remove only R1's LAN network statement with no network 192.168.1.0 0.0.0.255 area 0 under process 1. Leave the R1–R2 transit statement intact.

Check R2's neighbour table and R3's route again. R1 can remain Full with R2 while the LAN route disappears after convergence. Restore the original network statement and verify the route and host test recover. This separates a healthy neighbour relationship from a complete set of advertisements.

For a failed check, follow Verifying and troubleshooting OSPF. For a complete hands-on build, use the single-area OSPF lab.

Sources: Cisco network-area command reference, passive-interface behaviour, and default-route origination.

Test yourself on configuring OSPF

Predict · scenario 1

R1 has Gi0/1 10.0.12.1/30 and the command network 10.0.12.0 0.0.0.3 area 0. Which prefix does R1 advertise for that link?

Predict · scenario 2

The reference bandwidth is 10000 Mbps. What is the OSPF cost of a FastEthernet (100 Mbps) interface?

Predict · scenario 3

R2's OSPF-enabled LAN interface Gi0/2 is configured as passive. What happens to 192.168.2.0/24?

Predict · scenario 4

R3 has passive-interface default and network statements for both interfaces, but no other commands. What happens with R2?

Predict · scenario 5

R1 uses plain default-information originate, without always or a route-map. Its only installed default is removed, and no other router originates one. After convergence, what do R2 and R3 see?