Config Lab: OSPF Router IDs

Wendell Odom
By Wendell Odom September 24, 2021 13:05

OSPF uses a router’s Router ID (RID) to identify each router. We see the RID in many OSPF verification commands, so using predictable, known OSPF RID values can help people operate networks. This lab asks you to configure the OSPF RID using multiple methods just to experience the different options.

All about Config Labs

The blog has a series of lab exercises called “Config Labs.” Each lab presents a topology with the relevant initial configuration for each device. The lab also lists new requirements, after which you should create the additional configuration to meet those requirements. You can do the lab on paper, in a text editor, or use software tools like Cisco Packet Tracer or Cisco Modeling Labs.

Once you have created your answer, you can click various tabs at the bottom of this post to see the lab answers, comments about the lab, and other helpful information.

The Lab Exercise

Lab Requirements

When the OSPF process starts on a router, the router chooses its OSPF RID based on rules checked in this order:

  1. If configured, use the explicitly configured setting found in OSPF configuration mode.
  2. If not, use the numerically highest interface IP address found on any loopback interface whose status is up/up.
  3. If not, use the numerically highest interface IP address found on any other interface whose status is up/up.

Note that the current RID setting on a router depends on the configuration when the OSPF process chooses its RID – which may not be the exact configuration that exists right now. For instance, if you change the OSPF RID through any methods on real Cisco routers, OSPF does not immediately change the RID. Changing the RID would be disruptive, causing neighbor relationships to fail. Instead, real routers wait for the next reload, power off/on, or an explicit request to clear the OSPF process.

For production networks, you would likely set the OSPF RID on the routers using a consistent method. This lab instead asks you to use all methods just so you can think about how to configure each. Configure the lab as follows:

  1. Router R1: Set the RID to 1.1.1.1 using a command in OSPF config mode.
  2. Router R2: Set the RID by creating a loopback interface with IP address/mask 2.2.2.2/24.
  3. Router R3: Set the RID by configuring a new interface, G0/0, with IP address/mask 193.3.3.3/24.
  4. Router R4: Do not configure any additional commands, but predict the RID it should use based on the initial configuration plus any default settings that matter.

 

Figure 1: Topology for this Lab

 

Initial Configuration

The configurations on the four routers show a minimal OSPF configuration. It uses mostly default OSPF settings, except that the configurations set the RID for each router.

Example 1: R1 Config

 

Example 2: R2 Config

 

Example 3: R3 Config

 

Example 4: R4 Config

 

The lab does not call for any switches or PCs. Note that if you add them yourself, you can use all default configurations in a Cisco switch for this lab, which would place all devices connected to a switch in the same VLAN.

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:

  1. Download the .pkt file linked below.
  2. Open the .pkt file, creating a working lab with the same topology and interfaces as the lab exercise.
  3. Add your planned configuration to the lab.
  4. Test the configuration using some of the suggestions below.

Download this lab’s Packet Tracer File

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:

  1. Download the CML file (filetype .yaml) linked below.
  2. Import the lab’s CML file into CML and then start the lab.
  3. Compare the lab topology and interface IDs to this lab, as they may differ (more detail below).
  4. Add your planned configuration to the lab.
  5. Test the configuration using some of the suggestions below.

Download this lab’s CML file!

 

Network Device Info:

This table lists the interfaces listed in the lab exercise documentation versus those used in the sample CML file.

Device Lab Port  CML Port
R1 G0/0/0 G0/3
R1 G0/1/0 G0/1
R1 G0/2/0 G0/2
R2 G0/0/0 G0/2
R3 G0/0/0 G0/2
R4 G0/0/0 G0/2

Lab Answers Below: Spoiler Alert

Lab Answers: Configuration (Click Tab to Reveal)

Lab Answers

 

Figure 1: Topology for this Lab

 

Example 1: R1 Config

 

Example 2: R2 Config

 

Example 3: R3 Config

 

Example 4: R4 Config

Commentary, Issues, and Verification Tips (Click Tabs to Reveal)

Lab Commentary

All the Config Labs follow a style guide. Two of those conventions include:

  • Describe what needs to be configured, but do not list the specific configuration commands.
  • The descriptions should be clear and direct so that when you use the lab, you exercise memories that connect the configuration concept to the specific command.

This lab shows a classic case of those conventions. First, it asks you to configure the RID in OSPF configuration mode. Your job? Remember the OSPF-mode router-id command. The lab asked you to set R1’s RID to 1.1.1.1, so the answer for router R1 shows the router-id 1.1.1.1 command in OSPF config mode.

Next, you need to recall how to create a loopback interface to meet the requirements for router R2. Example 2 shows how. Note that the lab does not tell you what loopback interface number to use – you can use any number in your configuration. However, to give router R2 a RID of 2.2.2.2, you must configure the loopback interface with 2.2.2.2 as its address.

For router R3, the requirements ask you to set the RID based on a non-loopback interface, specifically R3 interface G0/0 – an interface with no initial configuration.

