single-area-ospf-featured-image

CCNA Lab: Configuring Single-area OSPF

Lab Overview

This free CCNA lab is all about OSPF – a widely used and beloved routing protocol. I wanted to write this post to help some of you learn how to configure OSPF on Cisco routers. I hope this post will be especially helpful to those of you studying for the CCNA. For this guide, I will be using Packet Tracer version 8.0. If you don’t already have Packet Tracer installed, you can download it for free from the Cisco Networking Academy website.

In this post, I cover the following:

I have provided packet tracer labs to go with this post. If you already know OSPF, I encourage you to attempt it before seeing the solution. If not, feel free to download the starter file and follow along. You can download them from the links below.

Configuring OSPF for IPv4

Above is the topology we are going to be working with for this lab. There are 4 separate routers, all with a separate LAN attached. Each router also has a configured loopback address. Below is a table showing the addressing scheme. Also, note that each router is connected to its neighbor with a /30 subnet.

R1R2R3R4
Loopback1.1.1.12.2.2.23.3.3.34.4.4.4
LAN10.1.1.0 /2410.1.2.0 /2410.1.3.0 /2410.1.4.0 /24
GatewayG0/1, 10.1.1.254G0/2, 10.1.2.254G0/1, 10.1.3.254G0/0, 10.1.4.254

Objectives:
1) Configure OSPF on each router using a process ID of 1.
2) Configure a router-id of the highest loopback address.
3) Advertise each directly connected network using the network command in Area 0.
4) Advertise the loopbacks in interface configuration mode, in Area 0 (don’t use network command in ospf config).
5) Ping router loopbacks to verify Router connectivity.
6) Verify PC connectivity by pinging from various PCs to PCs on another network.

Note: Everything in this topology has been configured except OSPF. The only thing you need to do is to configure OSPF to allow each network to communicate with each other.

1Configuring the OSPF Process

To begin OSPF configuration we need to configure the router OSPF process. We do that with the following commands:

Example:
R1(config)# router ospf {process ID}
R1(config-router)#  

Config:
R1(config)# router ospf 1
R1(config-router)#  

Unlike other routing protocols, the process ID is unique to the local router, so it does not matter if other routers are configured with the same process ID. I have asked you to configure them all with the same process ID to prove that point.

2. Configuring Router ID

OSPF uses router ids to identify routers. By default, the router-id is set to the highest configured loopback, or the highest configured physical interface if there is no loopback. It can also be configured using the router-id command inside the OSPF process. It is best practice to configure a loopback, then use the router-id command with the loopback address. In this lab, the loopback interface is already configured so you simply set the router-id to the loopback configured on the routers.

R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1

3. Advertising Directly Connected Networks into Area 0

There are a couple of ways to advertise networks connected to the router. You can use the network command inside the OSPF process and specify the network address and wildcard, for example, network 192.168.1.0 0.0.0.255 area 0 would advertise the 192.168.1.0/24 network into OSPF.

Alternatively, you can simply use network 0.0.0.0 255.255.255.255 area 0 to advertise all networks attached to the router. In this lab, I ask you to use the first example method, as it is best practice and more commonly used. (Note: you will not advertise the loopback this way in this lab, although you could)

R1(config)# router ospf 1
R1(config-router)# network 10.1.1.0 0.0.0.255 area 0 (LAN)
R1(config-router)# network 172.16.1.0 0.0.0.3 area 0 (network between R1 & R2)

You will need to complete the OSPF configurations for R2, R3, and R4 yourself.

4. Advertising the Loopbacks through the Interface

Another way to advertise networks is on a per-interface basis. If you go to configuration mode, you can use the command ip ospf {process id} area {area} to configure the interface for OSPF. For example, ip ospf 1 area 0 configures the interface for OSPF process 1 in area 0. I have asked you to configure the loopbacks on all routers using this method.

R1(config)# interface lo0
R1(config-if)# ip ospf 1 area 0

5. Pinging Router Loopbacks to Verify Connectivity

With step 4 completed, the basic OSPF configuration is complete. We can now ping between the routers to verify connectivity. I ask you to ping loopbacks, but you can also ping interface IP addresses if you wish. Below you can see some successful pings.

