Packets are sent out periodically on all OSPF interfaces to discover new neighbors while ensuring that other neighbors are still online.
Database Description (DBD)
Packets are exchanged when an OSPF adjacency is first being formed. These packets are used to describe the contents of the LSDB, to elect master/slave for the database exchange process and to exchange the LSA headers and select the first sequence number for database exchange.
Link-State Request (LSR)
To request a speciﬁc LSA that is seen during the DBD exchange process.
Link-State Update (LSU)
To send the entire LSA to the neighbor who requested the particular LSA through the link request packet. This packet is also used in ﬂooding.
Link-State Acknowledge (LSACK)
These packets are sent in response to the flooding of LSAs, thus making the flooding a reliable transport feature.
OSPF Header Format
- Version Number: Latest version is 2.
- Type: This ﬁeld indicates which of the ﬁve types of OSPF packets is appended at the end of this header.
- RID: The router ID is used to uniquely identify the router throughout the AS.
- Area ID: This ﬁeld designates the area number to which this packet belongs.
- Checksum: This ﬁeld includes the checksum for the entire OSPF packet, excluding the authentication for data corruption.
- 0 means null authentication
- 1 means plain text
- 2 means MD5
- Authentication: This 64-bit ﬁeld contains the authentication key in case of plain-text authentication. In case of message digest, the 64-bit Authentication ﬁeld is redeﬁned into several other parameters.
OSPF Hello Packet
- Hello packets are used to form a neighbor relationship between two routers.
- In environments that include broadcast/nonbroadcast media, Hello packets are used to elect the designated (DR) and backup designated (BDR) routers.
- On broadcast media, the destination address of the Hello packets is 184.108.40.206.
- On nonbroadcast media, the destination address is unicast.
- Network Mask: Netmask of the interface on which OSPF is running.
- Hello Interval: This interval must be the same for the two routers that are trying to form an adjacency.
- Broadcast / P2P: 10 seconds
- Other media types: 30 seconds
- Options: Optional capabilities supported by the router.
- Rtr Pri: Router’s priority, default is 1. This ﬁeld plays an important role in electing the DR and the BDR. A higher priority increases the chances that the router will become the DR. A priority of 0 means that this router will not take part in DR election.
- Dead Interval: Represents the number, in seconds, before a neighbor is declared dead. By default, the dead interval is four times the Hello interval.
- DR: Lists the IP of the Designated Router.
- If there is no DR, this ﬁeld has a value of 0.0.0.0.
- The DR is elected through the Hello packet.
- The router with the highest priority becomes the DR. If the priorities are equal, the router with the highest RID becomes the DR.
- The purpose of the DR is to reduce the amount of ﬂooding on multiaccess media.
- All routers ﬂood their LSDB to the DR, and the DR then ﬂoods that information back to other routers on that segment.
- BDR: Lists the interface IP of the BDR.
- Neighbor: A list of OSPF neighbors seen on that network segment.
Database Description Packet (DBD)
- The second type of OSPF packet, the database description (DBD) packet, is used mostly during the database exchange.
- The ﬁrst DBD packet is used to elect the master and slave relationship and to set the initial sequence number elected by the master.
- The router with the highest router ID becomes the master and initiates the database synchronization.
- The master sends the sequence number, and the slave acknowledges it.
- After the master and the slave are elected, the database synchronization starts; in this process, the headers of all the LSAs are exchanged with neighbors.
- Interface MTU: This ﬁeld contains the largest data size, in bytes, that can be send through the associated interface. This ﬁeld must be set to 0 when sending the packet over a virtual link.
- DB Description
- I Bit: When set to 1, means that this is the first packet in DBD exchange.
- M Bit: When set to 1, means that more packets will follow.
- MS Bit: Use this for master and slave.
- When set, means the router is the Master in the DBD exchange.
- When set to 0, means router is the Slave.
- DBD Sequence Number: Contains a unique value set by the master. This is used during database exchange. Only a master can increment the sequence number.
- LSA Header: Consists of a list of the LSA database headers.
The following list of requirements must be met for an OSPF neighborship to be formed:
- The RIDs must be unique between the two devices. To prevent errors, they should be unique for the entire OSPF routing domain.
- The interfaces must share a common subnet. OSPF uses the interface’s primary IP address when sending out OSPF hellos. The network mask (netmask) in the hello packet is used to extract the network ID of the hello packet.
- The interface maximum transmission unit (MTU) must match because the OSPF protocol does not support fragmentation.
- The area ID must match for that segment.
- The need for a DR must match for that segment.
- OSPF hello and dead timers must match for that segment.
- The authentication type and credentials (if any) must match for that segment.
- Area type flags must be identical for that segment (stub, NSSA, and so on).
Link-State Request Packet (LSR)
- A link-state request packet, is sent if part of the database is missing or out-of-date.
- The link-state request packet is used to retrieve that precise piece of database information that is missing.
- LS Type: Identifies what type of LSA is being requested.
- Link State ID: Represents the Link State ID of that specific LSA.
- Advertising Router: RID of the router that is originating this LSA.
Link-State Update Packet (LSU)
- The link-state update packet, implements ﬂooding.
- Several LSAs are included in a single packet.
- Link-state update packets are also sent in response to link-state request packets.
- Flooded LSAs are acknowledged in the LSA acknowledgment packet.
- If an LSA is not acknowledged, it is retransmitted every retransmit interval (5 seconds, by default).
Link-State Acknowledgment Packet
- The link-state acknowledgment packet, is used to acknowledge each LSA.
- This packet is sent in response to link-state update packets.
- Multiple LSAs can be acknowledged in a single link-state acknowledgment packet.
- This packet is responsible for the reliable delivery of link-state update packets.
Link-state acknowledgment packets are sent as multicasts. If the state of the router is DR or BDR, the acknowledgment is sent to the OSPF router multicast address of 220.127.116.11. If the state of the router is not DR or BDR, the acknowledgment is sent to the all DR router multicast address of 18.104.22.168.