Each OSPF router selects a router ID (RID) that has to be unique on your network. OSPF stores the topology of the network in its LSDB (Link State Database) and each router is identified with its unique router ID , if you have duplicate router IDs then you will run into reachability issues.
Because of this, two OSPF routers with the same router ID will not become neighbors but you could still have duplicated router IDs in the network with routers that are not directly connected to each other.
OSPF uses the following criteria to select the router ID:
- Manual configuration of the router ID.
- Highest IP address on a loopback interface.
- Highest IP address on a non-loopback interface.
Let’s see this in action. I will use the following router for this demonstration:

There are two physical interfaces and two loopback interfaces. All interfaces are active:
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.1.1 YES manual up up
FastEthernet0/1 192.168.11.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up
Loopback1 11.11.11.11 YES manual up up
Let’s start an OSPF process:
R1(config)#router ospf 1
R1(config-router)#exit
Now we can check what router ID it selected:
R1#show ip protocols | include Router ID
Router ID 11.11.11.11
It selected 11.11.11.11 which is the highest IP address on our loopback interfaces. Let’s get rid of the loopbacks now:
R1(config)#no interface loopback 0
R1(config)#no interface loopback 1
Take a look again at the router ID:
R1#show ip protocols | include Router ID
Router ID 11.11.11.11
It’s still the same, this is because the router ID selection is only done once. You have to reset the OSPF process before it will select another one:
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
Let’s see if this makes any difference:
R1#show ip protocols | include Router ID
Router ID 192.168.11.1
There we go, the router ID is now the highest IP address of our physical interfaces. If you want we can manually set the router ID. This will overrule everything:
R1(config)#router ospf 1
R1(config-router)#router-id 111.111.111.111
Use the router-id command for this. Let’s verify our work:
R1#show ip protocols | include Router ID
Router ID 111.111.111.111
There we go, our new router ID is visible.
Unit 1: Introduction to OSPF
- Introduction to OSPF
- Basic OSPF Configuration
- OSPF Multi Area Configuration
- OSPF Reference Bandwidth
- OSPF Plain Text Authentication
- OSPF MD5 Authentication
- OSPF SHA-HMAC Authentication
- OSPF TTL Security Check
- OSPF Default Route
Unit 2: OSPF Neighbor Adjacency
- OSPF LSA Types
- OSPF LSAs and LSDB Flooding
- OSPF Hello and Dead Interval
- OSPF Router ID
- OSPF Packets and Neighbor Discovery
- OSPF DR/BDR Election
- OSPF Passive Interface
- Troubleshooting OSPF Neighbor Adjacency
Unit 3: OSPF Network Types
- OSPF Non-Broadcast Network Type
- OSPF Broadcast Network Type
- OSPF Point-to-Multipoint Network Type
- OSPF Point-to-Multipoint Non-Broadcast Network Type
- OSPF Point-to-Point Network Type
- OSPF Next Hop with Network Types
Unit 4: OSPF Stub Areas
- Introduction to OSPF Stub Areas
- How to configure OSPF Stub Area
- How to configure OSPF Totally Stub
- How to configure OSPF NSSA (Not So Stubby) Area
- How to configure OSPF Totally NSSA (Not So Stubby) Area
- OSPF NSSA P-bit explained
Unit 5: Advanced OSPF Topics
- OSPF Summarization
- OSPF Distribute-List Filtering
- OSPF LSA Type 3 Filtering
- OSPF LSA Type 5 Filtering
- OSPF Virtual Link
- OSPF Virtual Link Authentication
- OSPF Path Selection Explained
- How to read the OSPF Database
- OSPFv3 for IPv4
- Troubleshooting OSPF Route Advertisement
- OSPF SPF Scheduling and Throttling
- OSPF LSA Throttling
- OSPF Incremental SPF
- OSPF Prefix Suppression
- OSPF Stub Router
- OSPF Graceful Shutdown
- OSPF Graceful Restart
- OSPF Loop-Free Alternate (LFA) Fast Reroute (FRR)
- OSPF Remote Loop-Free Alternate (LFA) Fast Reroute (FRR)