Router ID uniquely identifies each OSPF router in the network, preciselly said OSPF database uses router ID to uniquely identify each router.
By default OSPF uses highest IP address of physical interface as router ID. If Loopback is present it chooses the highest loopback interface instead. If you configure router-id by command under OSPF mode that got highest precedence (this command is just for Cisco platform, it is not RFC, thats why you might use the loopback instead). Router ID doesnt change when the interface goes down. Only when the OSPF process restart or the router reloads. Obviously best choice is to use loopback, because when the process restart or router reloads (change window) you have still same router id. Also not for OSPF but for example for LDP the Router-ID needs to be present in the routing table for LDP session to be established. Thats why loopback is best choice for LDP so you can just have a loopback advertised via IGP. If you create router-id manually then you would have to create static route everywhere or redistribute static to IGP. For OSPF interface used in router-id or router-id in general doesnt have to be advertised.
When OSPF is enabled neighbor routers it may goes through various states.
MNEMONIC – Dogs Attack Individuals To Earn Eating Lovely Food.
- DOWN state – everyone is down, nobody sent anything.
- Attempt – sent hello to multicast address 22.214.171.124
- INIT state – Received Hello without my router-id in hello.
- TWO-WAY state – Received hello and seen my router id in the hello
- EXSTART state – If we are at Multi access segment DR and BDR must be elected. After this happen Extart state can begin. In this state master and slave relationship is created between adjacent routers. The router with the higher ID is the master and can start exchanging DBD during exchange process.
- EXCHANGE state – Master and Slave exchange DBDs. Remember that in DBD we got LSA headers only. They contain information about link, address of advertising router, link cost and sequence number.
- LOADING state – Based on DBD routers find out if they are missing some info in they LSDB which has to be consistent. If they miss some info they ask what they need via LSR. The other side responds with LSU containing all the LSAs. All the communication is ACK including DBD in previous phase.
- FULL state – All the routers in area contain same LSDB. In multiaccess network neighbors form full state with DR and BDR only.