When a router is running OSPF the OSPF process will select and use a Router ID. This ID must be unique inside of an OSPF area.
This ID will not change unless the process is restarted or otherwise cleared. This is due in part as a topology convergence will be required to recompute the paths with the new router (or at least that is what OSPF will treat the change as).
The router ID is a 32bit number usually shown in dotted decimal similar to IPv4 addresses.
OSPF v2 (IPv4)
Router ID will be selected in this order.
- Manually configured ID
- Highest IP address on a loopback interface.
- Highest IP address on a active interface.
OSPF v3 (IPv6)
The only difference to note with OSPFv3 is that the Router ID stays a 32bit number and is selected in the same manner as OSPFv2. If no IPv4 address is assigned to the router the router ID must be set.