OSPF Single Area Configuration

Nerd Cafe

Introduction

Open Shortest Path First (OSPF) is a link-state routing protocol used in medium to large networks due to its scalability and fast convergence. In this guide, we will configure Single-Area OSPF in GNS3, step by step, using a practical topology.

Step 1: Network Topology & Scenario

We will use three routers (R1, R2, and R3), all belonging to OSPF Area 0 (Backbone Area).

Network Diagram

Topology
  • R1 connects to R2 using 192.168.12.0/30

  • R2 connects to R3 using 192.168.23.0/30

  • All routers will participate in OSPF Area 0

Step 2: Setting Up GNS3

  1. Open GNS3 and create a new project.

  2. Drag and drop three routers (e.g., Cisco 7200 or C3725).

  3. Connect the routers as shown in the diagram using Ethernet links.

  4. Assign IP addresses to interfaces.

Step 3: Configuring IP Addresses

  • Router 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
  • Router 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)#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
  • Router R3

R3#configure terminal
R3(config)#interface fastEthernet 1/0
R3(config-if)#ip address 192.168.23.2 255.255.255.252
R3(config-if)#no shutdown

Step 4: Configuring OSPF (Single Area 0)

  • Router R1

R1(config)#router ospf 1
R1(config-router)#network 192.168.12.0 0.0.0.3 area 0
  • Router R2

R2(config)#router ospf 1
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
  • Router R3

R3(config)#router ospf 1
R3(config-router)#network 192.168.23.0 0.0.0.3 area 0

Step 5: Verify OSPF Configuration

Check OSPF Neighbor Relationships

Run this command on all routers:

  • Router R1

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1      1   FULL/DR         00:00:39    192.168.12.2    FastEthernet0/0
  • Router R2

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.2      1   FULL/BDR        00:00:30    192.168.23.2    FastEthernet1/0
192.168.12.1      1   FULL/BDR        00:00:32    192.168.12.1    FastEthernet0/0
  • Router R3

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1      1   FULL/DR         00:00:38    192.168.23.1    FastEthernet1/0

Check OSPF Routing Table

Run this command on all routers:

  • Router R1

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

      192.168.23.0/30 is subnetted, 1 subnets
O        192.168.23.0 [110/2] via 192.168.12.2, 00:07:02, FastEthernet0/0
R1#
  • Router R2

R2#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

R2#
  • Router R3

R3#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

      192.168.12.0/30 is subnetted, 1 subnets
O        192.168.12.0 [110/2] via 192.168.23.1, 00:08:09, FastEthernet1/0
R3#

Step 5: Testing Connectivity

Ping from R1 to R3 to test end-to-end reachability:

R1#ping 192.168.23.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/48/80 ms
R1#

A successful ping means that OSPF has correctly learned and propagated routes.

Keywords

OSPF, single area, configuration, GNS3, routing, Cisco, neighbor adjacency, link-state, area 0, SPF algorithm, LSAs, network topology, IP addressing, OSPF process, routing table, cost metric, hello packets, DR/BDR, route propagation, troubleshooting, CCNP, CCNA, سیسکو

Last updated