# Link state packet

Link State Packet (LSP) is a packet of information generated by a network router in a link state routing protocol that lists the router's neighbors. Link state packets can be further defined as special datagrams that determine the names of and the cost or distance to any neighboring routers and associated networks. They are used to efficiently determine what the new neighbor is, if a link failure occurs, and the cost of changing a link if the need arises. LSPs are queued for transmission, and must time out at about the same time. They must be acknowledged, and can be distributed throughout the network, but cannot use the routing database.

## Developing Link State Packets

When Information needed for exchange is collected, a router then builds a packet containing all the data. The packet starts with the identity of the sender, followed by a sequence number and age, and a list of neighbors. For each neighbor, the delay to that neighbor is given. Building a link state packet is usually easy, the complex part is determining when to build them. One way to reduce this problem is to build them periodically, that is, at regular intervals, or when some significant event occurs, such as a line or neighbor going down or coming back up again, or changing its properties appreciatively.
A major procedure called flooding which is used for distributing link state algorithms throughout the routing domain can be implemented with link state packets. However, ordinary flooding may result in problems, because it generates exponential behavior. Smart flooding, on the other hand, recognizes link state packets appropriately.

## Types of Link State packets

Link state packets are usually implemented with Open Shortest Path First (OSPF) protocol. OSPF's reliable flooding mechanism is implemented by Link State Update and Link State Acknowledgment packets.

### Link state update packet

Link State Update packets are OSPF packet type 4. These packets implement the flooding of link state advertisements. Each Link State Update packet carries a collection of link state advertisements one hop further from its origin. Several link-state advertisement may be included in a single packet.
Link State Update packets are multicast on those physical networks that support multicast/broadcast. In order to make the flooding procedure reliable, flooded advertisements are acknowledged in Link State Acknowledgment packets. If retransmission of certain advertisements is necessary, the retransmitted advertisements are always carried by unicast Link State Update packets.

### Link state acknowledgment packet

Link State Acknowledgment Packets are OSPF packet type 5. To make the flooding of link state advertisements reliable, flooded advertisements are explicitly acknowledged. This acknowledgment is accomplished through the sending and receiving of Link State Acknowledgment packets. Multiple link state advertisements can be acknowledged in a single Link State Acknowledgment packet.
Depending on the state of the sending interface and the source of the advertisements being acknowledged, a Link State Acknowledgment packet is sent either to the multicast address AllSPFRouters, to the multicast address AllDRouters, or as a unicast.