Searching OSPF Routers

Identifying OSPF Routers with a Router ID

OSPF needs to uniquely identify each router for many reasons.  First, neighbors need a way to know which router sent a particular OSPF message.  The OSPF LSDB lists a set of Link State Advertisements (LSA), some of which describe each router in the internetwork, so the LSDB needs a unique identifier for each router.  To that end, OSPF uses a concept called the OSPF router ID (RID).

OSPF RIDs are 32-bit numbers written in dotted decimal, so using an IP address is a convenient way to find a default RID.  Alternatively, the OSPF RID can be directly configured.

Meeting Neighbors by Saying Hello

As soon as a router has chosen its OSPF RID, and some interfaces come up, the router is ready to meets its OSPF neighbors.  OSPF routers can become neighbors if they are connected to the same subnet.  To discover other OSPF-speaking routers, a router sends multicast OSPF Hello packets to each interface and hopes to receive OSPF Hello packets from other routers connected to those interfaces.

Hello messages have the following features:

* The Hello message follows the IP packet header, with IP packet protocol type 89.

* Hello packets are sent to multicast IP address, a multicast IP address intended for all OSPF-speaking routers.

* OSPF routers listen for packets sent to IP multicast address, in part hoping to receive Hello packets and learn about new neighbors.

The Hello message includes the sending router’s RID, Area ID, Hello interval, dead interval, router priority, the RID of the designated router, the RID of the backup designated router, and a list of neighbors that the sending router already knows about on the subnet.

As soon as a router sees its own RID in a received Hello, the router believes that two-way communication has been established with that neighbor.  The two-way state for a neighbor is important, because at that point, more detailed information, such as LSAs, can be exchanged.  Also, in some cases on LANs, neighbors might reach the two-way state and stop there.