Configure OSPF Between Three Routers in Cisco Packet Tracer

Configure OSPF Between Three Routers in Cisco Packet Tracer
Networking ATN Campus November 03, 2026 8 views

Configure OSPF Between Three Routers in Cisco Packet Tracer

Learn how to configure OSPF (Open Shortest Path First) between three Cisco routers using Packet Tracer. In this beginner-friendly lab, you will configure router interfaces, enable OSPF, advertise networks, and verify dynamic routing between multiple LANs.


1. What Is OSPF?

OSPF (Open Shortest Path First) is a dynamic routing protocol used by routers to exchange routing information and determine the best path to reach destination networks.

Unlike static routing, OSPF automatically learns routes from neighboring routers. It uses a link-state routing algorithm and calculates the shortest path using the cost metric.

Why Use OSPF?

  • Automatically discovers routes between routers.
  • Supports large and complex networks.
  • Provides fast convergence when network changes occur.
  • Supports route summarization and multiple areas.
  • Uses cost to select the best path.

2. Lab Requirements

For this practical lab, you need:

  • Cisco Packet Tracer
  • 3 Cisco routers (for example, 2911)
  • 3 switches (2960)
  • 3 PCs
  • Ethernet cables

3. Network Topology

We will connect three routers in a linear topology. Each router connects to its own LAN.

 PC1                 PC2                 PC3
  |                   |                   |
 SW1                 SW2                 SW3
  |                   |                   |
 R1 ----------- R2 ----------- R3
       Link 1          Link 2
    

Each router will advertise its connected networks using OSPF Area 0.

4. IP Addressing Table

Device Interface IP Address Subnet Mask
R1G0/0192.168.1.1255.255.255.0
R1G0/110.0.12.1255.255.255.252
R2G0/0192.168.2.1255.255.255.0
R2G0/110.0.12.2255.255.255.252
R2G0/210.0.23.1255.255.255.252
R3G0/0192.168.3.1255.255.255.0
R3G0/110.0.23.2255.255.255.252

PC Configuration

PCIP AddressSubnet MaskDefault Gateway
PC1192.168.1.10255.255.255.0192.168.1.1
PC2192.168.2.10255.255.255.0192.168.2.1
PC3192.168.3.10255.255.255.0192.168.3.1

Note: The example assumes routers with the listed GigabitEthernet interfaces. Interface names may differ depending on the Packet Tracer router model.

5. Step 1 – Configure Router R1

Open R1 CLI and configure its LAN and R2-facing interfaces.

enable
configure terminal

interface gigabitEthernet 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit

interface gigabitEthernet 0/1
ip address 10.0.12.1 255.255.255.252
no shutdown
exit
    

6. Step 2 – Configure Router R2

R2 connects to both R1 and R3, so it needs three configured interfaces.

enable
configure terminal

interface gigabitEthernet 0/0
ip address 192.168.2.1 255.255.255.0
no shutdown
exit

interface gigabitEthernet 0/1
ip address 10.0.12.2 255.255.255.252
no shutdown
exit

interface gigabitEthernet 0/2
ip address 10.0.23.1 255.255.255.252
no shutdown
exit
    

7. Step 3 – Configure Router R3

enable
configure terminal

interface gigabitEthernet 0/0
ip address 192.168.3.1 255.255.255.0
no shutdown
exit

interface gigabitEthernet 0/1
ip address 10.0.23.2 255.255.255.252
no shutdown
exit
    

8. Step 4 – Enable OSPF on R1

Now enable OSPF process 1 and advertise R1's connected networks in Area 0.

configure terminal

router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 10.0.12.0 0.0.0.3 area 0
exit
    

Explanation:

  • router ospf 1 starts OSPF process 1.
  • network identifies interfaces whose addresses match the specified range.
  • 0.0.0.255 is the wildcard mask for a /24 network.
  • area 0 places the matching interfaces in the OSPF backbone area.

9. Step 5 – Enable OSPF on R2

configure terminal

router ospf 1
network 192.168.2.0 0.0.0.255 area 0
network 10.0.12.0 0.0.0.3 area 0
network 10.0.23.0 0.0.0.3 area 0
exit
    

10. Step 6 – Enable OSPF on R3

configure terminal

router ospf 1
network 192.168.3.0 0.0.0.255 area 0
network 10.0.23.0 0.0.0.3 area 0
exit
    

11. Step 7 – Verify OSPF Neighbors

Use the following command on each router:

show ip ospf neighbor
    

Expected neighbor relationships:

  • R1 should discover R2.
  • R2 should discover R1 and R3.
  • R3 should discover R2.

On broadcast or point-to-point Ethernet links, the neighbor state commonly reaches FULL. Exact displayed details depend on the interface network type and router IDs.

12. Step 8 – Check the Routing Table

Run this command:

show ip route
    

Look for routes marked with the letter O. This indicates routes learned through OSPF.

O 192.168.2.0/24 ...
O 192.168.3.0/24 ...
    

The exact next-hop addresses and metrics depend on the topology and interface configuration.

13. Step 9 – Test Connectivity

Open PC1's command prompt and ping PC3:

ping 192.168.3.10
    

Also test PC1 to PC2:

ping 192.168.2.10
    

If addressing, interfaces, and OSPF are configured correctly, the PCs should communicate across the three routers. If the first ping fails, try again after ARP and routing information have settled.

14. Common OSPF Troubleshooting

ProblemPossible Solution
OSPF neighbor not appearingCheck interface status, IP addressing, subnet masks, and OSPF area.
Interface is downUse no shutdown and check the cable.
Remote network missingCheck OSPF network statements and wildcard masks.
PC cannot ping another LANCheck PC IP addresses, default gateways, and router routes.
Neighbor stuck in a stateCheck OSPF parameters, MTU compatibility, timers, and network type.

Useful commands:

show ip interface brief
show ip ospf neighbor
show ip protocols
show ip route
show running-config
    

15. Save the Router Configuration

Save the configuration on all three routers:

copy running-config startup-config
    

16. Frequently Asked Questions

What is OSPF Area 0?

Area 0 is the OSPF backbone area. In this beginner lab, all three routers operate in Area 0.

What does the O in the routing table mean?

The letter O identifies a route learned through OSPF.

Do all three routers need OSPF enabled?

Yes. Each router must participate in OSPF on the relevant links to exchange routing information in this lab.

What is a wildcard mask?

A wildcard mask tells OSPF which interface IP addresses should match a network statement. It is the inverse of the subnet mask.

17. Practice Challenge

Try completing these tasks without copying the configuration:

  1. Add a fourth router to the topology.
  2. Create another LAN behind the new router.
  3. Advertise its network using OSPF Area 0.
  4. Verify that PC1 can ping the new LAN.
  5. Use show ip route to identify the learned route.

Conclusion

In this lab, you learned how to configure OSPF between three Cisco routers using Packet Tracer. You configured router interfaces, advertised networks, verified OSPF neighbors, checked routing tables, and tested end-to-end connectivity.

Practicing dynamic routing is an important step toward understanding enterprise networking and preparing for Cisco CCNA and CCNP certifications.

Learn Networking with ATN Campus

Want to improve your networking skills? ATN Campus helps students build practical networking knowledge through theory, configuration exercises, and hands-on labs.

  • CCNA and CCNP Training
  • Network Routing and Switching
  • Subnetting and IP Addressing
  • Network Security and CEH
  • Python for Network Automation
  • Practical Cisco Packet Tracer Labs

???? Want to learn networking? Visit ATN Campus.

???? Learn Networking. ???? Master Routing & Switching. ???? Practice with Real Labs. ???? Prepare for Certifications. ???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS