The link-state protocols, also known as shortest path first (SPF), share information with neighboring routers. Each router
builds a link-state advertisement (LSA), which contains information about each link and directly connected neighbor router.
Each LSA has a sequence number. When a router receives an LSA and updates its link-state database, the LSA is flooded to all
adjacent neighbors. If a router receives two LSAs with the same sequence number (from the same router), the router does not
flood the last LSA received to its neighbors to prevent an LSA update loop. Because the router floods the LSAs immediately
after they receive them, convergence time for link-state protocols is minimized.
Discovering neighbors and establishing adjacency is an important part of a link state protocol. Neighbors are discovered using
special Hello packets that also serve as keepalive notifications to each neighbor router. Adjacency is the establishment of
a common set of operating parameters for the link-state protocol between neighbor routers.
The LSAs received by a router are added to its link-state database. Each entry consists of the following parameters:
The router runs the SPF algorithm on the link-state database, building the shortest path tree for that router. This SPF tree
is used to populate the routing table.
In link-state algorithms, each router builds a picture of the entire network in its routing tables. The link-state algorithms
send small updates everywhere, while distance vector algorithms send larger updates only to neighboring routers.
Because they converge more quickly, link-state algorithms are somewhat less prone to routing loops than distance vector algorithms.
However, link-state algorithms require more CPU power and memory than distance vector algorithms. Link-state algorithms can
be more expensive to implement and support. Link-state protocols are generally more scalable than distance vector protocols.
OSPF is an example of a link-state protocol.