The default area in ospf is Area 0, it is also referred to as the backbone. To configure a subnet to be in a area simple change the number at the end of the network command.
Here is the config for R1:
interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 duplex half ! ! interface GigabitEthernet4/0 ip address 10.0.0.1 255.255.255.0 negotiation auto ! router ospf 1 log-adjacency-changes network 10.0.0.0 0.0.0.255 area 0 network 192.168.1.0 0.0.0.255 area 1 !
R2:
interface GigabitEthernet4/0 ip address 10.0.1.2 255.255.255.0 negotiation auto ! interface GigabitEthernet5/0 ip address 10.0.0.2 255.255.255.0 negotiation auto ! router ospf 1 log-adjacency-changes network 10.0.0.0 0.0.0.255 area 0 network 10.0.1.0 0.0.0.255 area 0 !
R3:
interface FastEthernet0/0 ip address 192.168.2.1 255.255.255.0 duplex half ! interface GigabitEthernet4/0 ip address 10.0.1.3 255.255.255.0 negotiation auto ! router ospf 1 log-adjacency-changes network 10.0.1.0 0.0.0.255 area 0 network 192.168.2.0 0.0.0.255 area 2 !
Routers that border the area 0 and other areas are called “ABRs” Area-Border-Routers:
R2#show ip ospf border-routers OSPF Process 1 internal Routing Table Codes: i - Intra-area route, I - Inter-area route i 192.168.1.1 [1] via 10.0.0.1, GigabitEthernet5/0, ABR, Area 0, SPF 6 i 192.168.2.1 [1] via 10.0.1.3, GigabitEthernet4/0, ABR, Area 0, SPF 6
To verify OSPF operation:
R2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.2.1 1 FULL/BDR 00:00:37 10.0.1.3 GigabitEthernet4/0 192.168.1.1 1 FULL/BDR 00:00:34 10.0.0.1 GigabitEthernet5/0 R2#show ip osp R2#show ip ospf R2#show ip ospf R2#show ip ospf ? <1-65535> Process ID number border-routers Border and Boundary Router Information database Database summary flood-list Link state flood list interface Interface information max-metric Max-metric origination information mpls MPLS related information neighbor Neighbor list request-list Link state request list retransmission-list Link state retransmission list rib Routing Information Base (RIB) sham-links Sham link information statistics Various OSPF Statistics summary-address Summary-address redistribution Information timers OSPF timers information traffic Traffic related statistics virtual-links Virtual link information | Output modifiers R2#show ip ospf data R2#show ip ospf database OSPF Router with ID (10.0.1.2) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 10.0.1.2 10.0.1.2 1597 0x80000004 0x004A89 2 192.168.1.1 192.168.1.1 1928 0x80000002 0x00E35F 1 192.168.2.1 192.168.2.1 1588 0x80000003 0x00023A 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.0.0.2 10.0.1.2 30 0x80000002 0x00485F 10.0.1.2 10.0.1.2 1597 0x80000001 0x004C5A Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 192.168.1.0 192.168.1.1 1936 0x80000001 0x00BDA8 192.168.2.0 192.168.2.1 1584 0x80000001 0x00ABB8
To troubleshoot problems with neighbors use the debug commands:
R2#debug ip ospf ? adj OSPF adjacency events capability OSPF Capability database-timer OSPF database timer events OSPF events flood OSPF flooding hello OSPF hello events lsa-generation OSPF lsa generation mpls OSPF MPLS nsf OSPF non-stop forwarding events packet OSPF packets retransmission OSPF retransmission events rib OSPF RIB spf OSPF spf tree OSPF database tree R2#debug ip ospf events OSPF events debugging is on *Apr 8 16:19:10.175: OSPF: Send hello to 224.0.0.5 area 0 on GigabitEthernet5/0 from 10.0.0.2 *Apr 8 16:19:12.091: OSPF: Send hello to 224.0.0.5 area 0 on GigabitEthernet4/0 from 10.0.1.2 *Apr 8 16:19:13.171: OSPF: Rcv hello from 192.168.1.1 area 0 from GigabitEthernet5/0 10.0.0.1 *Apr 8 16:19:13.171: OSPF: End of hello processing *Apr 8 16:19:16.371: OSPF: Rcv hello from 192.168.2.1 area 0 from GigabitEthernet4/0 10.0.1.3 *Apr 8 16:19:16.371: OSPF: End of hello processing *Apr 8 16:19:19.419: OSPF: Send hello to 224.0.0.5 area 0 on GigabitEthernet5/0 from 10.0.0.2 *Apr 8 16:19:21.219: OSPF: Send hello to 224.0.0.5 area 0 on GigabitEthernet4/0 from 10.0.1.2 *Apr 8 16:19:22.211: OSPF: Rcv hello from 192.168.1.1 area 0 from GigabitEthernet5/0 10.0.0.1 *Apr 8 16:19:22.211: OSPF: End of hello processing R2#debug ip ospf adj *Apr 8 16:28:35.631: OSPF: Interface GigabitEthernet5/0 going Up *Apr 8 16:28:35.651: OSPF: 2 Way Communication to 192.168.1.1 on GigabitEthernet5/0, state 2WAY *Apr 8 16:28:35.651: OSPF: Backup seen Event before WAIT timer on GigabitEthernet5/0 *Apr 8 16:28:35.655: OSPF: DR/BDR election on GigabitEthernet5/0 *Apr 8 16:28:35.655: OSPF: Elect BDR 10.0.1.2 *Apr 8 16:28:35.655: OSPF: Elect DR 192.168.1.1 *Apr 8 16:28:35.655: OSPF: Elect BDR 10.0.1.2 *Apr 8 16:28:35.655: OSPF: Elect DR 192.168.1.1 *Apr 8 16:28:35.659: DR: 192.168.1.1 (Id) BDR: 10.0.1.2 (Id) *Apr 8 16:28:35.659: OSPF: GigabitEthernet5/0 Nbr 192.168.1.1: Prepare dbase exchange R2(config-if)#^Z R2# *Apr 8 16:28:35.659: OSPF: Send DBD to 192.168.1.1 on GigabitEthernet5/0 seq 0xA5D opt 0x52 flag 0x7 len 32 *Apr 8 16:28:35.971: %SYS-5-CONFIG_I: Configured from console by console R2# *Apr 8 16:28:36.135: OSPF: Build router LSA for area 0, router ID 10.0.1.2, seq 0x80000007, process 1 R2# *Apr 8 16:28:37.607: %LINK-3-UPDOWN: Interface GigabitEthernet5/0, changed state to up *Apr 8 16:28:38.607: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet5/0, changed state to up R2# *Apr 8 16:28:40.295: OSPF: Send DBD to 192.168.1.1 on GigabitEthernet5/0 seq 0xA5D opt 0x52 flag 0x7 len 32 *Apr 8 16:28:40.295: OSPF: Retransmitting DBD to 192.168.1.1 on GigabitEthernet5/0 [1] *Apr 8 16:28:40.315: OSPF: Rcv DBD from 192.168.1.1 on GigabitEthernet5/0 seq 0x512 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Apr 8 16:28:40.319: OSPF: NBR Negotiation Done. We are the SLAVE *Apr 8 16:28:40.319: OSPF: GigabitEthernet5/0 Nbr 192.168.1.1: Summary list built, size 6 *Apr 8 16:28:40.319: OSPF: Send DBD to 192.168.1.1 on GigabitEthernet5/0 seq 0x512 opt 0x52 flag 0x2 len 152 *Apr 8 16:28:40.335: OSPF: Rcv DBD from 192.168.1.1 on GigabitEthernet5/0 seq 0x513 opt 0x52 flag 0x1 len 172 mtu 1500 state EXCHANGE *Apr 8 16:28:40.339: OSPF: Exchange Done with 192.168.1.1 on GigabitEthernet5/0 *Apr 8 16:28:40.339: OSPF: Send LS REQ to 192.168.1.1 length 24 LSA count 2 *Apr 8 16:28:40.339: OSPF: Send DBD to 192.168.1.1 on GigabitEthernet5/0 seq 0x513 opt 0x52 fl R2#ag 0x0 len 32 *Apr 8 16:28:40.355: OSPF: Rcv LS UPD from 192.168.1.1 on GigabitEthernet5/0 length 96 LSA count 2 *Apr 8 16:28:40.363: OSPF: We are not DR to build Net Lsa for interface GigabitEthernet5/0 *Apr 8 16:28:40.363: OSPF: Build network LSA for GigabitEthernet5/0, router ID 10.0.1.2 *Apr 8 16:28:40.363: OSPF: Build network LSA for GigabitEthernet5/0, router ID 10.0.1.2 *Apr 8 16:28:40.363: OSPF: Synchronized with 192.168.1.1 on GigabitEthernet5/0, state FULL *Apr 8 16:28:40.363: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on GigabitEthernet5/0 from LOADING to FULL, Loading Done *Apr 8 16:28:40.363: OSPF: Rcv LS REQ from 192.168.1.1 on GigabitEthernet5/0 length 36 LSA count 1 *Apr 8 16:28:41.139: OSPF: Build router LSA for area 0, router ID 10.0.1.2, seq 0x80000008, process 1 R2# *Apr 8 16:28:41.859: OSPF: Neighbor change Event on interface GigabitEthernet5/0 *Apr 8 16:28:41.859: OSPF: DR/BDR election on GigabitEthernet5/0 *Apr 8 16:28:41.863: OSPF: Elect BDR 10.0.1.2 *Apr 8 16:28:41.863: OSPF: Elect DR 192.168.1.1 *Apr 8 16:28:41.863: DR: 192.168.1.1 (Id) BDR: 10.0.1.2 (Id) R2#no debug ip ospf adj OSPF adjacency events debugging is off R2#
To see is OSPF is functioning properly look at the routing table:
R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 2 subnets C 10.0.0.0 is directly connected, GigabitEthernet5/0 C 10.0.1.0 is directly connected, GigabitEthernet4/0 O IA 192.168.1.0/24 [110/2] via 10.0.0.1, 00:33:40, GigabitEthernet5/0 O IA 192.168.2.0/24 [110/2] via 10.0.1.3, 00:28:05, GigabitEthernet4/0
Missing routes indicate either a neighbor relationship failure or missing “network” commands on routers. Note that the routes to 192.168.1.0/24 and 192.168.2.0/24 are marked as IA (inter-area) routes.