Implementing Single-Area OSPF

Nerd Caf

Guide

As a Cisco CCNA Instructor, I will guide you through the process of implementing Single-Area OSPF (Open Shortest Path First) with a practical hands-on approach using Cisco Packet Tracer or real hardware.

Scenario:

Imagine you are a network engineer for a small company with three branch offices. You need to configure OSPF in a single area (area 0) to ensure efficient routing between the offices.

Network Topology:

We have 3 routers (R1, R2, and R3) connected in a triangular topology.

  • R1 is connected to R2 via the network 192.168.12.0/30

  • R2 is connected to R3 via the network 192.168.23.0/30

  • R1 is connected to R3 via the network 192.168.13.0/30

  • Each router has a loopback interface representing its unique router ID.

Topology

Step 1: Setup the Network in Packet Tracer

  1. Open GNS3.

  2. Add three routers (R1, R2, R3).

  3. Add three PCs (PC1, PC2, PC3) for testing connectivity.

  4. Connect them as follows:

    • R1 ↔ R2

    • R2 ↔ R3

    • R1 ↔ R3

    • Each router has a loopback interface (for OSPF Router-ID).

Step 2: Configure Basic Settings

Apply basic configurations on all routers.

On R1:

R1#configure terminal
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 192.168.13.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface loopback 0                                                                                        changed state to up
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.12.0 0.0.0.3 area 0
R1(config-router)#network 192.168.13.0 0.0.0.3 area 0
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

On R2:

R2#configure terminal
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 192.168.23.1 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface loopback 0                                                                                        changed state to up
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.12.0 0.0.0.3 area 0
R2(config-router)#network 192.168.23.0 0.0.0.3 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

On R3:

R3#configure terminal
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.13.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface fastEthernet 1/0
R3(config-if)#ip address 192.168.23.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.168.23.0 0.0.0.3 area 0
R3(config-router)#network 192.168.13.0 0.0.0.3 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

Step 3: Verify OSPF Configuration

Checking OSPF Neighbors

Run the following command on each router:

  • R1

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:39    192.168.13.2    FastEthernet1/0
2.2.2.2           1   FULL/BDR        00:00:32    192.168.12.2    FastEthernet0/0
R1#
  • R2

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:35    192.168.23.2    FastEthernet1/0
1.1.1.1           1   FULL/DR         00:00:34    192.168.12.1    FastEthernet0/0
R2#
  • R3

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:33    192.168.13.1    FastEthernet0/0
2.2.2.2           1   FULL/DR         00:00:31    192.168.23.1    FastEthernet1/0
R3#

Checking OSPF Routing Table

R1#show ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 192.168.12.2, 00:07:19, FastEthernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/2] via 192.168.13.2, 00:03:54, FastEthernet1/0
      192.168.23.0/30 is subnetted, 1 subnets
O        192.168.23.0 [110/2] via 192.168.13.2, 00:03:54, FastEthernet1/0
                      [110/2] via 192.168.12.2, 00:07:29, FastEthernet0/0
R1#

Each router should have OSPF routes learned from other routers.

Testing Connectivity

  • Ping from R1 to R2,3's loopback:

R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/22/36 ms
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/12/32 ms
R1#

Keywords

OSPF, single-area OSPF, OSPF configuration, OSPF adjacency, OSPF routing, Cisco OSPF, OSPF area 0, OSPF neighbor, OSPF cost, OSPF passive interface, OSPF router ID, OSPF topology, OSPF verification, OSPF troubleshooting, OSPF commands, OSPF network types, OSPF protocol, OSPF metrics, OSPF Packet Tracer, OSPF route table, سیسکو

Last updated