📘 CCNA 200-301 v1.1
3.4 Configure and verify single area OSPFv2
3.4.d Router ID
What is the Router ID (RID)?
In OSPF (Open Shortest Path First), every router needs a unique identifier called the Router ID (RID).
- The Router ID is a 32-bit number, written in IPv4 address format (like 1.1.1.1).
- It does not have to be a real IP address assigned to an interface, but it must be unique within the OSPF domain (area or network where OSPF is running).
- OSPF uses the Router ID to identify each router in the OSPF network.
- Think of it like the “name” or “identity” of the router inside the OSPF process.
🧠 Why is the Router ID Important?
The Router ID is used in several key OSPF operations:
- Neighbor relationships:
Routers use the RID to identify each other when forming adjacencies.
Example: When RouterA and RouterB become OSPF neighbors, they identify each other using their RIDs. - LSA (Link-State Advertisement) generation:
Each router includes its RID in LSAs it generates.
LSAs are used to share network topology information. - Database synchronization:
The OSPF database uses the RID to track which router originated each LSA. - DR/BDR election:
In broadcast and multi-access networks, the Router ID is used during the Designated Router (DR) and Backup Designated Router (BDR) election process.
So, without a proper Router ID, OSPF can’t build or maintain the correct topology information.
⚙️ How OSPF Chooses the Router ID
When you enable OSPF on a Cisco router, it automatically selects a Router ID based on a specific order of preference.
Router ID Selection Order:
- Manually configured Router ID (highest priority)
- Highest IP address on a loopback interface
- Highest IP address on an active (physical) interface
Let’s break this down:
1️⃣ Manually configured Router ID
You can manually set the Router ID under the OSPF process.
This is the most recommended and reliable method.
Router(config)# router ospf 1
Router(config-router)# router-id 1.1.1.1
✅ Once configured, this ID will always be used, even if interfaces go down or change.
❗ After changing the Router ID, you must reset the OSPF process for the change to take effect:
Router(config-router)# clear ip ospf process
2️⃣ Highest IP address on a loopback interface
If no manual Router ID is set, OSPF automatically looks for any loopback interface on the router.
It then selects the highest IP address among all loopback interfaces.
Loopback interfaces are virtual interfaces that are always up (unless shut down), which makes them stable and reliable.
That’s why OSPF prefers them over physical interfaces.
Example:
| Interface | IP Address | Type |
|---|---|---|
| Loopback0 | 2.2.2.2 | Loopback |
| Loopback1 | 3.3.3.3 | Loopback |
| Gig0/0 | 192.168.1.1 | Physical |
→ Router ID = 3.3.3.3
3️⃣ Highest IP address on an active interface
If there are no loopback interfaces, OSPF chooses the highest IP address from the active physical interfaces.
Example:
| Interface | IP Address | Status |
|---|---|---|
| Gig0/0 | 10.1.1.1 | Up |
| Gig0/1 | 172.16.1.1 | Up |
| Gig0/2 | 192.168.1.1 | Down |
→ Router ID = 172.16.1.1 (highest among active interfaces)
🔁 When is the Router ID Selected?
OSPF chooses the Router ID when the OSPF process starts — either when you:
- Enable OSPF with
router ospf <process-id>, or - Bring up an interface that belongs to an OSPF-enabled network.
If you change something that affects the Router ID (for example, you add a loopback or manually set a new one), you must restart the OSPF process:
Router# clear ip ospf process
Otherwise, the old Router ID will remain active until OSPF is reset.
🔍 How to Verify the Router ID
Use the following command to check the Router ID:
Router# show ip ospf
You’ll see something like:
Routing Process "ospf 1" with ID 1.1.1.1
Other useful commands:
Router# show ip protocols
Router# show ip ospf interface
Router# show ip ospf neighbor
The Router ID will appear in these outputs as well.
🚫 Common Issues (Exam Tip)
| Problem | Cause | Solution |
|---|---|---|
| Two routers have the same Router ID | Duplicate IDs cause neighbor problems | Manually configure unique IDs |
| Router ID didn’t change after configuration | OSPF process already running | Clear the OSPF process |
| No Router ID assigned | No OSPF process or no active interface | Configure loopback or assign manually |
🧾 Summary Table
| Priority | Method | Description | Stability |
|---|---|---|---|
| 1 | Manually configured | Set with router-id command | Very stable |
| 2 | Highest loopback IP | Auto-selected if no manual ID | Stable |
| 3 | Highest active interface IP | Auto-selected if no loopback | Less stable |
🧠 Key Points to Remember for the CCNA Exam
- OSPF uses Router ID to identify routers uniquely.
- The Router ID is a 32-bit number, written like an IPv4 address.
- Selection order: manual > loopback IP > active interface IP.
- Change takes effect only after restarting the OSPF process.
- Router ID must be unique within the OSPF network.
- Used in: neighbor relationships, LSA generation, DR/BDR election.
- Verify using:
show ip ospf,show ip protocols.
