Pcornel
H3 · Practical network exams · Cisco IOS / IOS XE

OSPFv2 · Finals

Configuration first, verification second, theory third. Reference templates require task-specific adaptation.

Content version 1.1-draft

Keyboard shortcuts

/ Finals search · Ctrl K global command palette · Alt E Exam Mode · Alt G Golden Scripts · Alt T Exam Topics · Alt V Verify · Esc close dialog.

Skills Exam · Supporting reference, not an additional exam objective

Quick explanation

OSPFv2 is an IPv4 link-state routing protocol. Routers establish adjacencies, synchronize link-state databases and calculate paths by cost.

Configuration

Replace highlighted placeholders. Configure only the variants required by the task.

Prerequisites and dependency links
  • Assign IPv4 addresses and enable routing on L3 switches.
  • Use unique router IDs and matching area, timers, authentication and network type.
Network statement Recommended / essential starting point
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
router ospf [PROCESS-ID]
 router-id [ROUTER-ID]
 network [NETWORK] [WILDCARD-MASK] area [AREA-ID]
 exit
end
Command parameters
[PROCESS-ID]
Local routing process identifier.
[ROUTER-ID]
Unique 32-bit routing protocol router ID in dotted decimal notation.
[NETWORK]
IPv4 destination or matching network address.
[WILDCARD-MASK]
Inverse IPv4 mask used for matching.
[AREA-ID]
OSPF area number or dotted area ID.
Peer configuration — Adjacent router or L3 switch

Peer blocks use the peer's own local interfaces and identifiers. Shared values must agree; other placeholders are interpreted from that device's perspective.

Shared: AREA-ID

  • Use the peer's own addresses and interfaces. Process IDs are locally significant. Match area and compatible link parameters.
enable
configure terminal
router ospf [PROCESS-ID]
 router-id [PEER-ROUTER-ID]
 network [PEER-NETWORK] [WILDCARD-MASK] area [AREA-ID]
 exit
end
Interface activation Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
router ospf [PROCESS-ID]
 router-id [ROUTER-ID]
 exit
interface [INTERFACE]
 ip ospf [PROCESS-ID] area [AREA-ID]
 exit
end
Command parameters
[PROCESS-ID]
Local routing process identifier.
[ROUTER-ID]
Unique 32-bit routing protocol router ID in dotted decimal notation.
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[AREA-ID]
OSPF area number or dotted area ID.
Peer configuration — Adjacent router or L3 switch

Peer blocks use the peer's own local interfaces and identifiers. Shared values must agree; other placeholders are interpreted from that device's perspective.

Shared: AREA-ID

  • Use the peer's own addresses and interfaces. Process IDs are locally significant. Match area and compatible link parameters.
enable
configure terminal
router ospf [PROCESS-ID]
 router-id [PEER-ROUTER-ID]
 exit
interface [INTERFACE]
 ip ospf [PROCESS-ID] area [AREA-ID]
 exit
end
Passive by default with selected neighbors Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
router ospf [PROCESS-ID]
 passive-interface default
 no passive-interface [NEIGHBOR-INTERFACE]
 exit
end
Command parameters
[PROCESS-ID]
Local routing process identifier.
[NEIGHBOR-INTERFACE]
Local interface on which routing neighbors are expected.
Multi-area interfaces Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
router ospf [PROCESS-ID]
 router-id [ROUTER-ID]
 exit
interface [BACKBONE-INTERFACE]
 ip ospf [PROCESS-ID] area 0
 exit
interface [OTHER-INTERFACE]
 ip ospf [PROCESS-ID] area [AREA-ID]
 exit
end
Command parameters
[PROCESS-ID]
Local routing process identifier.
[ROUTER-ID]
Unique 32-bit routing protocol router ID in dotted decimal notation.
[BACKBONE-INTERFACE]
Local interface connected to area 0.
[OTHER-INTERFACE]
Local interface in the non-backbone area.
[AREA-ID]
OSPF area number or dotted area ID.
Originate default route Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

  • Normally requires an installed default route; use always only if specified.
enable
configure terminal
router ospf [PROCESS-ID]
 default-information originate
 exit
end
Command parameters
[PROCESS-ID]
Local routing process identifier.
Legacy MD5 interface authentication Optional when requested
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: ospfv2-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

  • Legacy lab authentication; match key ID and secret on both peers.
