Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 19

Configuring Single-Area OSPF on Cisco Routers

Recommended resources

Hello! In our last session, we explored the critical roles of the Designated Router (DR) and Backup Designated Router (BDR) in making OSPF efficient on multi-access networks. We saw that this election isn't just a technical curiosity; it's a core mechanism for scalability.

Today, we're moving from theory to practice. This lesson is all about getting your hands on the virtual keyboard to implement a fundamental OSPF network. We will walk through the essential commands to enable and configure single-area OSPF on Cisco routers. This is a foundational skill for your project, as it will allow your different network segments to communicate dynamically.

By the end of this 60-minute lesson, you will be able to configure a complete, functional single-area OSPF network on a set of Cisco routers.

The Three Core Steps of OSPF Configuration

Configuring single-area OSPF involves three primary steps, which we'll build upon using the topology below as our guide.

This network diagram shows three routers (R1, R2, R3) all within OSPF Area 0. We will use this as our reference for configuration examples.

The fundamental steps are:

  1. Enable the OSPF process on the router.
  2. Establish a unique Router ID (RID) for identification.
  3. Specify which interfaces will participate in OSPF and in which area.

Let's break down each step.


Step 1: Enable the OSPF Process

First, you need to "turn on" OSPF on the router. This is done from global configuration mode.

R1> enable
R1# configure terminal
R1(config)# router ospf <process-id>
R1(config-router)#

The router ospf <process-id> command initiates the OSPF routing process.

  • The Process ID is a number from 1 to 65,535.
  • This ID is locally significant, meaning it does not have to match on neighboring routers for them to form an adjacency. It's used by the router to distinguish between multiple OSPF processes if you were running them (which is rare). A common practice is to use the same process ID across your network for consistency.

The video below from Practical Networking demonstrates this first simple step.

OSPF Configuration & Show Commands - Practical OSPF

This clip from "OSPF Configuration & Show Commands" shows how to enable the OSPF process and use show ip protocols to verify that it has started.

Watch the segment from enabling OSPF. Notice how the output of show ip protocols changes after the router ospf command is entered.


Step 2: Establish the Router ID (RID)

As we learned in the last lesson, the RID is a unique 32-bit number in IP address format that identifies a router within the OSPF domain. It's crucial for functions like the DR/BDR election. A router determines its RID using the following priority order:

  1. The value configured explicitly with the router-id <A.B.C.D> command. (Highest Priority - Best Practice)
  2. The highest IP address of any configured loopback interfaces that are "up". (Good Practice)
  3. The highest IP address of any other active, non-loopback interfaces. (Lowest Priority - Least predictable)

For a stable network, you should never leave the RID selection to chance. Best practice is to set it manually. The following reading and video demonstrate the two best ways to do this.

Implementing OSPFv2 Using network Commands - Cisco Press

This section from the Cisco Press article "Implementing OSPFv2" clearly outlines the RID selection process and provides configuration examples for both the explicit router-id command and using a loopback interface.

Read the section titled "Configuring the OSPF Router ID." Focus on the three-step process the router uses to choose its RID and the configuration examples for R1 and R2.

The following video from Jeremy's IT Lab provides a practical demonstration of using loopback interfaces to set the RID. This is a very common and effective method.

FREE CCNA Lab 054: OSPF (Part 1: Single Area)

This clip from "FREE CCNA Lab 054: OSPF (Part 1: Single Area)" shows why and how to configure loopback interfaces to serve as stable Router IDs.

Watch from configuring loopbacks. Pay attention to why it's best to configure these before starting the OSPF process.


Step 3: Enable OSPF on Interfaces

This is the most critical step, where you tell the router which of its networks should be advertised and which interfaces should start sending Hello packets. There are two popular methods to achieve this.

Method 1: The network Command (Traditional)

The traditional way is using the network command within the OSPF router configuration mode.

R1(config-router)# network <ip-address> <wildcard-mask> area <area-id>

A common point of confusion is that this command does not advertise a network. Instead, it finds any interface on the router whose IP address matches the ip-address and wildcard-mask combination and enables OSPF on that interface. The network and mask configured on the interface itself are what get advertised.

  • Wildcard Mask: An inverted subnet mask. A 0 means the corresponding bit in the IP address must match, and a 1 means it can be anything. For example, 0.0.0.255 means the first three octets must match. A mask of 0.0.0.0 requires an exact IP address match.

