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
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
Open GNS3 and create a new project.
Drag and drop three routers (e.g., Cisco 7200 or C3725).
Connect the routers as shown in the diagram using Ethernet links.
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.