enable
configure terminal
interface [INTERFACE]
 ip ospf authentication message-digest
 ip ospf message-digest-key [KEY-ID] md5 [SHARED-SECRET]
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[KEY-ID]
Matching authentication key identifier.
[SHARED-SECRET]
Matching shared authentication secret on participating systems.

Show / Verify

Primary verification Section link
show ip ospf neighbor
Example output
2.2.2.2  1  FULL/DR  00:00:34  192.0.2.2  Gi0/0

A required adjacency should reach FULL. DROTHER peers on a broadcast segment may remain 2-WAY by design.

Detailed verification Section link
show ip ospf interface brief
Example output
Gi0/0  1  0  192.0.2.1/24  1  DR  1/1

Verify process, area and neighbor count.

Detailed verification Section link
show ip route ospf
Example output
O    198.51.100.0/24 [110/2] via 192.0.2.2

Check learned routes.

Detailed verification Section link
show ip protocols
Example output
Routing Protocol is "ospf 1"

Check process configuration.

Connectivity verification

IPv4 reachability

Check success rate; use source or VRF context if required.

ping [DESTINATION-IP]
Source-specific IPv4

Verify from the intended source network.

ping [DESTINATION-IP] source [SOURCE-IP]
IPv4 path

Inspect hop sequence; missing responses alone do not prove forwarding failure.

traceroute [DESTINATION-IP]

Common mistakes

  • Wrong wildcard or area.
  • Passive interface prevents adjacency.
  • Duplicate router ID.
  • Authentication or MTU mismatch.

Quick reference and default values

Administrative distance
SourceDefault distance
Connected0
Static1
eBGP20
Internal EIGRP90
OSPF110
RIP120
External EIGRP170
iBGP200
Routing table codes
CodeMeaning
CConnected
LLocal host route
SStatic
OOSPF
O IAOSPF inter-area
O E1 / E2OSPF external
BBGP
*Candidate default
IPv4 prefix reference
PrefixSubnet maskWildcard
/00.0.0.0255.255.255.255
/1128.0.0.0127.255.255.255
/2192.0.0.063.255.255.255
/3224.0.0.031.255.255.255
/4240.0.0.015.255.255.255
/5248.0.0.07.255.255.255
/6252.0.0.03.255.255.255
/7254.0.0.01.255.255.255
/8255.0.0.00.255.255.255
/9255.128.0.00.127.255.255
/10255.192.0.00.63.255.255
/11255.224.0.00.31.255.255
/12255.240.0.00.15.255.255
/13255.248.0.00.7.255.255
/14255.252.0.00.3.255.255
/15255.254.0.00.1.255.255
/16255.255.0.00.0.255.255
/17255.255.128.00.0.127.255
/18255.255.192.00.0.63.255
/19255.255.224.00.0.31.255
/20255.255.240.00.0.15.255
/21255.255.248.00.0.7.255
/22255.255.252.00.0.3.255
/23255.255.254.00.0.1.255
/24255.255.255.00.0.0.255
/25255.255.255.1280.0.0.127
/26255.255.255.1920.0.0.63
/27255.255.255.2240.0.0.31
/28255.255.255.2400.0.0.15
/29255.255.255.2480.0.0.7
/30255.255.255.2520.0.0.3
/31255.255.255.2540.0.0.1
/32255.255.255.2550.0.0.0
OSPF neighbor states
StateMeaning
DownNo recent hello
InitHello received; not bidirectional yet
2-WayBidirectional hello; normal between DROTHERs
ExStart / ExchangeDatabase description negotiation/exchange
LoadingRequesting missing LSAs
FullDatabases synchronized with adjacent peer

Configuration comparison

Network vs interface OSPF activation — Network statements select interfaces by address and wildcard; interface commands activate the process on a specific interface.

Remove configuration — separate, potentially disruptive actions

Remove interface OSPF activation

Removes OSPF from the selected interface if not enabled by another matching configuration.

enable
configure terminal
interface [INTERFACE]
 no ip ospf [PROCESS-ID] area [AREA-ID]
 exit
end

Remove OSPF process

Removes the process and disrupts its adjacencies and routes.

enable
configure terminal
no router ospf [PROCESS-ID]
end

Related reference

Networking technical reference · Interface types · Connectivity verification

Reset checklist?

Command block

Back to Top

Confirmation

Confirm action

Continue?