The following resources provide excellent explanations of this command.

Implementing OSPFv2 Using network Commands - Cisco Press

This section of the Cisco Press article provides a detailed explanation of how wildcard masks work with the network command, including a very helpful table with examples.

Read the section titled "Wildcard Matching with the network Command." The table showing different network commands and their matched interfaces is particularly useful.

OSPF Configuration & Show Commands - Practical OSPF

The "OSPF Configuration & Show Commands" video provides a step-by-step demonstration of using the network command with different wildcard masks.

Watch these two segments: Specific match: See how to enable OSPF on a single interface using a 0.0.0.0 wildcard mask. Range match: This demonstrates using a wider wildcard mask (0.0.255.255) to enable OSPF on multiple interfaces with a single command.

This image shows the `router ospf` and `network` commands in action on a Cisco router's command-line interface.

Method 2: The Interface Command (Modern)

A more direct and often preferred method is to enable OSPF directly on the interface itself.

R1(config)# interface <interface-name>
R1(config-if)# ip ospf <process-id> area <area-id>

This command explicitly enables OSPF on the interface, assigning it to the specified process and area. It is less prone to error than wildcard masks, especially in complex networks.

The "OSPF Configuration & Show Commands" video demonstrates this method clearly.

OSPF Configuration & Show Commands - Practical OSPF

This final clip from Practical Networking shows how to enable OSPF directly on an interface and how to use the interface range command for efficiency.

Watch from the interface method. Note how this method achieves the same goal as the network command but in a more explicit way.

Key Point: If you configure both methods for the same interface, the direct interface-level command (ip ospf...) takes precedence over the network command.


Let's Configure!

Now, let's apply these steps to our reference topology. We will configure R1 together, and then you can try configuring R2 and R3.

Configuration for R1:
We'll use a loopback for the RID and the traditional network command.

! Enter global configuration mode
R1# configure terminal

! Configure loopback for a stable Router ID
R1(config)# interface Loopback0
R1(config-if)# ip address 1.1.1.1 255.255.255.255
R1(config-if)# exit

! Enable OSPF process 1
R1(config)# router ospf 1

! Enable OSPF on interfaces in the 192.168.12.0/24 and 192.168.13.0/24 subnets
R1(config-router)# network 192.168.12.0 0.0.0.255 area 0
R1(config-router)# network 192.168.13.0 0.0.0.255 area 0
R1(config-router)# end

Now, try to write the configurations for R2 and R3. Use these details:

  • R2: Use RID 2.2.2.2 (via a loopback) and the ip ospf 1 area 0 command on its two active interfaces.
  • R3: Use RID 3.3.3.3 (via a loopback) and network commands with 0.0.0.0 wildcard masks for its two interfaces.

After applying the configurations, the routers will start sending Hello packets, form neighbor adjacencies, and exchange routes. We can quickly verify this.

FREE CCNA Lab 054: OSPF (Part 1: Single Area)

This clip from Jeremy's IT Lab shows the final result: verifying neighbor relationships and checking the routing table.

Watch from the verification. The two key commands shown are show ip ospf neighbor and show ip route. You should see neighbors in a FULL state and routes marked with an "O" for OSPF.


Conclusion

In this lesson, we bridged the gap from theory to practice, configuring a live single-area OSPF network. You now have the essential commands to build the routing foundation for your project.

Key Takeaways:

  • OSPF Configuration is a 3-step process: Enable the process (router ospf), set a stable Router ID (best done with router-id or a loopback), and enable OSPF on interfaces.
  • Two methods exist for enabling interfaces:
    • The traditional network <ip> <wildcard> area <id> command, which matches interfaces based on a range.
    • The modern ip ospf <pid> area <id> interface command, which is more explicit and often preferred.
  • Configuration is just the first half: Verification using commands like show ip ospf neighbor and show ip route is essential to confirm that your network is operating as intended.

In our next lesson, we will perform a deep dive into verifying OSPF configurations. We'll explore a full suite of show commands that allow you to inspect every aspect of the OSPF process, from neighbor states and database tables to interface-specific settings, giving you the skills to troubleshoot and confirm your network's health.