// Lesson 31 of 49 · IP routing
Configuring single-area OSPFv2
Enabling OSPF with network statements or per interface, passive interfaces, default route origination, tuning and verification.
3 min read#ospf#configuration
Minimal configuration
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 10.1.12.0 0.0.0.3 area 0
R1(config-router)# network 192.168.10.0 0.0.0.255 area 0
R1(config-router)# passive-interface GigabitEthernet0/0
router ospf 1— the process ID is local; it does not need to match between routers.network <address> <wildcard> area <id>— any interface whose IP falls inside the range joins OSPF in that area. The network statement does not decide what is advertised by itself; it enables OSPF on matching interfaces, and their subnets are then advertised.- The wildcard is the inverted mask: /30 →
0.0.0.3, /24 →0.0.0.255. You can also match a single interface exactly:network 10.1.12.1 0.0.0.0 area 0.
Per-interface method (clearer)
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip ospf 1 area 0
Passive interfaces
A passive interface is advertised into OSPF but sends no Hellos — so no neighbour can form there. Use it on every LAN where there are no other routers (user VLANs, loopbacks):
R1(config-router)# passive-interface default
R1(config-router)# no passive-interface GigabitEthernet0/1
Advertising a default route
The edge router with the internet connection shares its default route with the rest of the area:
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
R1(config)# router ospf 1
R1(config-router)# default-information originate
Other routers then show O*E2 0.0.0.0/0.
Tuning
R1(config-router)# auto-cost reference-bandwidth 100000 ! same on all routers
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip ospf cost 10 ! override cost on one link
R1(config-if)# ip ospf priority 0 ! never become DR here
R1(config-if)# ip ospf network point-to-point ! no DR/BDR on a 2-router link
R1(config-if)# ip ospf hello-interval 5 ! must match the neighbour
Verify — in this order
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:36 10.1.12.2 GigabitEthernet0/1
R1# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/1 1 0 10.1.12.1/30 1 BDR 1/1
Gi0/0 1 0 192.168.10.1/24 1 DR 0/0
R1# show ip route ospf
R1# show ip protocols
R1# show ip ospf database
When a neighbour does not come up
| Symptom | Check |
|---|---|
| No neighbour at all | Interface passive? Interface in OSPF (show ip ospf interface brief)? Same subnet? ACL blocking 224.0.0.5? |
| Stuck in INIT | Hellos only arrive one way — ACL, VLAN or one-way link |
| Stuck in EXSTART/EXCHANGE | MTU mismatch |
| Neighbour flaps | Hello/dead timer mismatch, unstable link |
| Neighbour up but routes missing | Network not enabled in OSPF, wrong area, route filtered |
show ip ospf interface shows the timers, area, cost, network type and DR/BDR for each interface — compare the two sides.
OSPFv3 (IPv6) quick look
R1(config)# ipv6 unicast-routing
R1(config)# ipv6 router ospf 1
R1(config-rtr)# router-id 1.1.1.1
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ipv6 ospf 1 area 0
Key points
- Process ID is local; area and subnet must match.
networkstatements enable OSPF on matching interfaces (wildcard masks).- Make LAN interfaces passive; use
default-information originateat the edge. - Troubleshoot with
show ip ospf neighbor, thenshow ip ospf interface.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.