OSPF Loopback Advertised as /32 Instead of Actual Subnet
Presenting Symptom
A loopback interface configured with a /24 subnet mask is advertised in the OSPF database as a /32 host route instead of the actual subnet.
Network Context
A small enterprise campus network with Cisco IOS routers running OSPF. Router R1 has a loopback interface (Loopback0) with IP 10.1.1.1/24. OSPF is configured on all routers in area 0. The network engineer notices that the route to 10.1.1.0/24 is missing from other routers' routing tables; instead, a /32 route for 10.1.1.1 appears.
Diagnostic Steps
Check OSPF database for the loopback prefix
show ip ospf database router 1.1.1.1 LS age: 100
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0x1234
Length: 48
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.1.1.1
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1The OSPF database shows the loopback as a stub network with a /32 mask (255.255.255.255). This indicates OSPF is advertising the loopback as a host route, not the configured /24 subnet.
Verify the interface configuration and OSPF network type
show ip ospf interface loopback 0Loopback0 is up, line protocol is up Internet Address 10.1.1.1/24, Area 0 Process ID 1, Router ID 1.1.1.1, Network Type LOOPBACK, Cost: 1 Loopback interface is treated as a stub host
The output confirms the interface is a loopback and OSPF treats it as a stub host by default. The network type is LOOPBACK, which causes OSPF to advertise a /32 host route regardless of the configured mask.
Check the routing table on a neighbor router
show ip route ospfO 10.1.1.1/32 [110/2] via 192.168.1.1, 00:00:10, GigabitEthernet0/0
The neighbor sees only the /32 host route, not the /24 network route. This confirms the problem: the loopback is not being advertised with its configured subnet mask.
Verify if the loopback interface has the ip ospf network point-to-point command
show running-config interface loopback 0interface Loopback0 ip address 10.1.1.1 255.255.255.0 ip ospf network point-to-point
If the output shows 'ip ospf network point-to-point', the issue is resolved. If not, the missing command is the root cause. The command changes the OSPF network type from LOOPBACK to point-to-point, which allows the actual subnet mask to be advertised.
Root Cause
By default, Cisco IOS treats loopback interfaces as stub hosts in OSPF, advertising them as /32 host routes regardless of the configured subnet mask. This is because the default OSPF network type for loopbacks is LOOPBACK, which always advertises a host route. To advertise the actual subnet, the interface must be configured as OSPF network type point-to-point.
Resolution
Verification
After applying the fix, verify on a neighbor router: show ip route ospf Expected output: O 10.1.1.0/24 [110/2] via 192.168.1.1, 00:00:10, GigabitEthernet0/0 Also verify the OSPF database on the neighbor: show ip ospf database router 1.1.1.1 Expected output should show the link with mask 255.255.255.0 instead of 255.255.255.255.
Prevention
["Always configure loopback interfaces used for OSPF advertisements with the 'ip ospf network point-to-point' command if you need the actual subnet mask advertised.","Use the 'show ip ospf interface' command to verify the OSPF network type before troubleshooting routing issues.","Design OSPF network types intentionally: use point-to-point for loopbacks that should represent a subnet, or use /32 masks if host routes are desired."]
CCNA Exam Relevance
On the CCNA 200-301 exam, this scenario appears in troubleshooting questions where a loopback interface is not being advertised with the correct subnet mask. The exam tests understanding of OSPF network types and their effect on route advertisement. A common multiple-choice question asks: 'Which command changes the OSPF network type on a loopback interface to advertise the configured subnet mask?' The correct answer is 'ip ospf network point-to-point'.
Exam Tips
Memorize that loopback interfaces default to OSPF network type LOOPBACK, which always advertises a /32 host route.
Know that the 'ip ospf network point-to-point' command overrides this behavior and allows the actual subnet mask to be advertised.
Be able to interpret 'show ip ospf interface' output to identify the network type and its effect on route advertisement.
Commands Used in This Scenario
show ip ospf database
Displays the OSPF link-state database (LSDB) to verify OSPF adjacencies, check for missing or corrupt LSAs, and troubleshoot OSPF routing issues.
show ip ospf interface
Displays OSPF interface parameters and status, used to verify OSPF configuration and troubleshoot neighbor relationships.
Test Your CCNA Knowledge
Practice with scenario-based questions to prepare for the CCNA 200-301 exam.
Practice CCNA Questions