Note that the answers show the no shutdown command on the interfaces, just to ensure you remember to enable the interfaces if you try these commands in lab. However, note that those interfaces should be administratively enabled (no shutdown) by default.

On router R4, the lab asked you to predict the RID it would use. R4 has two interfaces with IP addresses, with 172.16.14.4 as the numerically higher IP address. R4 would therefore use that IP address.

Finally, if you try this lab on real gear, simulator, or emulator, note that the configuration process may not cause OSPF to choose a new RID. If in lab, just save your configuration and reload. Alternately, try the clear ip ospf process command.

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 RID changes more quickly than real Packet Tracer changes the RID sooner than real gear, often as soon as you change the configuration that impacts the choice. Be aware of the difference.
2 RID does not change We have seen cases in which PT did not change the RID. If you see that, save the .pkt file, close the file, and open the file again.

 

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 owning 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. 

  1. To overcome any potential problems in CPT, save the configuration and then reload each router. Alternately, in CPT, you can save and then re-open the PT file.
  2. Find the RID on each router using the show ip ospf command.
  3. Examine the RIDs of neighboring routers using the show ip ospf neighbor command.

More Labs with Related Content!

Config Lab: OSPF Network Type
Config Lab: OSPF Metrics
Wendell Odom
By Wendell Odom September 24, 2021 13:05
Write a comment

11 Comments

  1. Pavel Rusanov December 18, 22:49

    Hi,

    When I changed IP address for GigabitEthernet0/1 on R3 it destroyed relationships between R3 and R2 because they in different networks now.

    Reply to this comment
    • certskills December 20, 10:45

      Hi Pavel,
      I agree; in short, the lab misdirected you on that one point.
      The particulars:
      The goal was to configure an unused interface on R3, but the lab mistakenly asked us to configure G0/1, which was already in use.
      The fix:
      I updated the lab to direct us to configure R3’s G0/0 interface, which is unused at the beginning of the lab.

      To all:
      No changes to the .pkt file, and the lab page is updated, ready to go.

      Thanks Pavel,
      Wendell

      Reply to this comment
  2. Mehdi January 10, 18:30

    For router R3, configuring the new and unused interface G0/0 will not make the router use it as its RID, the only way I see of making the objective happen is by shutting down the two other interfaces on the router, because they have the higher numeric value. That would ruin the network. Am I missing something?

    Reply to this comment
    • certskills January 14, 13:58

      Mehdi,
      You are absolutely correct. My mistake, the lab was wrong. It is now fixed, with R3’s G0/0 with IP address 193.3.3.3, making it the numerically highest IP address. Thanks much for noting the error.

      Reply to this comment
      • Tom November 21, 07:52

        This still not achive that the router-id from r3 changes to 193.3.3.3 because int gi0/0 is in up/down state because nothing is connected to that interface.

        Reply to this comment
        • Wendell Odom Author November 30, 17:34

          Thanks for the heads up, Tom! 🙂
          I’ll leave it as an exercise for you folks then to figure out how to make the R3 G0/0 reach an up/up state! Good learning.

          Reply to this comment
          • thejackripper January 27, 09:36

            ‘no keepalive’ inside the interface configuration
            but i see that it might need the config command ‘service internal’
            either way both don’t work on the cisco packet tracer.

  3. Punya Athma July 11, 06:51

    Hi,

    So, Router R3’s RID is set by configuring a new interface G0/0 with IP address/mask 193.3.3.3/24. Is this included in the initial configuration please???
    Thereby does Router R3 pick up the highest numeric IP address 193.3.3.3, from all other interfaces, as its RID???
    How it couldn’t be predicted, that, Router R4 would pick up, 193.3.3.3 the highest numeric address as its RID, instead of 172.16.14.4, the second highest IP address pls ???

    Tks v much.

    Reply to this comment
    • certskills July 15, 09:52

      Punya,
      That new address on R3, that begins 193, is a requirement of the lab. So it’s not in the initial config, but something you’re asked to do in lab. It’s listed in the answers section as well. See also the last paragraph behind the answers button for comments about causing real routers to make RID changes.
      Yes, R3 picks the highest IP address of all up/up non-loopbacks in this case, as it does not have a router-id command and does not have any up/up loopback interfaces.
      R4, or any router’s RID, can easily be predicted by applying the rules for OSPF. 1) Router-id command, 2) highest IP address of any up/up loopback interface, 3) highest IP address of any up/up non-loopback interface.

      Check out my books for the detail! 🙂

      Reply to this comment
  4. Matt Perry January 3, 12:12

    I am using the CML file for this exercise. Each router had the router-id sub-command in the running-config for the router ospf 1 command upon start up so the only way for me to reach the objectives was to no router-id them before running the clear ip ospf process command.

    Reply to this comment
View comments

Write a comment

Comment; Identify w/ Social Media or Email

Search

Categories