In order to operate, an OSPF process requires a 32bit Router ID. This Router ID is not an IP address, but uses the same format as an IPv4 address. Note a 32bit Router ID is required for both version 2 and version 3 (IPv6).
Should an OSPF process initiate without a configured Router ID, or on a router with no configure interfaces, the following message will be seen:
R1(config-router)# *Oct 9 11:26:02.075: %OSPF-4-NORTRID: OSPF process 1 failed to allocate unique router-id and cannot start
Show IP protocols will show a 0.0.0.0 ID which is reserved and not valid. Until a valid ID is used the process will not start.
R1#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 0.0.0.0
Number of areas in this router is 0. 0 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)

OSPF uses the following sequence to determine the Router ID.
- The Router ID is manually configured.
- The highest IP address on any non shutdown loopack (i.e. not yet allocated to any other OSPF process) is used.
- The highest IP address on any none shutdown physical interface (not yet allocated to any other OSPF process) is used. This interface can be in the down/down state, as long as it is not admin down.
Notes
- To manually configure the Router ID use the following config. Note that in this case the Router is not a valid IP address, this because it is not an IP address, but just uses the 4 octet format.
R1(config)#router ospf 1 R1(config-router)#router-id 0.0.0.1
- It should be emphasised that each OSPF process running on a router must have a unique Router ID. This is also true for OSPF processes running in a VRF on the same router. This is illustrated below:
R1(config)#router ospf 2 vrf ospf-vrf *Oct 9 12:21:57.215: %OSPF-4-NORTRID: OSPF process 2 failed to allocate unique router-id and cannot start R1(config-router)#router-id 0.0.0.1 % OSPF: router-id 0.0.0.1 in use by ospf process 1
OSPF makes the decision regarding the Router-ID based on the states of the interfaces when the process first comes up. Should a better loopback be configured the OSPF process would not automatically be restarted. The process would have to be manually cleared or the router rebooted. This is not the case however if the Router ID is manually configured. Changing the Router ID manually has immediate effect. When the Router ID changes a SPF recalculation will also occur.