Router ID & Establishing OSPF neighbor adjacency

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.

  1. DOWN state – everyone is down, nobody sent anything.
  2. Attempt – sent hello to multicast address 224.0.0.5
  3. INIT state – Received Hello without my router-id in hello.
  4. TWO-WAY state – Received hello and seen my router id in the hello
  5. 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.
  6. 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.
  7. 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.
  8. FULL state – All the routers in area contain same LSDB. In multiaccess network neighbors form full state with DR and BDR only.