An OSPF router ID (RID) is a unique 32-bit identifier for a router within an OSPF autonomous system. OSPF includes RIDs in hello messages, uses them to identify neighbors, and uses the highest RID to break designated-router election ties. section 18.2.1 section 18.3.1 section 18.3.2
OSPF determines the RID in this order:
- Use a manually configured value from router configuration mode with router-id. section 18.2.1
- Otherwise select the highest IP address on an operational loopback interface. section 18.2.1
- Otherwise select the highest IP address on an operational physical interface. section 18.2.1
- Require the RID to be unique; duplicate RIDs prevent routers from becoming OSPF neighbors. section 18.3.3
- Use the highest RID as the DR election tie-breaker after interface priorities are compared; use the second-highest RID for the BDR. section 18.3.2
Viewing and setting the RID
After R1 creates OSPF process 1, show ip protocols reports Router ID 203.0.113.1, selected from G0/2. An administrator can then enter router ospf 1 followed by router-id 172.16.1.1; subsequent output reports 172.16.1.1 as the RID. Adding Loopback0 later does not automatically change an already selected RID.
A loopback interface is commonly useful for automatic RID selection because it is software-based and does not depend on one physical port remaining operational. If no operational interface has an IP address, OSPF cannot start until an RID or an operational interface address exists. section 18.2.1