6. Pinging between PCs

You can also hop into the command prompt on some of the PCs and ping between them to verify remote network connectivity. The PCs are configured for DHCP, so you’ll need to find the IP address under the IP configuration area. Your first pings may drop as the packets traverse the networks, but all pings should be successful after that.

Configuring OSPF for IPv6

Above is the topology we are going to be configuring for the IPv6 lab. I decided not to overcomplicate the topology by adding LANs. This is a pure IPv6 network, meaning there are no IPv4 addresses configured.

Objectives:
1) Configure OSPFv3 process using process ID 1
2) Configure a router-id for each router
3) Configure networks to be in Area 0, including the loopbacks.
4) Very router connectivity by pinging loopbacks

Note: Everything in this topology has been configured except OSPFv3. The only thing you need to do is to configure OSPFv3 to allow each network to communicate with each other. I will be using R1 as my command example.

1) Configuring the OSPF Process

Because we are configuring OSPF in an IPv6 only network, we’ll only be using the IPv6 version of the commands. To begin the OSPF configuration, we’ll need to start the OSPF process by using the ipv6 router ospf {process id} command.

R1(config)# ipv6 router ospf 1
R1(config-rtr)# 

2) Configuring Router IDs

Router IDs work similarly in OSPFv3 as it does in OSPFv3 for IPv4. They both use 32-bit addresses. You may have noticed that when you started the OSPF process, the router displayed some text indicating there are no IPv4 addresses configured and asking you to manually configure one. Because this is an IPv6 only network, there are no IPv4 addresses the router can use automatically for its router ID. Meaning, we need to manually configure one.

R1(config)# ipv6 router ospf 1
R1(config-rtr)# router-id 1.1.1.1

I like to use router IDs exactly the same way I do in IPv4, so I’ve chosen to use the 1.1.1.1, 2.2.2.2, etc, scheme.

3) Configuring Networks to be in Area 0

One difference between OSPFv2 and OSPFv3 is the way you advertise networks. In OSPFv3, the network command is not used. Instead, networks are advertised directly on the interfaces. OSPFv3 also uses link-local addresses to establish neighbor relationships instead of the configured IP address of the interface. However, it is still very similar to the way you do it in OSPFv2. Instead of using ip ospf {process ID} area {area}, you use ipv6 ospf {process ID} area {area}.

R1(config)# interface Gi0/0
R1(config-if)# ipv6 ospf 1 area 0

You’ll need to do this on every interface you want to be included in the OSPF process.

4) Verifying Connectivity

With Step 3 completed, we’ve finished the basic OSPFv3 configuration (assuming you’ve configured all routers, not just R1). You can now verify connectivity by pinging any loopbacks, or even interfaces on other networks.

Troubleshooting

If you’re having trouble completing the labs, below are some commands that may help you find the problem.

IPv4
show ip protocols
show ip ospf neighbors
show ip ospf interface
show ip ospf brief
show ip route

IPv6
show ipv6 protocols
show ipv6 ospf neighbors
show ipv6 ospf interface
show ipv6 ospf brief
show ipv6 route

It is also worth mentioning that OSPF has some requirements in order to work:

  • Area ID must match
  • Router IDs must be different
  • Hello and Dead Timer intervals must match

All three of the above things are already true in the start file, but it is important to know and that could be a possible problem you face in the future. You can check for those things using the show ip ospf interface command. It will show all of the above information for each interface configured for OSPF.

Note: Packet Tracer can often have buggy behavior. If you cannot ping but are certain the configuration is correct, try saving and restarting Packet Tracer. Sometimes this is the case, but someone studying for the CCNA may not have the knowledge to recognize if it is a Packet Tracer bug or a configuration issue.

Thanks for Reading!

If you’ve gotten this far, thanks for reading. I hope this post has helped you understand how to get a basic OSPF configuration working. If you believe there is something wrong with the initial configuration, please contact me via my contact form to let me know.

Full Configuration

The full configurations for both labs can be found on my GitHub.

Scroll to Top