In this guide, I will explain step by step how to configure the OSPF Routing protocol on Cisco Routers using Cisco Packet Tracer. First, let me summarize: OSPF provides efficient network mapping and fast convergence. We also use it widely in WAN and business networks in case of router failure.
By following the steps in this article, you will learn how to enable OSPF routing on different segments. You will also see how to establish communication between these segments and how to verify the configuration.
How to Configure OSPF Routing on Cisco Router with Packet Tracer
OSPF (Open Shortest Path First) is a Link-State routing protocol that belongs to the Dynamic Routing class.
OSPF is a routing protocol used in WAN or business networks. This routing protocol maps the entire network using the SPF algorithm and provides a fast convergence as a result of a failure of a Router on the network. Another route is assigned to the networks connected to the failed Router, and the network is maintained.
In this article, we will enable the OSPF routing protocol on routers in two different segments of Packet Tracer.
Steps:
To configure the OSPF protocol, follow the steps below.
Step 1
Open Packet Tracer and create the topology as shown in the image below. Also, add comments to the workspace by defining IP address blocks and assigning IP addresses to computers.
Step 2
Open the Cisco Router R1 CLI command prompt and configure the GigabitEthernet0/0 and Serial0/0/0 interfaces according to the IP blocks you specify.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#
R1(config)#interface gigabitethernet 0/0
R1(config-if)#ip address 192.168.5.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#interface serial 0/0/0
R1(config-if)#ip address 10.1.1.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#end
R1#
Step 3
Configure the interfaces of Cisco Router R2 in the same way.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#
R2(config)#interface gigabitethernet 0/1
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
R2(config-if)#exit
R2(config)#interface serial 0/0/1
R2(config-if)#ip address 10.1.1.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/1, changed state to up
R2#
Step 4
Before enabling the routing protocol, Ping the segments to test the network connection.
Ping through R1 to Serial0/0/0 interface of R1 via PC1 will succeed, but ping to PC2 with IP address 192.168.10.10 in the other segment will fail.
Step 5
Ping from PC2 to R1’s Serial0/0/0 interface and PC1.
The reason for the ping error is that no routing protocol is configured on the routers.
Step 6
Use the following commands to enable OSPF Routing on Cisco Routers to communicate the two segments to each other.
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
R1(config)#router ospf 10
R1(config-router)#network 192.168.5.0 ?
A.B.C.D OSPF wild card bits
R1(config-router)#network 192.168.5.0 0.0.0.255 ?
area Set the OSPF area ID
R1(config-router)#network 192.168.5.0 0.0.0.255 area ?
OSPF area ID as a decimal value
A.B.C.D OSPF area ID in IP address format
R1(config-router)#network 192.168.5.0 0.0.0.255 area 0
R1(config-router)#network 10.1.1.0 0.0.0.3 area 0
R1(config-router)#end
R1#
Step 7
In the same way, after enabling OSPF Routing on Router R2, you can see that a neighbor is established between R1 and R2.
NOTE: Wildcard mask is used when adding network addresses for OSPF.
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#router ospf 10
R2(config-router)#network 10.1.1.0 0.0.0.3 area 0
R2(config-router)#network 192.168.
00:16:00: %OSPF-5-ADJCHG: Process 10, Nbr 192.168.5.1 on Serial0/0/1 from LOADING to FULL, Loading Done
^
% Invalid input detected at '^' marker.
R2(config-router)#network 192.168.10.0 0.0.0.255 area 0
R2(config-router)#end
R2#
Step 8
Execute the show ip route ospf 10 command on Router R1 and examine the routing table.
R1#show ip route ospf 10
O 192.168.10.0 [110/65] via 10.1.1.2, 00:00:37, Serial0/0/0
In addition, execute the show ip route command to see that the Routing protocol is identified by the letter O.
R1#
R1#show ip route
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, E - EGP
i - IS-IS, 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/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/30 is directly connected, Serial0/0/0
L 10.1.1.1/32 is directly connected, Serial0/0/0
192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.5.0/24 is directly connected, GigabitEthernet0/0
L 192.168.5.1/32 is directly connected, GigabitEthernet0/0
O 192.168.10.0/24 [110/65] via 10.1.1.2, 00:00:44, Serial0/0/0
R1#
Step 9
On R2, execute the command show ip route ospf 10 and show ip route.
R2#show ip route ospf 10
O 192.168.5.0 [110/65] via 10.1.1.1, 00:01:48, Serial0/0/1
Show ip route command output;
R2#show ip route
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, E - EGP
i - IS-IS, 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/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/30 is directly connected, Serial0/0/1
L 10.1.1.2/32 is directly connected, Serial0/0/1
O 192.168.5.0/24 [110/65] via 10.1.1.1, 00:01:53, Serial0/0/1
192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/1
L 192.168.10.1/32 is directly connected, GigabitEthernet0/1
R2#
Step 10
After configuring OSPF routing on the routers, Ping the computers again to check the network connection.
Pinging from 192.168.5.0/24 to 192.168.10.0/24 will succeed as follows.
Step 11
Similarly, Ping from the other segment will be successful.
Step 12
You can use debug ip ospf events in privileged mode to verify the routing protocol.
Step 13
Hello packets are sent to maintain neighborhood relationships between the two Routers.
Show Commands for OSPF Routing
- R1# show ip ospf database
- R1# show ip ospf interface
- R1# show ip ospf database router
- R1# show ip ospf 10
- R1# show running-config
- R1# debug ip ospf events
- R2# show ip ospf database
- R2# show ip ospf interface
- R2# show ip ospf database router
- R2# show ip ospf 10
- R2# show running-config
- R2# debug ip ospf events
Video
In the video below, you’ll find a comprehensive guide on how to enable and verify OSPF on your Router. Additionally, we’d appreciate it if you could subscribe to our YouTube channel to show your support!
Conclusion
In conclusion, I have explained all the details step by step for OSPF configuration with Packet Tracer. You have also learned how to enable OSPF on different segments.
However, you have also examined how to establish communication between segments and how to verify the configuration. In conclusion, if you have any questions, do not hesitate to refer to this guide or additional resources!