The OSPF network command can cause a bit of mental trouble for anyone just starting out. The reason: the first two parameters require us to do a little math, compare that result to the router’s interface IP addresses to then figure out what interfaces should be enabled for OSPF. It’s an indirect way to configure OSPF, but you need to know it. Today’s lab gives you two different sets of requirements, both designed to let you exercise your skills with the OSPF network command.
Config Lab: OSPF Network Config 1

The Lab Exercise
Requirements
Configure legacy OSPF (using network commands) between R1 and R2. This lab gives you two sets of requirements. Both use these rules:
- Configure each router with a router-id of x.x.x.x where x equals the router number.
- Use OSPF area 0
- Use an OSPF process-id number of 20
Supply a complete answer for both scenario 1 and scenario 2, as follows:
- Scenario 1: Each network command should match classful networks only, that is, match class A, B, and C networks
- Scenario 2: Each network command should match the subnets of the router interfaces
Figure 1: Two Routers with IP Subnets
Initial Configuration
Example 1 and 2 show the beginning configuration state of R1 and R2.
1 2 3 4 5 6 7 8 9 10 |
hostname R1 ! interface GigabitEthernet0/1 no shutdown ip address 192.168.4.1 255.255.255.240 ! interface GigabitEthernet0/2 no shutdown ip address 192.168.4.129 255.255.255.240 |
Example 1: R1 Config
1 2 3 4 5 6 7 8 9 |
hostname R2 ! interface GigabitEthernet0/1 no shutdown ip address 192.168.4.2 255.255.255.240 ! interface GigabitEthernet0/2 no shutdown ip address 192.168.2.193 255.255.255.240 |
Example 2: R2 Config
Answer Options - Click Tabs to Reveal
You can learn a lot and strengthen real learning of the topics by creating the configuration – even without a router or switch CLI. In fact, these labs were originally built to be used solely as a paper exercise!
To answer, just think about the lab. Refer to your primary learning material for CCNA, your notes, and create the configuration on paper or in a text editor. Then check your answer versus the answer post, which is linked at the bottom of the lab, just above the comments section.
You can also implement the lab using the Cisco Packet Tracer network simulator. With this option, you use Cisco’s free Packet Tracer simulator. You open a file that begins with the initial configuration already loaded. Then you implement your configuration and test to determine if it met the requirements of the lab.
(Use this link for more information about Cisco Packet Tracer.)
Use this workflow to do the labs in Cisco Packet Tracer:
- Download the .pkt file linked below.
- Open the .pkt file, creating a working lab with the same topology and interfaces as the lab exercise.
- Add your planned configuration to the lab.
- Test the configuration using some of the suggestions below.
You can also implement the lab using Cisco Modeling Labs – Personal (CML-P). CML-P (or simply CML) replaced Cisco Virtual Internet Routing Lab (VIRL) software in 2020, in effect serving as VIRL Version 2.
If you prefer to use CML, use a similar workflow as you would use if using Cisco Packet Tracer, as follows:
- Download the CML file (filetype .yaml) linked below.
- Import the lab’s CML file into CML and then start the lab.
- Compare the lab topology and interface IDs to this lab, as they may differ (more detail below).
- Add your planned configuration to the lab.
- Test the configuration using some of the suggestions below.
Network Device Info:
The CML topology matches the lab topology.
Lab Answers Below: Spoiler Alert
Lab Answers: Configuration (Click Tab to Reveal)
Answers
Figure 1: Two Routers with IP Subnets
Scenario 1
First, here are the answers for Scenario 1:
1 2 3 4 |
router ospf 20 router-id 1.1.1.1 network 192.168.4.0 0.0.0.255 area 0 |
Example 3: R1 Config
1 2 3 4 5 |
router ospf 20 router-id 2.2.2.2 network 192.168.4.0 0.0.0.255 area 0 network 192.168.2.0 0.0.0.255 area 0 |
Example 4: R2 Config
Scenario 2
And here are the answers for Scenario 2:
1 2 3 4 5 |
router ospf 20 router-id 1.1.1.1 network 192.168.4.0 0.0.0.15 area 0 network 192.168.4.128 0.0.0.15 area 0 |
Example 5: R1 Config, Scenario 2
1 2 3 4 |
router ospf 20 router-id 2.2.2.2 network 192.168.4.0 0.0.0.15 area 0 network 192.168.2.192 0.0.0.15 area 0 |
Example 6: R2 Config, Scenario 2
Commentary, Issues, and Verification Tips (Click Tabs to Reveal)
Commentary
The legacy method of configuring OSPF uses network statements inside of OSPF router configuration mode. This statement is used by the OSPF process to match the interfaces that will be included into the OSPF area specified. The alternative is to use commands inside interface configuration mode to specify that it will be included inside the OSPF area specified.
The most problematic area that people have with the legacy configuration of OSPF is with the network command, specifically the wildcard mask. The wildcard mask (as used with IP Access Control Lists, or ACLs) limits the parts of the interface IP addresses that is compared to the number in a network command.
Deeper Background
While this lab does not get into all the theory of wildcard masks, but I felt the need for a little more detail than normal in this case. To match all addresses in a classful network, you need to use one of three easily-understood wildcard masks. In particular:
- Class A: Wildcard mask 0.255.255.255 means “compare the first 1 octet, ignore the last 3”, which is useful for matching all addresses in a class A network
- Class B: Wildcard mask 0.0.255.255 means “compare the first 2 octets, ignore the last 2 octets”, which is useful for matching all addresses in a class B network
- Class C: Wildcard mask 0.0.0.255 means “compare the first 3 octets, ignore the last 1 octet”, which is useful for matching all addresses in a class C network
To match all addresses in the subnet connected to an interface, you have two calculate two values. First, calculate the subnet ID as usual. Then, calculate the wildcard mask by subtracting the subnet mask from 255.255.255.255. That is, if you subtract a subnet mask (in dotted decimal form) from 255.255.255.255, the resulting wildcard mask can be used when matching all packets in a subnet that uses that mask. For instance:
- To match subnet 10.1.1.0 255.255.255.0, use wildcard mask 0.0.0.255.
- To match subnet 10.1.1.0 255.255.255.192, use wildcard mask 0.0.0.63.
- To match subnet 10.1.1.0 255.255.255.224, use wildcard mask 0.0.0.31.
This Lab’s Answers: First Scenario
The first set of answers (Examples 3 and 4, for routers R1 and R3, respectively) show the first requirement: a configuration with each network command matching the IP addresses in each classful network. As it turns out, R1 connects to one classful network (192.168.4.0), so only the network 192.168.4.0 0.0.0.255 area 0 command is needed. Note that this command also sets the area number.
R2’s two subnets happen to sit in two different classful networks (192.168.4.0 and 192.168.2.0), requiring two network commands.
This Lab’s Answers: Second Scenario
The second set of examples (Examples 5 and 6, again for routers R1 and R2) show the solution with the requirement that each network command match only the addresses in a single subnet. To create this configuration, each network command uses the DDN subnet mask, subtracted from 255.255.255.255. In this case, that value is 0.0.0.15. So, in Example 5, for R1:
Network 192.168.4.0 0.0.0.15 area 0 – matches R1’s G0/1 interface (and all addresses in that subnet)
Network 192.168.4.128 0.0.0.15 area 0 – matches R1’s G0/2 interface (and all addresses in that subnet)
And on R2 (Example 6):
Network 192.168.4.0 0.0.0.15 area 0 – matches R2’s G0/1 interface (and all addresses in that subnet)
Network 192.168.2.192 0.0.0.15 area 0 – matches R2’s G0/2 interface (and all addresses in that subnet)
Known Issues in this Lab
This section of each Config Lab Answers post hopes to help with those issues by listing any known issues with Packet Tracer related to this lab. In this case, the issues are:
# | Summary | Detail |
1 | None | No known issues related to this lab. |
Why Would Cisco Packet Tracer Have Issues?
(Note: The below text is the same in every Config Lab.)
Cisco Packet Tracer (CPT) simulates Cisco routers and switches. However, CPT does not run the same software that runs in real Cisco routers and switches. Instead, developers wrote CPT to predict the output a real router or switch would display given the same topology and configuration – but without performing all the same tasks, an actual device has to do. On a positive note, CPT requires far less CPU and RAM than a lab full of devices so that you can run CPT on your computer as an app. In addition, simulators like CPT help you learn about the Cisco router/switch user interface – the Command Line Interface (CLI) – without having to own real devices.
CPT can have issues compared to real devices because CPT does not run the same software as Cisco devices. CPT does not support all commands or parameters of a command. CPT may supply output from a command that differs in some ways from what an actual device would give. Those differences can be a problem for anyone learning networking technology because you may not have experience with that technology on real gear – so you may not notice the differences. So this section lists differences and issues that we have seen when using CPT to do this lab.
Beyond comparing your answers to this lab’s Answers post, you can test in Cisco Packet Tracer (CPT) or Cisco Modeling Labs (CML). In fact, you can and should explore the lab once configured. For this lab, once you have completed the configuration, try these verification steps.
- Each router should have one OSPF neighbor, so verify that fact with the show ip ospf neighbor command.
- Each router should list one OSPF-learned route, which you can verify with the show ip route command. The route should list the other router’s LAN subnet as the destination subnet.
- Verify which interfaces are enabled for OSPF with the show ip ospf interface brief command.
Let me tell You a sad story ! There are no comments yet, but You can be first one to comment this article.
Write a comment