Config Lab: OSPF Router IDs
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.
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:
- If configured, use the explicitly configured setting found in OSPF configuration mode.
- If not, use the numerically highest interface IP address found on any loopback interface whose status is up/up.
- 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:
- Router R1: Set the RID to 1.1.1.1 using a command in OSPF config mode.
- Router R2: Set the RID by creating a loopback interface with IP address/mask 2.2.2.2/24.
- Router R3: Set the RID by configuring a new interface, G0/0, with IP address/mask 193.3.3.3/24. Take any necessary steps to make the interface work (up/up).
- 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.
hostname R1
!
interface GigabitEthernet0/0
ip address 172.16.1.1 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/0/0
ip address 172.16.12.1 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/1/0
ip address 172.16.13.1 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/2/0
ip address 172.16.14.1 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
Example 1: R1 Config
hostname R2
!
interface GigabitEthernet0/0
ip address 172.16.2.2 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/0/0
ip address 172.16.12.2 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
Example 2: R2 Config
hostname R3
!
interface GigabitEthernet0/1
ip address 172.16.2.3 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/0/0
ip address 172.16.13.3 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
Example 3: R3 Config
hostname R4
!
interface GigabitEthernet0/0
ip address 172.16.4.4 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet0/0/0
ip address 172.16.14.4 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
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:
- 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.
This Lab Supports Both CML-Free and CML-Personal!!!
The downloadable file listed here works in both CML-P or CML-F because it uses the IOL (router) and IOL-L2 (switch) reference platform images supported by both products as of CML V2.8. Note that these images also require less CPU and RAM than the other CML-P options.
Use the same general workflow as with Cisco Packet Tracer, as follows:
- Download the CML file (filetype .yaml) linked below.
- Import the lab’s CML file into CML.
- Start the lab in CML.
- Compare the CML lab topology and interface IDs to this lab Blog page, as they may differ (more detail below).
- Add your planned configuration to the lab, adjusting for interface ID differences.
- Test the configuration using some of the suggestions below.
Download this lab’s CML file!
Interface ID Differences:
The lab diagrams on this page use interface IDs (IIDs) that match the Packet Tracer version of the lab. When using CML, adjust the lab IIDs based on this table. Also, note that the IOL and IOL-L2 images used by the supplied CML file support only the “Ethernet” interface type, and not “FastEthernet” or “GigabitEthernet”.
The conventions for this lab are:
- Gigabit IIDs with two numbers (G0/0) convert to an Ethernet type with the same numbers, respectively. (For example, G0/0 becomes E0/0, G0/1 becomes E0/1.)
- Gigabit IIDs with a pattern of G0/x/0 convert Ethernet type, with two numbers, in the pattern “E1/x”, where x is the original middle digit. (For example, G0/1/0 becomes E1/1.)
Lab Port | Â CML Port |
G0/0 | E0/0 |
G0/1 | E0/1 |
G0/0/0 | E1/0 |
G0/1/0 | E1/1 |
G0/2/0 | E1/2 |
Config Lab Intro Video
The above lab intro – the text, figures, and initial configuration – tells you all you need to know. But if you want a little more, with a little different slant on what to do in this lab, watch this lab intro video!
Lab Answers Below: Spoiler Alert
Lab Answers: Configuration (Click Tab to Reveal)
Lab Answers
Figure 1: Topology for this Lab
router ospf 1
router-id 1.1.1.1
Example 1: R1 Config
interface loopback 1
ip address 2.2.2.2 255.255.255.0
no shutdown
Example 2: R2 Config
interface GigabitEthernet0/0
ip address 193.3.3.3 255.255.255.0
no shutdown
Example 3: R3 Config
! No Configuration - But Uses this Interface's Address as RID:
interface GigabitEthernet0/0/0
ip address 172.16.14.4 255.255.255.0
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. You need to configure the suggested IP address/mask. In Cisco Packet Tracer, you will also need to use the design tool to move another switch into the lab, and cable the router R3 G0/0 port to it, so that port G0/0 can reach an up/up state.
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.
Known Issues in this Lab w/ CML
This tab lists known issues with running this lab in CML with the supplied file. The issues are:
# | Summary | Detail |
1 | R3 G0/0 (new) interface reaches up/up state with no cable attached. | This lab asks you to use R3’s G0/0 interface. The lab begins with that port not cabled to anything. Real routers would leave the port in a down/down state after you issue the no shutdown command. CML’s convention is to place the port in an up/up state – which actually makes it more convenient to do the lab – but it differs from physical routers. |
Why Would CML Have Issues?
(Note: The text below is the same as every Config Lab.)
CML supports a variety of Cisco operating systems (called reference platforms.) To make them work in CML, Cisco makes some adjustments to the code. Also, because no real router or switch hardware exists, some software features do not work the same when running in CML versus a real Cisco device. When we come across any difference when testing the lab, we’ll try to leave a note just above in case it helps you with the 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.Â
- 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.
- Find the RID on each router using the show ip ospf command.
- Examine the RIDs of neighboring routers using the show ip ospf neighbor command.
- In CML, which runs IOS-XE in the routers, if you change the OSPF router-id OSPF-mode config command, you can update the router’s RID dynamically by using the clear ip ospf process-id EXEC command.
Config Lab Review Video
Want to hear more about this lab’s solution? Check out the video to the left.
I believe I found a bug in both Packet Tracer and CML. In Packet Tracer, I assigned the 193.3.3.3 /24 address on R3’s g0/0 interface and entered “no shutdown,” sans connecting it to another device. I checked the output of “show ip interface brief,” and it listed the g0/0 interface’s status as up/down. I feel like I’m being gaslit here, but to the best of my knowledge it should be in a down/down state since the interface isn’t receiving layer 1 traffic.
To add to my confusion, using the same commands in CML, R3 returns a status of up/up which is just patently wrong… I hope (otherwise, wow, I’m in trouble here).
Is it the software or is it me? I’m praying it’s the software.
Hi Dayne,
It’s not you 🙂
Real Cisco routers, nothing plugged into an interface, and you issue a no shutdown, it lands in a down/down state.
You would probably get a chuckle out of this post… where I asked almost the same thing years ago: https://learningnetwork.cisco.com/s/question/0D53i00000aW37qCAC/router-interface-link-state-remains-upup-when-it-should-be-downdown
Anyway, I confirmed that I see what you saw in Cisco Packet Tracer. I don’t have a handy CML instance to try these days. However, the link above confirms that same behavior. I will say that if you look around the CML support forums you might find more… I have a vague recollection that some later CML versions (which I have not used) have some tools that give some control to interface state. But I could be imagining it…