30% off every course until Sunday, October 11. Our biggest update yet, and we'd like you to try it. Applied automatically at checkout.

Choose your certification
Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

4.4.5. OSPF Configuration

Basic Configuration:
Router(config)# router ospf 1
Router(config-router)# router-id 1.1.1.1
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config-router)# network 10.0.0.0 0.255.255.255 area 0
Router(config-router)# passive-interface GigabitEthernet0/1
Interface-level Configuration (alternative):
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip ospf 1 area 0

OSPFv3 (IPv6) has no network command. It is enabled only per interface, with the ipv6 keyword in place of ip:

Router(config)# ipv6 unicast-routing
Router(config)# ipv6 router ospf 1
Router(config-rtr)# router-id 1.1.1.1
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ipv6 ospf 1 area 0
Key OSPF Commands:
CommandPurpose
network ... area 0Enable OSPF on interfaces
passive-interfaceStop sending Hellos (but still advertise network)
default-information originateAdvertise a default route into OSPF, only if this router has one in its table (add always to advertise it regardless)
ip ospf costManually set interface cost
Verification:
Router# show ip ospf neighbor          ! Neighbors and their adjacency state
Router# show ip ospf interface brief   ! OSPF interfaces with area, cost, state
Router# show ip ospf interface Gi0/0   ! Timers, network type, cost, DR/BDR
Router# show ip ospf database          ! The LSDB (LSAs), not the routing table
Router# show ip route ospf             ! OSPF routes actually installed
Router# show ip protocols              ! Process, router ID, networks, passive interfaces
Example show ip ospf neighbor output:
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:32    192.168.1.2     Gi0/0
3.3.3.3           1   FULL/BDR        00:00:35    192.168.1.3     Gi0/0

⚠️ Exam Trap: OSPF uses wildcard masks in the network command, not subnet masks. Wildcard = inverse of subnet mask (0.0.0.255 = 255.255.255.0).

Router roles and route types in output: In single-area OSPF all routers are normally in area 0 (the backbone), so there are no ABRs (routers joining area 0 to another area), no inter-area summarization and no virtual links. A router that injects external routes, by redistribution or default-information originate, is an ASBR and advertises them as Type 5 External LSAs (Type 7 inside an NSSA). In show ip route, O (type intra-area) means the destination is in this router's own area, O IA is inter-area, and O E1/O E2 are external.

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•20 professional certifications